From 3e9ec2361e3991dff808ff172face38873b8bdc6 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 23 Jul 2024 02:35:06 -0700 Subject: feat: level two encoding --- src/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/index.js b/src/index.js index 8e1eda8..6dc0906 100644 --- a/src/index.js +++ b/src/index.js @@ -7,6 +7,14 @@ const handleRequest = async (request) => { query = url.search.split('?q=')[1]; } else if (url.search.includes('?d=')) { query = atob(url.search.split('?d=')[1]); + } else if (url.search.includes('?d2=')) { + const fullEncodedURL = url.search.split('?d2=')[1]; + const key = parseInt(fullEncodedURL.slice(-2)); + + query = atob(fullEncodedURL.slice(0, -2)) + .split(':') + .map((char) => String.fromCharCode(char - key)) + .join(''); } else { return new Response(null, { status: 400, -- cgit v1.2.3