feat: Re-enable Anilist response caching and configure proxy URL via environment variable.

This commit is contained in:
2025-11-28 17:00:18 +08:00
parent bd958fb1ab
commit a25111acbf
2 changed files with 8 additions and 7 deletions

View File

@@ -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",