Skip to content

Commit

Permalink
functions: add '/t'
Browse files Browse the repository at this point in the history
The HTML/JavaScript tools are so simple that there's no need to track
them via Git. This adds a shortcut to serve them directly from R2.
  • Loading branch information
myhro committed Oct 20, 2024
1 parent 354660f commit d3ed847
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 191 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.wrangler/
node_modules/
96 changes: 0 additions & 96 deletions clip/index.html

This file was deleted.

16 changes: 16 additions & 0 deletions functions/t/[slug].ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { EventContext } from '@cloudflare/workers-types';

export async function onRequestGet({
params,
}: EventContext<unknown, string, unknown>) {
const target = `https://pub-5f2914f703904c419629da4d1ac2436f.r2.dev/tools/${params.slug}.html`;
const response = await fetch(target);
if (response.status === 404) {
return new Response('Not Found', { status: 404 });
}

const content = await response.text();
return new Response(content, {
headers: { 'Content-Type': 'text/html' },
});
}
95 changes: 0 additions & 95 deletions human/index.html

This file was deleted.

0 comments on commit d3ed847

Please sign in to comment.