feat: Re-enable Anilist response caching and configure proxy URL via environment variable.
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user