diff options
Diffstat (limited to 'pages/api/v2')
| -rw-r--r-- | pages/api/v2/episode/[id].tsx | 16 | ||||
| -rw-r--r-- | pages/api/v2/etc/recent/[page].tsx | 2 |
2 files changed, 4 insertions, 14 deletions
diff --git a/pages/api/v2/episode/[id].tsx b/pages/api/v2/episode/[id].tsx index b646126..ddf5635 100644 --- a/pages/api/v2/episode/[id].tsx +++ b/pages/api/v2/episode/[id].tsx @@ -139,10 +139,6 @@ async function fetchAnify(id?: string) { async function fetchCoverImage(id: string, available = false) { try { - if (!process.env.API_KEY) { - return []; - } - if (available) { return null; } @@ -171,10 +167,10 @@ export default async function handler( ) { const { id, releasing = "false", dub = false, refresh = null } = req.query; - // if releasing is true then cache for 1 hour, if it false cache for 1 month; + // if releasing is true then cache for 3 hour, if it false cache for 1 month; let cacheTime = null; if (releasing === "true") { - cacheTime = 60 * 60; // 1 hour + cacheTime = 60 * 60 * 3; // 3 hours } else if (releasing === "false") { cacheTime = 60 * 60 * 24 * 30; // 1 month } @@ -210,7 +206,7 @@ export default async function handler( meta = null; } - if (refresh) { + if (refresh !== null) { await redis.del(`episode:${id}`); } else { cached = await redis.get(`episode:${id}`); @@ -262,12 +258,6 @@ export default async function handler( fetchCoverImage(id, meta), ]); - // const hasImage = consumet.map((i) => - // i.episodes?.sub?.some( - // (e) => e.img !== null || !e.img.includes("https://s4.anilist.co/") - // ) - // ); - let subDub = "sub"; if (dub) { subDub = "dub"; diff --git a/pages/api/v2/etc/recent/[page].tsx b/pages/api/v2/etc/recent/[page].tsx index e49591c..4e3bc98 100644 --- a/pages/api/v2/etc/recent/[page].tsx +++ b/pages/api/v2/etc/recent/[page].tsx @@ -1,5 +1,5 @@ import { rateLimitStrict, redis } from "@/lib/redis"; -import { AnifyRecentEpisode } from "@/utils/types"; +import { AnifyRecentEpisode } from "types"; import axios from "axios"; import { NextApiRequest, NextApiResponse } from "next"; |