diff --git a/public/sw.js b/public/sw.js new file mode 100644 index 0000000..876f1c5 --- /dev/null +++ b/public/sw.js @@ -0,0 +1,27 @@ +importScripts( + "/vu/uv.bundle.js", + "/vu/uv.config.js", + "/marcs/scramjet.shared.js", + "/marcs/scramjet.worker.js" +); +importScripts(__uv$config.sw || "/vu/uv.sw.js"); + +const uv = new UVServiceWorker(); +const sj = new ScramjetServiceWorker(); + +self.addEventListener("fetch", function (event) { + event.respondWith( + (async () => { + await sj.loadConfig(); + if (event.request.url.startsWith(location.origin + __uv$config.prefix)) { + return await uv.fetch(event); + } + else if (sj.route(event)) { + return await sj.fetch(event); + } + else { + return await fetch(event.request); + } + })() + ); +}); diff --git a/public/vu/uv.config.js b/public/vu/uv.config.js new file mode 100644 index 0000000..23dd015 --- /dev/null +++ b/public/vu/uv.config.js @@ -0,0 +1,29 @@ +self.__uv$config = { + prefix: "/~/uv/", + 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: "/vu/uv.handler.js", + client: "/vu/uv.client.js", + bundle: "/vu/uv.bundle.js", + config: "/vu/uv.config.js", + sw: "/vu/uv.sw.js" +}; diff --git a/src/assets/splash.json b/src/assets/splash.json index 701a77b..34e3bfa 100644 --- a/src/assets/splash.json +++ b/src/assets/splash.json @@ -1,13 +1,10 @@ [ { - "splash": "Join to our community! https://discord.gg/qsXnhSPtAK" + "splash": "Join our community! https://discord.gg/qsXnhSPtAK" }, { "splash": "Browse safely!" }, - { - "splash": "Hello World!" - }, { "splash": "Access with ease!" }, diff --git a/src/components/Header.astro b/src/components/Header.astro index d16ad6b..90e74d3 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -12,6 +12,8 @@ const path = Astro.url.pathname;

Radius

+
+
+