reddit-checkertest-slack.ts3 matches
76};
7778const response = await fetch(SLACK_WEBHOOK_URL, {
79method: 'POST',
80headers: {
119};
120121const response = await fetch(SLACK_WEBHOOK_URL, {
122method: 'POST',
123headers: {
155};
156157const response = await fetch(SLACK_WEBHOOK_URL, {
158method: 'POST',
159headers: {
reddit-checkertest-reddit-api.ts6 matches
42const auth = btoa(`${clientId}:${clientSecret}`);
43
44const response = await fetch('https://www.reddit.com/api/v1/access_token', {
45method: 'POST',
46headers: {
6667/**
68* Fetches recent posts from a subreddit using Reddit API
69*/
70async function fetchSubredditPosts(accessToken: string, subreddit: string, limit: number = 10): Promise<RedditPost[]> {
71try {
72const url = `https://oauth.reddit.com/r/${subreddit}/new?limit=${limit}`;
73
74const response = await fetch(url, {
75headers: {
76'Authorization': `Bearer ${accessToken}`,
87return data.data.children.map(child => child.data);
88} catch (error) {
89console.error(`Error fetching posts from r/${subreddit}:`, error);
90throw error;
91}
159console.log(`🔍 Testing Reddit API connection for r/${subreddit}...`);
160const accessToken = await getRedditAccessToken(clientId, clientSecret);
161const posts = await fetchSubredditPosts(accessToken, subreddit, 10);
162
163const keywords = [
reddit-checkertest-rss-monitor.ts7 matches
9394/**
95* Fetches RSS feed from a subreddit
96*/
97async function fetchSubredditRSS(subreddit: string): Promise<RSSItem[]> {
98try {
99const url = `https://www.reddit.com/r/${subreddit}/new.rss`;
100
101const response = await fetch(url, {
102headers: {
103'User-Agent': 'Mozilla/5.0 (compatible; RedditMonitor/1.0; +https://val.town)',
114return parseRSS(xmlText);
115} catch (error) {
116console.error(`Error fetching RSS from r/${subreddit}:`, error);
117throw error;
118}
140try {
141if (action === 'test') {
142// Test fetching RSS feed
143console.log(`🔍 Testing Reddit RSS connection for r/${subreddit}...`);
144const items = await fetchSubredditRSS(subreddit);
145
146const keywords = ["auth", "authentication", "login", "signin", "signup", "oauth", "jwt", "token"];
222// Return raw RSS XML for debugging
223const rssUrl = `https://www.reddit.com/r/${subreddit}/new.rss`;
224const response = await fetch(rssUrl, {
225headers: {
226'User-Agent': 'Mozilla/5.0 (compatible; RedditMonitor/1.0; +https://val.town)',
reddit-checkerreddit-rss-monitor.ts7 matches
106107/**
108* Fetches RSS feed from a subreddit
109*/
110async function fetchSubredditRSS(subreddit: string): Promise<RSSItem[]> {
111try {
112const url = `https://www.reddit.com/r/${subreddit}/new.rss`;
113
114const response = await fetch(url, {
115headers: {
116'User-Agent': 'Mozilla/5.0 (compatible; RedditMonitor/1.0; +https://val.town)',
127return parseRSS(xmlText);
128} catch (error) {
129console.error(`Error fetching RSS from r/${subreddit}:`, error);
130throw error;
131}
212console.log(`⏰ Last checked: ${lastChecked ? new Date(lastChecked * 1000).toLocaleString() : 'Never'}`);
213214// Fetch RSS feed
215const items = await fetchSubredditRSS(CONFIG.subreddit);
216console.log(`📥 Fetched ${items.length} items from r/${CONFIG.subreddit} RSS feed`);
217218// Filter items that are newer than last check and contain keywords
reddit-checkertest-reddit-monitor.ts6 matches
2728/**
29* Fetches recent posts from a subreddit
30*/
31async function fetchSubredditPosts(subreddit: string, limit: number = 10): Promise<RedditPost[]> {
32try {
33const url = `https://www.reddit.com/r/${subreddit}/new.json?limit=${limit}`;
34
35const response = await fetch(url, {
36headers: {
37'User-Agent': 'Mozilla/5.0 (compatible; RedditMonitor/1.0; +https://val.town)',
49return data.data.children.map(child => child.data);
50} catch (error) {
51console.error(`Error fetching posts from r/${subreddit}:`, error);
52throw error;
53}
63try {
64if (action === 'test') {
65// Test fetching posts
66console.log('🔍 Testing Reddit API connection...');
67const posts = await fetchSubredditPosts('lovable', 10);
68
69const keywords = ["auth", "authentication", "login", "signin", "signup", "oauth", "jwt", "token"];
reddit-checkerreddit-monitor.ts7 matches
4041/**
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}`;
47
48const response = await fetch(url, {
49headers: {
50'User-Agent': 'Mozilla/5.0 (compatible; RedditMonitor/1.0; +https://val.town)',
62return data.data.children.map(child => child.data);
63} catch (error) {
64console.error(`Error fetching posts from r/${subreddit}:`, error);
65throw error;
66}
129console.log(`⏰ Last checked: ${lastChecked ? new Date(lastChecked * 1000).toLocaleString() : 'Never'}`);
130131// Fetch recent posts
132const posts = await fetchSubredditPosts(CONFIG.subreddit);
133console.log(`📥 Fetched ${posts.length} posts from r/${CONFIG.subreddit}`);
134135// Filter posts that are newer than last check and contain keywords
agatha-proxymain.tsx3 matches
10const manifestBaseUrl = "https://agatha.arch.be/data/json/";
1112async function fetchJson(id: string) {
13const headers = new Headers([
14["referer", "https://agatha.arch.be/"],
15]);
16const url = new URL(manifestBaseUrl + id);
17return fetch(url, { headers })
18.then(resp => resp.json())
19.catch((err) => ({ error: `Could not access item ${id}` }));
31let resp;
32if (requestType === "manifest") {
33resp = await fetchJson(requestParams.join("/"));
34}
35if (resp.error) {
5455// Forward the request to Brave Search API
56const braveResponse = await fetch(`${braveApiUrl}?${braveParams}`, {
57method: 'GET',
58headers: {
564565try {
566const response = await fetch(window.location.pathname + '?format=json', { method: 'POST', headers: { 'Accept': 'application/json'}, body: formData });
567const data = await response.json();
568if (!response.ok) { throw new Error(data?.error || data?.details || response.statusText || \`Server status: \${response.status}\`); }
615616} catch (error) {
617console.error("Fetch Error:", error);
618displayError('errorFetchFailed', { errorMessage: error.message });
619setLoadingState(false);
620}
652// --- Dynamic Imports ---
653const { OpenAI } = await import("https://esm.town/v/std/openai");
654const { fetch } = await import("https://esm.town/v/std/fetch");
655const { PDFExtract } = await import("npm:pdf.js-extract");
656763errorInvalidFile: "Invalid file type. Please upload a {{document_format_accepted | default('PDF')}}.",
764errorFileSize: "File is too large (Max {{max_pdf_size_mb}}MB).",
765errorFetchFailed: "Failed to perform analysis: {{errorMessage}}",
766contactNamePlaceholder: APP_CONFIG.contact_form_placeholders_en.name,
767contactEmailPlaceholder: APP_CONFIG.contact_form_placeholders_en.email,
803errorInvalidFile: "Tipo de archivo inválido. Por favor, suba un {{document_format_accepted | default('PDF')}}.",
804errorFileSize: "El archivo es demasiado grande (Máx {{max_pdf_size_mb}}MB).",
805errorFetchFailed: "Falló la realización del análisis: {{errorMessage}}",
806contactNamePlaceholder: APP_CONFIG.contact_form_placeholders_es.name,
807contactEmailPlaceholder: APP_CONFIG.contact_form_placeholders_es.email,
872}
873try {
874const response = await fetch(ref.potentialUrl, { method: "HEAD", redirect: "follow", timeout: 5000 });
875ref.traversalStatus = response.ok ? "success" : "failed";
876if (!response.ok) ref.error = `Status ${response.status}`;
877} catch (e) {
878ref.traversalStatus = "failed";
879ref.error = e.name === "AbortError" || e.message.includes("timed out") ? "Timeout" : "Fetch Error";
880}
881return ref;
904docText = await extractPdfTextNative(buffer, input.documentFile.name, log);
905} else if (input.documentUrl) {
906log.push({ agent: ingestAgent, type: "input", message: `Fetching content from URL: ${input.documentUrl}` });
907try {
908const response = await fetch(input.documentUrl);
909if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
910docText = await response.text();
911log.push({ agent: ingestAgent, type: "result", message: `Fetched ${docText.length} characters.` });
912} catch (e) {
913log.push({ agent: ingestAgent, type: "error", message: `Failed to fetch URL: ${e.message}. Halting.` });
914}
915} else if (input.documentText) {