32
33async function checkStargazers(repo: string) {
34 console.log(`Fetching repo data for ${repo}`);
35 const response = await fetch(`https://api.github.com/repos/${repo}`, {
36 headers: { "Authorization": `Bearer ${Deno.env.get("GITHUB_TOKEN")}` }
37 });
66
67 const lastPage = Math.ceil(currentStars / 100);
68 console.log(`Fetching stargazers page ${lastPage}`);
69 const starResponse = await fetch(
70 `https://api.github.com/repos/${repo}/stargazers?per_page=100&page=${lastPage}`,
71 {
83 console.log(`Retrieved ${newStargazers.length} new stargazers`);
84 } else {
85 console.error(`Failed to fetch stargazers: ${starResponse.status}`);
86 }
87
21 }
22
23 await fetch(slackUrl, {
24 method: "POST",
25 headers: { "Content-Type": "application/json" },
21- **REPOS** (line 8-12): List of repositories to monitor
22- Environment variables needed:
23 - `GITHUB_TOKEN`: GitHub API token for fetching stargazer data
24 - `SLACK_WEBHOOK_URL`: Slack webhook for notifications (optional)
1import { fetch } from "https://esm.town/v/std/fetch";
2import process from "node:process";
3
31 description?: string;
32}) =>
33 await fetch(`https://api.prowlapp.com/publicapi/add?${
34 new URLSearchParams({
35 apikey: process.env.prowl,
4const feedUrl = 'https://feeds.ancientfaith.com/simplepath';
5
6async function fetchRssItems(url) {
7 const req = await fetch(url);
8 const text = await req.text();
9 var result = JSON.parse(xml2json(text, {compact: true, spaces: 4}));
11}
12
13async function fetchEpisodes() {
14 const items = await fetchRssItems(feedUrl);
15 items.reverse();
16 return items.map((item, idx) => {
52 const {pathname} = new URL(req.url);
53 const response = (text,type) => new Response(text, { headers: { "Content-Type": type }});
54 const page = renderPage(await fetchEpisodes());
55 return (
56 pathname == "/" ? response(page, "text/html") :
447});
448
449export default app.fetch;
13 }
14 let clientSubscription = await registration.pushManager.getSubscription();
15 let serverSubscription = await (await fetch("/subscription")).json();
16
17 if (clientSubscription === null) {
47 button.disabled = true;
48 button.textContent = await (
49 await fetch("/subscription", {
50 method: "PUT",
51 body: JSON.stringify(
55 userVisibleOnly: true,
56 applicationServerKey: await (
57 await fetch("/vapidPublicKey")
58 ).text(),
59 }),
1import { fetch } from "https://esm.town/v/std/fetch";
2import { parseCourses } from "./parseCourses.tsx";
3
7][];
8export const queryTimetable = (path: string, params: Params) => {
9 const fetchTimetable = (path: string, params: Params) =>
10 fetch(`https://oracle-www.dartmouth.edu/dart/groucho/timetable.${path}`, {
11 headers: {
12 accept: "text/html",
20 ? Promise.resolve(resp)
21 : Promise.reject(resp.statusText);
22 return fetchTimetable(path, params)
23 .then(throwBadResponse)
24 .then((resp) => resp.text())
31
32export default async (req: Request): Promise<Response> => {
33 const code = await fetch(RAW_SOURCE).then((r) => r.text());
34 const theme = THEMES[Math.floor(Math.random() * THEMES.length)];
35 const userAgent = req.headers.get("user-agent");
48 return c.text("Sent notification!", 201);
49 });
50 return app.fetch(req);
51 } catch (f) {
52 console.error(f.toString() + "\n" + f.stack);