Back

Version 53

10/28/2024
/** @jsxImportSource npm:hono/jsx */
import { blob } from "https://esm.town/v/std/blob";
import { fetch } from "https://esm.town/v/std/fetch";
import { schedulePurge, schedulePush, scheduleRead } from "https://esm.town/v/temptemp/radiodb";
import { Hono } from "npm:hono";
const app = new Hono();
app.get("/schedule", async (c) => {
const current = new Date();
current.setSeconds(current.getSeconds() + 10);
await schedulePurge();
const rows = await scheduleRead();
return c.json(rows);
});
app.get("/", async (c) => {
let number = Number(await (await blob.getJSON("radio"))?.value ?? 0);
await blob.setJSON("radio", { value: number + 1 });
console.log(number);
const random = "slug";
return c.text(
`#EXTM3U
#EXT-X-PLAYLIST-TYPE:EVENT
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:${number + 1}
#EXT-X-TARGETDURATION:10

#EXTINF:10.0,
audio/${random}
#EXTINF:10.0,
audio/${random}
#EXTINF:10.0,
audio/${random}
`,
);
});
app.get("/audio/:slug", async (c) => {
const req = await fetch(
temptemp-methodicalolivesparrow.web.val.run
Updated: November 13, 2024