commit
bf194a8545
25
functions/e/[id].ts
Normal file
25
functions/e/[id].ts
Normal file
@ -0,0 +1,25 @@
|
||||
interface Env {
|
||||
}
|
||||
|
||||
export const onRequest: PagesFunction<Env> = async (context) => {
|
||||
const id = context.params.id as string;
|
||||
|
||||
const next = await context.next();
|
||||
console.debug(next.status);
|
||||
console.debug("Fetching data for: ", id);
|
||||
|
||||
const rsp = await fetch(`https://api.snort.social/api/v1/og/tag/e/${id}`, {
|
||||
method: "POST",
|
||||
body: await next.arrayBuffer(),
|
||||
headers: {
|
||||
"content-type": "text/plain"
|
||||
}
|
||||
});
|
||||
console.debug(rsp.status, rsp.statusText);
|
||||
const body = await rsp.text();
|
||||
return new Response(body, {
|
||||
headers: {
|
||||
"content-type": "text/html"
|
||||
}
|
||||
});
|
||||
}
|
25
functions/p/[id].ts
Normal file
25
functions/p/[id].ts
Normal file
@ -0,0 +1,25 @@
|
||||
interface Env {
|
||||
}
|
||||
|
||||
export const onRequest: PagesFunction<Env> = async (context) => {
|
||||
const id = context.params.id as string;
|
||||
|
||||
const next = await context.next();
|
||||
console.debug(next.status);
|
||||
console.debug("Fetching data for: ", id);
|
||||
|
||||
const rsp = await fetch(`https://api.snort.social/api/v1/og/tag/p/${id}`, {
|
||||
method: "POST",
|
||||
body: await next.arrayBuffer(),
|
||||
headers: {
|
||||
"content-type": "text/plain"
|
||||
}
|
||||
});
|
||||
console.debug(rsp.status, rsp.statusText);
|
||||
const body = await rsp.text();
|
||||
return new Response(body, {
|
||||
headers: {
|
||||
"content-type": "text/html"
|
||||
}
|
||||
});
|
||||
}
|
8
functions/tsconfig.json
Normal file
8
functions/tsconfig.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"lib": ["esnext"],
|
||||
"types": ["@cloudflare/workers-types"]
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@
|
||||
"start": "yarn workspace @snort/nostr build && yarn workspace @snort/app start"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^1.2.3"
|
||||
"@tauri-apps/cli": "^1.2.3",
|
||||
"@cloudflare/workers-types": "^4.20230307.0"
|
||||
}
|
||||
}
|
@ -1083,6 +1083,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||
|
||||
"@cloudflare/workers-types@^4.20230307.0":
|
||||
version "4.20230307.0"
|
||||
resolved "https://registry.yarnpkg.com/@cloudflare/workers-types/-/workers-types-4.20230307.0.tgz#58a20fe167a5c48e20edba8e1fbfe4231bcfa223"
|
||||
integrity sha512-Go968aDDcqONHQcUdgIiPRkPdT4QTzD0ecHJsI1u7ZiHPMOoZn+Dy7hYsdUJ5ldX9wTZDrICBM1rDKTRaDUitg==
|
||||
|
||||
"@csstools/normalize.css@*":
|
||||
version "12.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@csstools/normalize.css/-/normalize.css-12.0.0.tgz#a9583a75c3f150667771f30b60d9f059473e62c4"
|
||||
|
Loading…
x
Reference in New Issue
Block a user