From 1d5c849120b5f46808796c34a2e88de2a73ec7af Mon Sep 17 00:00:00 2001 From: SnowCait Date: Sat, 9 Nov 2024 11:17:18 +0900 Subject: [PATCH 1/2] Revert "Tmp" This reverts commit bb854bd85968996d620d0e447dc9989d9e78baa0. --- web/src/lib/server/Restriction.ts | 40 +++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/web/src/lib/server/Restriction.ts b/web/src/lib/server/Restriction.ts index a57c5051..369385ec 100644 --- a/web/src/lib/server/Restriction.ts +++ b/web/src/lib/server/Restriction.ts @@ -1,29 +1,29 @@ -// import { -// CLOUDFLARE_ACCOUNT_ID, -// CLOUDFLARE_API_TOKEN, -// CLOUDFLARE_KV_NAMESPACE_ID -// } from '$env/static/private'; +import { + CLOUDFLARE_ACCOUNT_ID, + CLOUDFLARE_API_TOKEN, + CLOUDFLARE_KV_NAMESPACE_ID +} from '$env/static/private'; import { error } from '@sveltejs/kit'; export async function checkRestriction(pubkey: string): Promise { console.time('[npub restriction]'); - // if (!CLOUDFLARE_ACCOUNT_ID || !CLOUDFLARE_API_TOKEN || !CLOUDFLARE_KV_NAMESPACE_ID) { - // return; - // } + if (!CLOUDFLARE_ACCOUNT_ID || !CLOUDFLARE_API_TOKEN || !CLOUDFLARE_KV_NAMESPACE_ID) { + return; + } - // const url = `https://api.cloudflare.com/client/v4/accounts/${CLOUDFLARE_ACCOUNT_ID}/storage/kv/namespaces/${CLOUDFLARE_KV_NAMESPACE_ID}/values/${pubkey}`; - // const response = await fetch(url, { - // headers: { - // Authorization: `Bearer ${CLOUDFLARE_API_TOKEN}` - // } - // }); - // console.timeEnd('[npub restriction]'); - // if (response.ok) { - // const restriction = (await response.json()) as Restriction; - // console.error('[npub restriction]', restriction); - // error(restriction.status, restriction.statusText); - // } + const url = `https://api.cloudflare.com/client/v4/accounts/${CLOUDFLARE_ACCOUNT_ID}/storage/kv/namespaces/${CLOUDFLARE_KV_NAMESPACE_ID}/values/${pubkey}`; + const response = await fetch(url, { + headers: { + Authorization: `Bearer ${CLOUDFLARE_API_TOKEN}` + } + }); + console.timeEnd('[npub restriction]'); + if (response.ok) { + const restriction = (await response.json()) as Restriction; + console.error('[npub restriction]', restriction); + error(restriction.status, restriction.statusText); + } } interface Restriction { From 867ab2f0a53885dbd72dcf8348d4dd32d4bfb341 Mon Sep 17 00:00:00 2001 From: SnowCait Date: Sun, 10 Nov 2024 18:48:33 +0900 Subject: [PATCH 2/2] Update Node.js version --- web/.node-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/.node-version b/web/.node-version index 2a393af5..7af24b7d 100644 --- a/web/.node-version +++ b/web/.node-version @@ -1 +1 @@ -20.18.0 +22.11.0