From aba3153c4f5292582d1993b14015e220c879d6ef Mon Sep 17 00:00:00 2001 From: rift <117926989+Riftriot@users.noreply.github.com> Date: Sat, 6 Apr 2024 17:59:30 -0500 Subject: [PATCH] Switch away from AES to 3 key XOR --- public/uv/uv.config.js | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/public/uv/uv.config.js b/public/uv/uv.config.js index dd02ba0..38b4594 100644 --- a/public/uv/uv.config.js +++ b/public/uv/uv.config.js @@ -1,8 +1,31 @@ self.__uv$config = { prefix: "/~/uv/", bare: "/bare/", - encodeUrl: Ultraviolet.codec.aes.encode, - decodeUrl: Ultraviolet.codec.aes.decode, + encodeUrl: function encode(str) { + if (!str) return str; + return encodeURIComponent( + str + .toString() + .split('') + .map((char, ind) => + ind % 2 ? String.fromCharCode(char.charCodeAt() ^ 3) : char + ) + .join('') + ); + }, + decodeUrl: function decode(str) { + if (!str) return str; + let [input, ...search] = str.split('?'); + + return ( + decodeURIComponent(input) + .split('') + .map((char, ind) => + ind % 2 ? String.fromCharCode(char.charCodeAt(0) ^ 3) : char + ) + .join('') + (search.length ? '?' + search.join('?') : '') + ); + }, handler: "/uv/uv.handler.js", client: "/uv/uv.client.js", bundle: "/uv/uv.bundle.js",