reddit-checkerreddit-monitor.ts7 matches
42* Fetches recent posts from a subreddit
43*/
44async function fetchSubredditPosts(subreddit: string, limit: number = 25): Promise<RedditPost[]> {
45try {
46const url = `https://www.reddit.com/r/${subreddit}/new.json?limit=${limit}`;
70* Checks if a post contains any of the specified keywords
71*/
72function containsKeywords(post: RedditPost, keywords: string[]): boolean {
73const searchText = `${post.title} ${post.selftext}`.toLowerCase();
74return keywords.some(keyword => searchText.includes(keyword.toLowerCase()));
78* Formats a post for notification
79*/
80function formatPost(post: RedditPost, matchedKeywords: string[]): string {
81const redditUrl = `https://www.reddit.com${post.permalink}`;
82const createdDate = new Date(post.created_utc * 1000).toLocaleString();
101* Gets the last checked timestamp from storage
102*/
103async function getLastChecked(): Promise<number> {
104try {
105const data = await blob.getJSON("reddit_monitor_last_checked");
113* Saves the last checked timestamp to storage
114*/
115async function saveLastChecked(timestamp: number): Promise<void> {
116await blob.setJSON("reddit_monitor_last_checked", { timestamp });
117}
118119/**
120* Main monitoring function
121*/
122export default async function() {
123console.log(`๐ Starting Reddit monitor for r/${CONFIG.subreddit}`);
124console.log(`๐ Keywords: ${CONFIG.keywords.join(', ')}`);
agatha-proxymain.tsx2 matches
10const manifestBaseUrl = "https://agatha.arch.be/data/json/";
1112async function fetchJson(id: string) {
13const headers = new Headers([
14["referer", "https://agatha.arch.be/"],
20}
2122export default async function(req: Request): Promise<Response> {
23const url = new URL(req.url);
24const params = url.searchParams;
untitled-6415main.ts1 match
12const FAST_MODEL = 'claude-3-5-haiku-latest';
1314export default async function handler(request: Request) {
15if (request.method !== "POST") {
16return Response.json({ message: "This endpoint responds to POST requests." }, {
1export default async function (req: Request): Promise<Response> {
2// Handle CORS preflight requests
3if (req.method === 'OPTIONS') {
13* - Bilingual support (English/Spanish) for UI elements.
14* - Built with 'npm:pdf.js-extract' for robust server-side PDF text extraction.
15* - Serves both the interactive HTML UI and the backend API endpoint from a single Val Town function.
16*
17* Configuration for the application (like agent definitions, UI text, and application settings)
18* is defined directly in the main function handler below.
19*
20* Assumes the 'openai' secret, containing your OpenAI API key, is set in your Val Town environment.
41}
4243// --- HTML Generation Function (Glassmorphism UI) ---
44function generateHtmlShell(
45initialUrl,
46initialText,
308let currentLocale = APP_CONFIG.default_language || 'en';
309310// --- Localization Functions ---
311function translate(key, replacements = {}) {
312let text = locales[currentLocale]?.[key] || locales['en']?.[key] || key;
313for (const placeholder in replacements) {
317}
318319function applyTranslations() {
320document.querySelectorAll('[data-translate]').forEach(el => {
321const key = el.getAttribute('data-translate');
341}
342343function setLocale(locale) {
344if (locales[locale]) {
345currentLocale = locale;
351}
352
353function updateLocaleButtons() {
354document.querySelectorAll('.lang-btn').forEach(btn => btn.classList.toggle('active', btn.dataset.lang === currentLocale));
355const linkHtml = \`<a href="\${APP_CONFIG.footer_powered_by_url}" target="_top">\${APP_CONFIG.footer_powered_by_link_text}</a>\`;
386const resultsContainer = document.getElementById('results-content-cards');
387388// --- UI Update Functions ---
389function setLoadingState(isLoading) {
390submitButton.disabled = isLoading;
391if (isLoading) {
402}
403404function displayError(messageKey, replacements = {}) {
405const message = translate(messageKey, replacements);
406errorContainer.textContent = message;
410}
411412function clearResults() {
413ANALYSIS_AGENTS.forEach(agent => {
414if (agent.ui_display_info) {
431}
432433function updateLoadingProgress(percentage, statusKey, agentName = '') {
434progressBar.style.width = \`\${percentage}%\`;
435let statusText = translate(statusKey);
440}
441442// --- Result Rendering Functions ---
443function renderAgentResult(agentId, agentResultData, agentConfig) {
444const card = document.getElementById(\`card-\${agentId}\`);
445const contentEl = document.getElementById(\`content-\${agentId}\`);
649650// --- Main Request Handler (Server Code) ---
651export default async function(req: Request) {
652// --- Dynamic Imports ---
653const { OpenAI } = await import("https://esm.town/v/std/openai");
812813// --- Helper: Extract Text using pdf.js-extract ---
814async function extractPdfTextNative(data: ArrayBuffer, fileName: string, log: LogEntry[]): Promise<string | null> {
815const agent = "PDF Extraction Agent";
816try {
827}
828829// --- Helper Function: Call OpenAI API ---
830async function callOpenAI(
831openai: OpenAI,
832systemPrompt: string,
861}
862863// --- Helper Function: Traverse References ---
864async function traverseReferences(references: Reference[], log: LogEntry[]): Promise<Reference[]> {
865const agent = "Reference Traversal Agent";
866log.push({ agent, type: "step", message: `Traversing ${references.length} potential reference URLs... ` });
888889// --- Main Agent Flow Logic ---
890async function runAgentFlow(
891input: { documentUrl?: string; documentText?: string; documentFile?: File },
892log: LogEntry[],
PreactHookshooks.js23 matches
1// Custom Hooks
2export function useAtom(key, defaultValue) {
3const getValue = JSON.parse(localStorage.getItem(key));
4const nanoStore = atom(getValue || defaultValue);
5nanoStore.listen(function(value, old) {
6localStorage.setItem(key, JSON.stringify(value));
7});
15}
1617export function useConsole(tag, color) {
18const key = `%c[${tag.toUpperCase()}]`;
19const style = `color: ${color}; font-weight: bold;`;
20const logFunction = (...data) => console.log(key, style, ...data);
21logFunction.log = (...data) => console.log(key, style, ...data);
22logFunction.error = (...data) => console.error(key, style, ...data);
23logFunction.warn = (...data) => console.warn(key, style, ...data);
24logFunction.info = (...data) => console.info(key, style, ...data);
25return logFunction;
26}
2728export function useEventListener(func, setup) {
29const callback = useCallback(func, []);
30const { parentElement, parentEvent, runOnMount } = setup;
31useEffect(function mount() {
32const ctrl = new AbortController();
33if (runOnMount === true) callback(null);
36signal: ctrl.signal,
37});
38return function unmount() {
39ctrl.abort();
40};
46}
4748export function useLibrary(url, callback) {
49const [lib, setLib] = useState(null);
50useEffect(function() {
51// alert("useLibrary()");
52if (!lib) return import(url).then(setLib);
56}
5758export function useMQTT(setup) {
59let connection = null;
60return useEffect(() => {
61const task = setTimeout(async function() {
62const token = "b97eb957-1db6-4d2f-aa2e-1df60e99834c";
63const mqtt = (await import("https://esm.sh/mqtt")).default; // mqtt/dist/mqtt.min.js
69connection.on("end", () => setup.stop());
70}, 250);
71return function() {
72if (connection) connection.end(true);
73if (task) clearTimeout(task);
76}
7778export function useNetworkStatus() {
79const ctrl = new AbortController();
80const [isOnline, setIsOnline] = useState(navigator.onLine);
88}
8990export function useStyles(...args) {
91return args.filter(Boolean).map(function(data) {
92const isObject = typeof data == "object";
93if (isObject) return css(data);
96}
9798export function useSet(initialValues = []) {
99const [set, setSet] = useState(() => new Set(initialValues));
100const add = value => {
118}
119120export function useObject(initial = {}) {
121const [_, setObj] = useState(); // dummy to trigger updates
122const ref = useRef({ ...initial });
150151// Custom Helpers
152export function tryCatch(attempt, fail) {
153try {
154return attempt ? attempt() : true;
27- **Export/Import**: Backup and restore your BIN collection as JSON
28- **Local Storage**: Secure browser-based storage with automatic saving
29- **Copy Functions**: Copy BIN only or full card data with one click
30- **Generate Integration**: Quick access to card generator with selected BIN
31- **Featured BINs**: Pre-loaded collection with premium BIN examples
124โ โ โโโ Card3D.tsx # 3D card component
125โ โ โโโ BulkResults.tsx # Bulk generation results
126โ โ โโโ BinLookup.tsx # BIN lookup functionality
127โ โ โโโ BINExtrap.tsx # BIN collection management
128โ โ โโโ TelegramLinks.tsx # Telegram channel and creator links
SON-GOKUCardGenerator.tsx1 match
22}
2324export default function CardGenerator({ onCardGenerated, onBulkGenerated, onGenerating }: CardGeneratorProps) {
25const [selectedType, setSelectedType] = useState<CardType>('visa');
26const [customBin, setCustomBin] = useState('');
SON-GOKUBulkResults.tsx3 matches
11}
1213export default function BulkResults({ cards, totalGenerated, generationTime, mode, onClose }: BulkResultsProps) {
14const [selectedFormat, setSelectedFormat] = useState<'csv' | 'json' | 'text' | 'list'>('list');
15const [currentPage, setCurrentPage] = useState(1);
261}
262263export default function BulkResults({ result, onClose }: BulkResultsProps) {
264const [selectedFormat, setSelectedFormat] = useState<'csv' | 'json' | 'text' | 'list'>('list');
265const [currentPage, setCurrentPage] = useState(1);
541}
542543export default function BulkResults({ cards, totalGenerated, generationTime, mode, onClose }: BulkResultsProps) {
544const [selectedFormat, setSelectedFormat] = useState<'csv' | 'json' | 'text' | 'list'>('list');
545const [currentPage, setCurrentPage] = useState(1);
58}
59
60// Import validation function
61const { validateCardNumber } = await import("../shared/utils.ts");
62const isValid = validateCardNumber(cardNumber);
80}
81
82// Import generation functions
83const {
84generateCardData,
183}
184
185// Import validation function
186const { validateBulkFormat, getFormatExamples } = await import("../shared/utils.ts");
187
209}
210
211// Import validation function
212const { validateBin, detectCardType } = await import("../shared/utils.ts");
213