5 if (url.pathname == "/js/entry.client.js") {
6 const moduleUrl = new URL("./entry.client.tsx", import.meta.url);
7 return fetch(moduleUrl);
8 }
9 return handler(request);
3export async function loader({ request }: LoaderFunctionArgs) {
4 let url = new URL(request.url);
5 let res = await fetch(url, {
6 headers: {
7 Accept: "application/json",
15 let url = new URL(request.url);
16 // call the server action
17 let res = await fetch(url, {
18 method: "POST",
19 body: new URLSearchParams(await request.formData()),
2
3export default async function(req: Request): Promise<Response> {
4 const markdown = await fetch(import.meta.resolve("./README.md")).then(res => res.text());
5 const url = new URL(req.url);
6
140});
141
142export default app.fetch;
140});
141
142export default app.fetch;
2export async function importFile(path: string) {
3 const url = new URL(path, import.meta.url);
4 const res = await fetch(url, { redirect: "follow" });
5 if (!res.ok) return null;
6 return await res.text();
51
52 useEffect(() => {
53 fetchState();
54 }, []);
55
56 /**
57 * Fetches the current state from the server
58 */
59 const fetchState = async () => {
60 setIsLoading(true);
61 setError(null);
62 try {
63 const response = await fetch("/api/state");
64 if (!response.ok) throw new Error("Failed to fetch state");
65 const data = await response.json();
66 setState(data);
80 setError(null);
81 try {
82 const response = await fetch("/api/state", {
83 method: "POST",
84 headers: { "Content-Type": "application/json" },
86 });
87 if (!response.ok) throw new Error("Failed to update state");
88 await fetchState();
89 } catch (err) {
90 setError(err.message);
565 if (webhookUrl) {
566 try {
567 await fetch(webhookUrl, {
568 method: "POST",
569 headers: { "Content-Type": "application/json" },
7countPath(app);
8
9export default app.fetch;
10const TABLE_NAME = `${KEY}_versions_v1`;
11
12async function fetchContent(url: string) {
13 const response = await fetch(url);
14 return await response.text();
15}
30
31 for (const url of URLS) {
32 const content = await fetchContent(url);
33 const latestVersion = await sqlite.execute(
34 `SELECT blob_key FROM ${TABLE_NAME} WHERE url = ? ORDER BY timestamp DESC LIMIT 1`,
11const supabase = createClient(supabaseUrl, supabaseKey)
12
13// Disable prefetch as it is not supported for "Transaction" pool mode
14export const client = postgres(connectionString, { prepare: false })