From 44baeb5c9112c96c7571b25c3327c326ee8c4dbc Mon Sep 17 00:00:00 2001 From: Gabriel De Castro <37971981+hase0278@users.noreply.github.com> Date: Sat, 4 May 2024 16:21:11 +0800 Subject: [PATCH] feat(gogoanime,zoro): Add optional custom domain functionality --- .env.example | 3 +++ src/routes/anime/gogoanime.ts | 5 ++++- src/routes/anime/zoro.ts | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index fa4c1039..f1353c2b 100644 --- a/.env.example +++ b/.env.example @@ -6,4 +6,7 @@ REDIS_PORT=Redis port (optional) REDIS_PASSWORD=Redis password (optional) NINE_ANIME_HELPER_URL=9anime (optional) TMDB_KEY=TMDB access token auth (optional) +RECAPTCHATOKEN=Gogoanime recaptcha token (optional) +GOGOANIME_URL=Gogoanime custom url (optional) +ZORO_URL=Zoro custom url (optional) NODE_ENV=Environment (optional) (DEMO or PROD) diff --git a/src/routes/anime/gogoanime.ts b/src/routes/anime/gogoanime.ts index 4a83be3a..ace99cd4 100644 --- a/src/routes/anime/gogoanime.ts +++ b/src/routes/anime/gogoanime.ts @@ -6,7 +6,10 @@ import { redis } from '../../main'; import { Redis } from 'ioredis'; const routes = async (fastify: FastifyInstance, options: RegisterOptions) => { - const gogoanime = new ANIME.Gogoanime(); + let gogoanime = new ANIME.Gogoanime(); + if(process.env.GOGOANIME_URL){ + gogoanime = new ANIME.Gogoanime(process.env.GOGOANIME_URL); + } const redisCacheTime = 60 * 60; const redisPrefix = 'gogoanime:'; diff --git a/src/routes/anime/zoro.ts b/src/routes/anime/zoro.ts index 78f098be..c3ee04ee 100644 --- a/src/routes/anime/zoro.ts +++ b/src/routes/anime/zoro.ts @@ -3,7 +3,10 @@ import { ANIME } from '@consumet/extensions'; import { StreamingServers } from '@consumet/extensions/dist/models'; const routes = async (fastify: FastifyInstance, options: RegisterOptions) => { - const zoro = new ANIME.Zoro(); + let zoro = new ANIME.Zoro(); + if(process.env.ZORO_URL){ + zoro = new ANIME.Zoro(process.env.ZORO_URL); + } fastify.get('/', (_, rp) => { rp.status(200).send({