From de23e157633d344ed261184142121ec977ac5721 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 23 Jul 2024 02:38:43 -0700 Subject: feat(proxy): enable level two proxy encoding --- src/lib/Utility/proxy.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/Utility/proxy.ts b/src/lib/Utility/proxy.ts index 8305441d..019f4594 100644 --- a/src/lib/Utility/proxy.ts +++ b/src/lib/Utility/proxy.ts @@ -1,8 +1,16 @@ import { env } from '$env/dynamic/public'; -export const proxy = (url: string, disable = false) => - env.PUBLIC_ANILIST_REDIRECT_URI?.includes('localhost') && !disable +export const proxy = (url: string, disable = true) => { + const randomKey = Math.floor(Math.random() * 90) + 10; + + return env.PUBLIC_ANILIST_REDIRECT_URI?.includes('localhost') && !disable ? url - : `https://proxy.due.moe/?d=${btoa(url)}`; + : `https://proxy.due.moe/?d2=${btoa( + url + .split('') + .map((char) => char.charCodeAt(0) + randomKey) + .join(':') + )}${randomKey}`; +}; export default proxy; -- cgit v1.2.3