diff --git a/src/libs/anilist/anilist-do.ts b/src/libs/anilist/anilist-do.ts index 5fb18d6..923acf2 100644 --- a/src/libs/anilist/anilist-do.ts +++ b/src/libs/anilist/anilist-do.ts @@ -43,11 +43,11 @@ export class AnilistDurableObject extends DurableObject { const { variables } = body; const storageKey = variables.id; const cache = await this.state.storage.get(storageKey); - // if (cache) { - // return new Response(JSON.stringify(cache), { - // headers: { "Content-Type": "application/json" }, - // }); - // } + if (cache) { + return new Response(JSON.stringify(cache), { + headers: { "Content-Type": "application/json" }, + }); + } const anilistResponse = await this.fetchTitleFromAnilist( variables.id, @@ -95,7 +95,7 @@ export class AnilistDurableObject extends DurableObject { headers["Authorization"] = `Bearer ${token}`; } - const response = await fetch("http://localhost:3000/proxy", { + const response = await fetch(`${env.PROXY_URL}/proxy`, { method: "POST", headers: { "Content-Type": "application/json", diff --git a/worker-configuration.d.ts b/worker-configuration.d.ts index 6a2c85b..bb5e2c8 100644 --- a/worker-configuration.d.ts +++ b/worker-configuration.d.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -// Generated by Wrangler by running `wrangler types` (hash: 55b6bc5eef0b3709210a3c57164a6bda) +// Generated by Wrangler by running `wrangler types` (hash: 3b0ff08dc5a1a73091e35f975f87bee1) // Runtime types generated with workerd@1.20251011.0 2024-09-23 nodejs_compat declare namespace Cloudflare { interface GlobalProps { @@ -15,6 +15,7 @@ declare namespace Cloudflare { CLOUDFLARE_D1_TOKEN: string; CLOUDFLARE_ACCOUNT_ID: string; CLOUDFLARE_DATABASE_ID: string; + PROXY_URL: string; ANILIST_DO: DurableObjectNamespace; DB: D1Database; ANILIST_UPDATES: Queue;