aboutsummaryrefslogtreecommitdiff
path: root/pages/api/v2
diff options
context:
space:
mode:
authorFactiven <[email protected]>2023-10-24 11:05:06 +0700
committerFactiven <[email protected]>2023-10-24 11:05:06 +0700
commit0a30e0570a5d22dd8c459fd9769fe4386c07aae8 (patch)
tree67346a73b4be2ed5e5a7008828e4bc70bac3bd92 /pages/api/v2
parentfixed redis error for manga (#95) (diff)
downloadmoopa-4.2.1.tar.xz
moopa-4.2.1.zip
Update v4.2.1v4.2.1
Diffstat (limited to 'pages/api/v2')
-rw-r--r--pages/api/v2/episode/[id].js10
1 files changed, 7 insertions, 3 deletions
diff --git a/pages/api/v2/episode/[id].js b/pages/api/v2/episode/[id].js
index b86a198..029d131 100644
--- a/pages/api/v2/episode/[id].js
+++ b/pages/api/v2/episode/[id].js
@@ -1,6 +1,5 @@
import axios from "axios";
import { rateLimitStrict, rateLimiterRedis, redis } from "@/lib/redis";
-import appendImagesToEpisodes from "@/utils/combineImages";
import appendMetaToEpisodes from "@/utils/appendMetaToEpisodes";
let CONSUMET_URI;
@@ -158,8 +157,13 @@ async function fetchCoverImage(id, available = false) {
export default async function handler(req, res) {
const { id, releasing = "false", dub = false, refresh = null } = req.query;
- // if releasing is true then cache for 10 minutes, if it false cache for 1 month;
- const cacheTime = releasing === "true" ? 60 * 10 : 60 * 60 * 24 * 30;
+ // if releasing is true then cache for 1 hour, if it false cache for 1 month;
+ let cacheTime = null;
+ if (releasing === "true") {
+ cacheTime = 60 * 60; // 1 hour
+ } else if (releasing === "false") {
+ cacheTime = 60 * 60 * 24 * 30; // 1 month
+ }
let cached;
let meta;