1import { email } from "https://esm.town/v/std/email?v=9";
2
3async function fetchRandomJoke() {
4 const response = await fetch(
5 "https://official-joke-api.appspot.com/random_joke",
6 );
8}
9
10const randomJoke = await fetchRandomJoke();
11const setup = randomJoke.setup;
12const punchline = randomJoke.punchline;
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4function fetchRandomJoke() {
5 async function fetchRandomJoke() {
6 const response = await fetch(
7 "https://official-joke-api.appspot.com/random_joke",
8 );
11}
12
13const randomJoke = await fetchRandomJoke();
14const setup = randomJoke.setup;
15const punchline = randomJoke.punchline;
3
4export default async function(req: Request) {
5 let resp = await fetch(`https://${new URL(req.url).pathname.replace(/^https?:\/\//, '')}`, req);
6 let body = await resp.text();
7 let doc = new JSDOM(body);
10 const start = performance.now();
11 try {
12 const res = await fetch(url, {
13 method: 'GET',
14 headers: { 'User-Agent': 'ValTown Uptime Checker' }
24 } catch (e) {
25 end = performance.now();
26 reason = `couldn't fetch: ${e}`;
27 ok = false;
28 console.log(`Website down (${url}): ${reason} (${end - start}ms)`);
51
52 useEffect(() => {
53 async function fetchUptimeData() {
54 try {
55 const response = await fetch('/uptime-data');
56 const data = await response.json();
57 setUptimeData(data);
58 setLoading(false);
59 } catch (error) {
60 console.error('Failed to fetch uptime data:', error);
61 setLoading(false);
62 }
63 }
64 fetchUptimeData();
65 const interval = setInterval(fetchUptimeData, 60000); // Refresh every minute
66 return () => clearInterval(interval);
67 }, []);
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;
9 "https://public.api.bsky.app/xrpc/app.bsky.feed.getAuthorFeed?actor=stevekrouse.com&filter=posts_no_replies";
10
11 const data: Feed = await fetch(url).then((r) => r.json());
12
13 return new Response(
4};
5
6// Fetches a random joke.
7function fetchRandomJoke() {
8 const SAMPLE_JOKE = {
9 "setup": "What do you call a group of disorganized cats?",
14}
15
16const randomJoke = fetchRandomJoke();
17const setup = randomJoke.setup;
18const punchline = randomJoke.punchline;
28
29 try {
30 // Fetch user data
31 const resp = await client.me.profile.retrieve();
32 const token = jwt.sign(resp, privateKeyPem, { algorithm: "RS256", expiresIn: "1h" });
142}
143
144export default app.fetch.bind(app);
8 const url = "https://public.api.bsky.app/xrpc/app.bsky.feed.getAuthorFeed?actor=wilb.me&filter=posts_no_replies";
9
10 const data: Feed = await fetch(url).then((r) => r.json());
11
12 return new Response(