Merge pull request #201 from MotorTruck1221/bareSwitch

Implement Bare Server Switching
This commit is contained in:
rift 2024-01-03 18:40:52 -06:00 committed by GitHub
commit 5c632642d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 1349 additions and 1174 deletions

View file

@ -14,6 +14,7 @@
<script src="/uv/uv.bundle.js"></script> <script src="/uv/uv.bundle.js"></script>
<script src="/uv/uv.config.js"></script> <script src="/uv/uv.config.js"></script>
<script src="/dynamic/dynamic.config.js"></script> <script src="/dynamic/dynamic.config.js"></script>
<script src="/localforage/localforage.min.js" defer></script>
<script> <script>
if ("serviceWorker" in navigator) { if ("serviceWorker" in navigator) {
window.addEventListener("load", () => { window.addEventListener("load", () => {

View file

@ -1,49 +1,50 @@
{ {
"name": "nebula", "name": "nebula",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "concurrently \"vite\" \"bare-server-node --port 8080\"", "dev": "concurrently \"vite\" \"bare-server-node --port 8080\"",
"build": "vite build", "build": "vite build",
"bstart": "npm run build && tsx server.ts", "bstart": "npm run build && tsx server.ts",
"start": "tsx server.ts", "start": "tsx server.ts",
"preview": "vite preview", "preview": "vite preview",
"format": "prettier --write ." "format": "prettier --write ."
}, },
"dependencies": { "dependencies": {
"@fastify/compress": "^6.5.0", "@fastify/compress": "^6.5.0",
"@fastify/static": "^6.12.0", "@fastify/static": "^6.12.0",
"@nebula-services/dynamic": "0.7.2-patch.2", "@nebula-services/dynamic": "0.7.2-patch.2",
"@nebula-services/ultraviolet": "1.0.1-1.patch.5", "@nebula-services/ultraviolet": "1.0.1-1.patch.5",
"@tomphttp/bare-server-node": "^2.0.1", "@tomphttp/bare-server-node": "^2.0.1",
"classnames": "^2.3.2", "classnames": "^2.3.2",
"fastify": "^4.25.1", "fastify": "^4.25.1",
"framer-motion": "^10.16.16", "framer-motion": "^10.16.16",
"i18next": "^23.7.9", "i18next": "^23.7.9",
"i18next-browser-languagedetector": "^7.2.0", "i18next-browser-languagedetector": "^7.2.0",
"million": "^2.6.4", "localforage": "^1.10.0",
"preact": "^10.13.1", "million": "^2.6.4",
"preact-iso": "^2.3.2", "preact": "^10.13.1",
"preact-render-to-string": "^6.3.1", "preact-iso": "^2.3.2",
"preact-router": "^4.1.2", "preact-render-to-string": "^6.3.1",
"rammerhead": "https://github.com/holy-unblocker/rammerhead/releases/download/v1.2.41-holy.5/rammerhead-1.2.41-holy.5.tgz", "preact-router": "^4.1.2",
"react-helmet": "^6.1.0", "rammerhead": "https://github.com/holy-unblocker/rammerhead/releases/download/v1.2.41-holy.5/rammerhead-1.2.41-holy.5.tgz",
"react-i18next": "^13.5.0", "react-helmet": "^6.1.0",
"react-icons": "^4.12.0", "react-i18next": "^13.5.0",
"tsx": "^4.7.0" "react-icons": "^4.12.0",
}, "tsx": "^4.7.0"
"devDependencies": { },
"@preact/preset-vite": "^2.5.0", "devDependencies": {
"autoprefixer": "^10.4.16", "@preact/preset-vite": "^2.5.0",
"concurrently": "^8.2.2", "autoprefixer": "^10.4.16",
"eslint": "^8.55.0", "concurrently": "^8.2.2",
"eslint-config-preact": "^1.3.0", "eslint": "^8.55.0",
"postcss": "^8.4.32", "eslint-config-preact": "^1.3.0",
"prettier": "^3.1.1", "postcss": "^8.4.32",
"prettier-plugin-tailwindcss": "^0.5.9", "prettier": "^3.1.1",
"tailwindcss": "^3.3.6", "prettier-plugin-tailwindcss": "^0.5.9",
"typescript": "^5.3.3", "tailwindcss": "^3.3.6",
"vite": "^5.0.9", "typescript": "^5.3.3",
"vite-plugin-static-copy": "^1.0.0" "vite": "^5.0.9",
} "vite-plugin-static-copy": "^1.0.0"
} }
}

19
pnpm-lock.yaml generated
View file

@ -35,6 +35,9 @@ dependencies:
i18next-browser-languagedetector: i18next-browser-languagedetector:
specifier: ^7.2.0 specifier: ^7.2.0
version: 7.2.0 version: 7.2.0
localforage:
specifier: ^1.10.0
version: 1.10.0
million: million:
specifier: ^2.6.4 specifier: ^2.6.4
version: 2.6.4 version: 2.6.4
@ -3231,6 +3234,10 @@ packages:
engines: {node: '>= 4'} engines: {node: '>= 4'}
dev: true dev: true
/immediate@3.0.6:
resolution: {integrity: sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==}
dev: false
/import-fresh@3.3.0: /import-fresh@3.3.0:
resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==} resolution: {integrity: sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==}
engines: {node: '>=6'} engines: {node: '>=6'}
@ -3623,6 +3630,12 @@ packages:
type-check: 0.4.0 type-check: 0.4.0
dev: true dev: true
/lie@3.1.1:
resolution: {integrity: sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==}
dependencies:
immediate: 3.0.6
dev: false
/light-my-request@5.11.0: /light-my-request@5.11.0:
resolution: {integrity: sha512-qkFCeloXCOMpmEdZ/MV91P8AT4fjwFXWaAFz3lUeStM8RcoM1ks4J/F8r1b3r6y/H4u3ACEJ1T+Gv5bopj7oDA==} resolution: {integrity: sha512-qkFCeloXCOMpmEdZ/MV91P8AT4fjwFXWaAFz3lUeStM8RcoM1ks4J/F8r1b3r6y/H4u3ACEJ1T+Gv5bopj7oDA==}
dependencies: dependencies:
@ -3645,6 +3658,12 @@ packages:
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
dev: true dev: true
/localforage@1.10.0:
resolution: {integrity: sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==}
dependencies:
lie: 3.1.1
dev: false
/locate-path@6.0.0: /locate-path@6.0.0:
resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==}
engines: {node: '>=10'} engines: {node: '>=10'}

View file

@ -1,30 +1,67 @@
importScripts("/uv/uv.bundle.js"); importScripts("/uv/uv.bundle.js");
importScripts("/uv/uv.config.js"); importScripts("/uv/uv.config.js");
importScripts(__uv$config.sw || "/uv/uv.sw.js"); importScripts(__uv$config.sw || "/uv/uv.sw.js");
importScripts("/dynamic/dynamic.config.js"); importScripts("/dynamic/dynamic.config.js");
importScripts("/dynamic/dynamic.worker.js"); importScripts("/dynamic/dynamic.worker.js");
//import our IDB lib
const sw = new UVServiceWorker(); importScripts("/localforage/localforage.min.js");
const dynamic = new Dynamic(); localforage.config({
driver: localforage.INDEXEDDB,
self.dynamic = dynamic; name: "Nebula",
version: 1.0,
self.addEventListener("fetch", (event) => { storeName: "nebula_config",
if ( description: "Nebula Config for things reliant on IndexedDB"
event.request.url.startsWith(location.origin + self.__dynamic$config.prefix) });
) {
event.respondWith( const dynPromise = new Promise(async (resolve) => {
(async function () { try {
if (await dynamic.route(event)) { const bare =
return await dynamic.fetch(event); (await localforage.getItem("bare")) || location.origin + "/bare/";
} self.__dynamic$config.bare.path = bare;
self.dynamic = new Dynamic(self.__dynamic$config);
return await fetch(event.request); } catch (error) {
})() console.log(error);
); }
} else if ( resolve();
event.request.url.startsWith(location.origin + __uv$config.prefix) });
) {
event.respondWith(sw.fetch(event)); const uvPromise = new Promise(async (resolve) => {
} try {
}); const bare =
(await localforage.getItem("bare")) || location.origin + "/bare/";
self.__uv$config.bare = bare;
self.uv = new UVServiceWorker(self.__uv$config);
} catch (error) {
console.log(error);
}
resolve();
});
self.addEventListener("fetch", (event) => {
if (
event.request.url.startsWith(location.origin + self.__dynamic$config.prefix)
) {
event.respondWith(
(async function () {
try {
await dynPromise;
} catch (error) {}
if (await self.dynamic.route(event)) {
return await self.dynamic.fetch(event);
}
await fetch(event.request);
})()
);
} else if (
event.request.url.startsWith(location.origin + self.__uv$config.prefix)
) {
event.respondWith(
(async function () {
try {
await uvPromise;
} catch (error) {}
return await self.uv.fetch(event);
})()
);
}
});

View file

@ -1,30 +1,30 @@
@import url("https://fonts.googleapis.com/css2?family=Dongle&family=Roboto:wght@100&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Dongle&family=Roboto:wght@100&display=swap");
:root { :root {
--background-primary: #303446 !important; --background-primary: #303446 !important;
--background-lighter: #292c3c !important; --background-lighter: #292c3c !important;
--navbar-color: #292c3c !important; --navbar-color: #292c3c !important;
--navbar-height: 60px !important; --navbar-height: 60px !important;
--navbar-text-color: #c6d0f5 !important; --navbar-text-color: #c6d0f5 !important;
--navbar-link-color: #8caaee !important; --navbar-link-color: #8caaee !important;
--navbar-link-hover-color: #ca9ee6 !important; --navbar-link-hover-color: #ca9ee6 !important;
--navbar-font: "Roboto" !important; --navbar-font: "Roboto" !important;
--input-text-color: #c6d0f5 !important; --input-text-color: #c6d0f5 !important;
--input-placeholder-color: #a5adce !important; --input-placeholder-color: #a5adce !important;
--input-background-color: #232634 !important; --input-background-color: #232634 !important;
--input-border-color: color-mix(in srgb, #232634, #ca9ee6 50%) !important; --input-border-color: color-mix(in srgb, #232634, #ca9ee6 50%) !important;
--input-border-size: 1.3px !important; --input-border-size: 1.3px !important;
--navbar-logo-filter: none !important; --navbar-logo-filter: none !important;
--dropdown-option-hover-color: #232634 !important; --dropdown-option-hover-color: #232634 !important;
--tab-color: #414559 !important; --tab-color: #414559 !important;
--active-color: #ca9ee6 !important; --active-color: #ca9ee6 !important;
} }
.font-inter { .font-inter {
font-family: "Inter", sans-serif; font-family: "Inter", sans-serif;
font-weight: 300; font-weight: 300;
} }
.font-roboto { .font-roboto {
font-family: "Roboto"; font-family: "Roboto";
} }

View file

@ -1,30 +1,30 @@
@import url("https://fonts.googleapis.com/css2?family=Dongle&family=Roboto:wght@100&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Dongle&family=Roboto:wght@100&display=swap");
:root { :root {
--background-primary: #eff1f5 !important; --background-primary: #eff1f5 !important;
--background-lighter: #e6e9ef !important; --background-lighter: #e6e9ef !important;
--navbar-color: #e6e9ef !important; --navbar-color: #e6e9ef !important;
--navbar-height: 60px !important; --navbar-height: 60px !important;
--navbar-text-color: #4c4f69 !important; --navbar-text-color: #4c4f69 !important;
--navbar-link-color: #1e66f5 !important; --navbar-link-color: #1e66f5 !important;
--navbar-link-hover-color: #8839ef !important; --navbar-link-hover-color: #8839ef !important;
--navbar-font: "Roboto" !important; --navbar-font: "Roboto" !important;
--input-text-color: #4c4f69 !important; --input-text-color: #4c4f69 !important;
--input-placeholder-color: #6c6f85 !important; --input-placeholder-color: #6c6f85 !important;
--input-background-color: #dce0e8 !important; --input-background-color: #dce0e8 !important;
--input-border-color: color-mix(in srgb, #dce0e8, #8839ef 50%) !important; --input-border-color: color-mix(in srgb, #dce0e8, #8839ef 50%) !important;
--input-border-size: 1.3px !important; --input-border-size: 1.3px !important;
--navbar-logo-filter: none !important; --navbar-logo-filter: none !important;
--dropdown-option-hover-color: #dce0e8 !important; --dropdown-option-hover-color: #dce0e8 !important;
--tab-color: #ccd0da !important; --tab-color: #ccd0da !important;
--active-color: #8839ef !important; --active-color: #8839ef !important;
} }
.font-inter { .font-inter {
font-family: "Inter", sans-serif; font-family: "Inter", sans-serif;
font-weight: 300; font-weight: 300;
} }
.font-roboto { .font-roboto {
font-family: "Roboto"; font-family: "Roboto";
} }

View file

@ -1,30 +1,30 @@
@import url("https://fonts.googleapis.com/css2?family=Dongle&family=Roboto:wght@100&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Dongle&family=Roboto:wght@100&display=swap");
:root { :root {
--background-primary: #24273a !important; --background-primary: #24273a !important;
--background-lighter: #1e2030 !important; --background-lighter: #1e2030 !important;
--navbar-color: #1e2030 !important; --navbar-color: #1e2030 !important;
--navbar-height: 60px !important; --navbar-height: 60px !important;
--navbar-text-color: #cad3f5 !important; --navbar-text-color: #cad3f5 !important;
--navbar-link-color: #8aadf4 !important; --navbar-link-color: #8aadf4 !important;
--navbar-link-hover-color: #c6a0f6 !important; --navbar-link-hover-color: #c6a0f6 !important;
--navbar-font: "Roboto" !important; --navbar-font: "Roboto" !important;
--input-text-color: #cad3f5 !important; --input-text-color: #cad3f5 !important;
--input-placeholder-color: #a5adcb !important; --input-placeholder-color: #a5adcb !important;
--input-background-color: #181926 !important; --input-background-color: #181926 !important;
--input-border-color: color-mix(in srgb, #181926, #c6a0f6 50%) !important; --input-border-color: color-mix(in srgb, #181926, #c6a0f6 50%) !important;
--input-border-size: 1.3px !important; --input-border-size: 1.3px !important;
--navbar-logo-filter: none !important; --navbar-logo-filter: none !important;
--dropdown-option-hover-color: #181926 !important; --dropdown-option-hover-color: #181926 !important;
--tab-color: #363a4f !important; --tab-color: #363a4f !important;
--active-color: #c6a0f6 !important; --active-color: #c6a0f6 !important;
} }
.font-inter { .font-inter {
font-family: "Inter", sans-serif; font-family: "Inter", sans-serif;
font-weight: 300; font-weight: 300;
} }
.font-roboto { .font-roboto {
font-family: "Roboto"; font-family: "Roboto";
} }

View file

@ -1,30 +1,30 @@
@import url("https://fonts.googleapis.com/css2?family=Dongle&family=Roboto:wght@100&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Dongle&family=Roboto:wght@100&display=swap");
:root { :root {
--background-primary: #1e1e2e !important; --background-primary: #1e1e2e !important;
--background-lighter: #181825 !important; --background-lighter: #181825 !important;
--navbar-color: #181825 !important; --navbar-color: #181825 !important;
--navbar-height: 60px !important; --navbar-height: 60px !important;
--navbar-text-color: #cdd6f4 !important; --navbar-text-color: #cdd6f4 !important;
--navbar-link-color: #89b4fa !important; --navbar-link-color: #89b4fa !important;
--navbar-link-hover-color: #cba6f7 !important; --navbar-link-hover-color: #cba6f7 !important;
--navbar-font: "Roboto" !important; --navbar-font: "Roboto" !important;
--input-text-color: #cdd6f4 !important; --input-text-color: #cdd6f4 !important;
--input-placeholder-color: #a6adc8 !important; --input-placeholder-color: #a6adc8 !important;
--input-background-color: #11111b !important; --input-background-color: #11111b !important;
--input-border-color: color-mix(in srgb, #11111b, #cba6f7 50%) !important; --input-border-color: color-mix(in srgb, #11111b, #cba6f7 50%) !important;
--input-border-size: 1.3px !important; --input-border-size: 1.3px !important;
--navbar-logo-filter: none !important; --navbar-logo-filter: none !important;
--dropdown-option-hover-color: #11111b !important; --dropdown-option-hover-color: #11111b !important;
--tab-color: #313244 !important; --tab-color: #313244 !important;
--active-color: #cba6f7 !important; --active-color: #cba6f7 !important;
} }
.font-inter { .font-inter {
font-family: "Inter", sans-serif; font-family: "Inter", sans-serif;
font-weight: 300; font-weight: 300;
} }
.font-roboto { .font-roboto {
font-family: "Roboto"; font-family: "Roboto";
} }

View file

@ -1,29 +1,29 @@
@import url("https://fonts.googleapis.com/css2?family=Dongle&family=Roboto:wght@100&display=swap"); @import url("https://fonts.googleapis.com/css2?family=Dongle&family=Roboto:wght@100&display=swap");
:root { :root {
--background-primary: #191724; --background-primary: #191724;
--background-lighter: #16121f; --background-lighter: #16121f;
--navbar-color: #26233a; --navbar-color: #26233a;
--navbar-height: 60px; --navbar-height: 60px;
--navbar-text-color: #7967dd; --navbar-text-color: #7967dd;
--navbar-link-color: #e0def4; --navbar-link-color: #e0def4;
--navbar-link-hover-color: gray; --navbar-link-hover-color: gray;
--navbar-font: "Roboto"; --navbar-font: "Roboto";
--input-text-color: #e0def4; --input-text-color: #e0def4;
--input-placeholder-color: white; --input-placeholder-color: white;
--input-background-color: #1f1d2e; --input-background-color: #1f1d2e;
--input-border-color: #eb6f92; --input-border-color: #eb6f92;
--input-border-size: 1.3px; --input-border-size: 1.3px;
--navbar-logo-filter: none; --navbar-logo-filter: none;
--dropdown-option-hover-color: #312a49; --dropdown-option-hover-color: #312a49;
--tab-color: var(--black); --tab-color: var(--black);
} }
.font-inter { .font-inter {
font-family: "Inter", sans-serif; font-family: "Inter", sans-serif;
font-weight: 300; font-weight: 300;
} }
.font-roboto { .font-roboto {
font-family: "Roboto"; font-family: "Roboto";
} }

View file

@ -1,25 +1,25 @@
import { LoadSuspense } from "./LoadSuspense"; import { LoadSuspense } from "./LoadSuspense";
export function AboutBlank(props: { url: string }) { export function AboutBlank(props: { url: string }) {
var newWindow = window.open("about:blank"); var newWindow = window.open("about:blank");
var iframe = document.createElement("iframe"); var iframe = document.createElement("iframe");
iframe.src = window.location.origin + props.url; iframe.src = window.location.origin + props.url;
iframe.style.width = "100%"; iframe.style.width = "100%";
iframe.style.height = "100%"; iframe.style.height = "100%";
iframe.style.border = "none"; iframe.style.border = "none";
iframe.style.overflow = "hidden"; iframe.style.overflow = "hidden";
iframe.style.margin = "0"; iframe.style.margin = "0";
iframe.style.padding = "0"; iframe.style.padding = "0";
iframe.style.position = "fixed"; iframe.style.position = "fixed";
iframe.style.top = "0"; iframe.style.top = "0";
iframe.style.bottom = "0"; iframe.style.bottom = "0";
iframe.style.left = "0"; iframe.style.left = "0";
iframe.style.right = "0"; iframe.style.right = "0";
newWindow.document.body.appendChild(iframe); newWindow.document.body.appendChild(iframe);
window.location.replace("https://google.com"); window.location.replace("https://google.com");
return ( return (
<div> <div>
<LoadSuspense /> <LoadSuspense />
</div> </div>
); );
} }

View file

@ -1,26 +1,26 @@
import "./Suspense.css"; import "./Suspense.css";
export function LoadSuspense() { export function LoadSuspense() {
return ( return (
<div className="suspenseContainer"> <div className="suspenseContainer">
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
version="1.2" version="1.2"
viewBox="0 0 400 400" viewBox="0 0 400 400"
width="400" width="400"
height="400" height="400"
fill="#5e17eb" fill="#5e17eb"
className="animate-pulse-brighter" className="animate-pulse-brighter"
> >
<g id="svgg"> <g id="svgg">
<path <path
id="path0" id="path0"
fill-rule="evenodd" fill-rule="evenodd"
class="s0" class="s0"
d="m213.6 84c1 0.3 3.4 0.7 5.1 1 1.8 0.2 4.1 0.7 5.2 1 13.2 4.1 20.3 6.8 24.5 9.1 0.6 0.3 2.3 1.2 3.8 2 2.8 1.4 13.1 8 14.4 9.2 0.5 0.3 2.3 1.9 4.2 3.5 6.7 5.5 15.5 14.9 19.2 20.4 1 1.4 2 2.7 2.2 2.8 0.3 0.1 0.5 0.5 0.5 0.8 0 0.3 1.2 2.2 2.5 4.3 2.3 3.4 7.8 14.3 9.8 19.3 0.8 2.1 0.9 2.2 10 4.9 5.6 1.6 11.1 3.4 11.7 3.8 0.3 0.2 2.4 1.1 4.7 1.9 11.1 4.1 23 12.5 27.3 19.4 5.5 8.7 3.6 20.5-4.5 28.5-3.1 3-7.5 6.4-8.4 6.4-0.3 0-0.7 0.2-0.8 0.5-1.1 2.3-23.3 11.2-35.9 14.3-3.2 0.9-3.5 1.2-5.7 6.8-7.5 19-25.5 40.6-42.3 51.1-1.6 1-3.1 2-3.3 2.2-0.1 0.2-0.9 0.7-1.7 1.2-0.8 0.4-2.2 1.2-2.9 1.6-0.8 0.4-1.6 1-1.8 1.1-0.5 0.5-4.1 2.2-8.1 3.9-1.8 0.8-3.8 1.6-4.5 2-0.7 0.3-3.1 1.1-5.2 1.8-8.3 2.6-9.8 3-21 4.9-6.4 1.1-25.3 1.3-30.5 0.3-1.9-0.3-5.8-1.1-8.6-1.6-6.8-1.3-12.7-3-20-5.7-3.3-1.2-18-8.8-19.7-10.1-0.9-0.7-4.1-3.1-7.1-5.2-5.7-4.1-17.9-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7 5.4-85.1 6.7-126.9 3.1-9.6-0.8-23.1-2.3-27.8-3.2-2.2-0.4-5.3-0.9-6.9-1.2z"
/> />
</g> </g>
</svg> </svg>
</div> </div>
); );
} }

View file

@ -1,23 +1,23 @@
.suspenseContainer { .suspenseContainer {
display: flex; display: flex;
height: 100vh; height: 100vh;
width: 100vw; width: 100vw;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background-color: #191724; background-color: #191724;
} }
@keyframes pulse-brighter { @keyframes pulse-brighter {
0%, 0%,
100% { 100% {
opacity: 1; opacity: 1;
} }
50% { 50% {
opacity: 0.5; opacity: 0.5;
} }
} }
.animate-pulse-brighter { .animate-pulse-brighter {
animation: pulse-brighter 2s infinite; animation: pulse-brighter 2s infinite;
height: 11rem; height: 11rem;
} }

1490
src/aes.ts

File diff suppressed because it is too large Load diff

View file

@ -50,6 +50,10 @@
"title": "Search Engine", "title": "Search Engine",
"subtitle": "Choose your search engine" "subtitle": "Choose your search engine"
}, },
"bare": {
"title": "Bare Server",
"subtitle": "Enter the URL of your bare server"
},
"theme": { "theme": {
"title": "Theme", "title": "Theme",
"subtitle": "Choose a theme so your eyes don't hate us" "subtitle": "Choose a theme so your eyes don't hate us"

View file

@ -70,7 +70,7 @@ export function Home() {
type="text" type="text"
value={inputValue} value={inputValue}
onChange={handleInputChange} onChange={handleInputChange}
className={`font-roboto h-14 rounded-t-2xl border border-input-border-color bg-input p-2 text-center text-xl placeholder:text-input-text focus:outline-none text-input-text ${ className={`font-roboto h-14 rounded-t-2xl border border-input-border-color bg-input p-2 text-center text-xl text-input-text placeholder:text-input-text focus:outline-none ${
isFocused && inputValue.trim() !== "" isFocused && inputValue.trim() !== ""
? "w-10/12 md:w-3/12" ? "w-10/12 md:w-3/12"
: "w-80 rounded-2xl" : "w-80 rounded-2xl"

View file

@ -1,17 +1,17 @@
import { HeaderRoute } from "../components/HeaderRoute"; import { HeaderRoute } from "../components/HeaderRoute";
interface Window { interface Window {
__uv$config: any; __uv$config: any;
} }
export function Radon() { export function Radon() {
return ( return (
<HeaderRoute> <HeaderRoute>
<iframe <iframe
src={ src={
window.__uv$config.prefix + window.__uv$config.prefix +
window.__uv$config.encodeUrl("https://radon.games") window.__uv$config.encodeUrl("https://radon.games")
} }
className="h-full w-full" className="h-full w-full"
></iframe> ></iframe>
</HeaderRoute> </HeaderRoute>
); );
} }

View file

@ -0,0 +1,50 @@
import { useState, useEffect } from "preact/hooks";
import { set } from "../../util/IDB";
import { uninstallServiceWorkers } from "../../util/SWHelper";
interface BareInputProps {
placeholder: string;
storageKey: string;
}
function BareInput(props: BareInputProps) {
const value = localStorage.getItem(props.storageKey) || "/bare/";
const [inputValue, setInputValue] = useState(value);
function validateUrl(url: string) {
let finalUrl = url;
if (url === "/bare/" || url === "/bare") {
finalUrl = "/bare/";
return finalUrl;
}
if (url === null || url === undefined || url === "") {
finalUrl = "/bare/";
return finalUrl;
}
if (!url.endsWith("/")) {
finalUrl = url + "/";
}
if (!finalUrl.startsWith("http://") && !finalUrl.startsWith("https://")) {
finalUrl = "https://" + finalUrl;
}
return finalUrl;
}
function handleChange(event: any) {
const url = validateUrl(event.target.value);
setInputValue(event.target.value);
set(props.storageKey, url);
localStorage.setItem(props.storageKey, url);
uninstallServiceWorkers();
window.location.reload();
}
return (
<input
type="text"
placeholder={props.placeholder}
value={inputValue}
onBlur={handleChange}
className="font-roboto flex h-14 w-56 flex-row rounded-2xl border border-input-border-color bg-input p-4 text-center text-xl"
/>
);
}
export default BareInput;

View file

@ -1,30 +1,30 @@
import { useState, useEffect } from "preact/hooks"; import { useState, useEffect } from "preact/hooks";
interface Props { interface Props {
faviconUrl: string; faviconUrl: string;
title: string; title: string;
} }
const CloakPreset = (props: Props) => { const CloakPreset = (props: Props) => {
const cloak = (event: any) => { const cloak = (event: any) => {
event.preventDefault(); event.preventDefault();
console.log(props.faviconUrl); console.log(props.faviconUrl);
localStorage.setItem("cloakFavicon", props.faviconUrl); localStorage.setItem("cloakFavicon", props.faviconUrl);
localStorage.setItem("cloakTitle", props.title); localStorage.setItem("cloakTitle", props.title);
window.location.reload(); window.location.reload();
}; };
return ( return (
<div <div
onClick={cloak} onClick={cloak}
className="cursor-pointer rounded-full border border-input-border-color bg-lighter" className="cursor-pointer rounded-full border border-input-border-color bg-lighter"
> >
<img <img
src={props.faviconUrl === "none" ? "/logo.png" : props.faviconUrl} src={props.faviconUrl === "none" ? "/logo.png" : props.faviconUrl}
className="h-16 w-16 p-4" className="h-16 w-16 p-4"
/> />
</div> </div>
); );
}; };
export default CloakPreset; export default CloakPreset;

View file

@ -48,7 +48,7 @@ const Dropdown = ({
{options.map((option, index) => ( {options.map((option, index) => (
<div <div
key={option.id} key={option.id}
className={`border border-input-border-color bg-input p-2 hover:bg-dropdown-option-hover-color text-input-text ${ className={`border border-input-border-color bg-input p-2 text-input-text hover:bg-dropdown-option-hover-color ${
index === options.length - 1 ? "rounded-b-2xl" : "" index === options.length - 1 ? "rounded-b-2xl" : ""
}`} }`}
onClick={() => { onClick={() => {

View file

@ -1,6 +1,7 @@
import { motion } from "framer-motion"; import { motion } from "framer-motion";
import { tabContentVariant, settingsPageVariant } from "./Variants"; import { tabContentVariant, settingsPageVariant } from "./Variants";
import Dropdown from "./Dropdown"; import Dropdown from "./Dropdown";
import BareInput from "./BareInput";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
const Proxy = ({ id, active }) => { const Proxy = ({ id, active }) => {
@ -73,6 +74,15 @@ const Proxy = ({ id, active }) => {
refresh={false} refresh={false}
/> />
</div> </div>
<div className="flex h-64 w-80 flex-col flex-wrap content-center items-center rounded-lg border border-input-border-color bg-lighter p-7 text-center">
<div className="p-2 text-3xl font-bold text-input-text">
{t("settings.bare.title")}
</div>
<div className="text-md p-4 font-bold text-input-text">
{t("settings.bare.subtitle")}
</div>
<BareInput placeholder="/bare/" storageKey="bare" />
</div>
</motion.div> </motion.div>
</motion.div> </motion.div>
); );

View file

@ -18,10 +18,12 @@ export function DiscordPage() {
<p className="font-roboto text-4xl font-bold text-input-text"> <p className="font-roboto text-4xl font-bold text-input-text">
{t("discord.title")} {t("discord.title")}
</p> </p>
<span className="font-roboto text-3xl text-input-text">{t("discord.sub")}</span> <span className="font-roboto text-3xl text-input-text">
{t("discord.sub")}
</span>
</div> </div>
<a href="https://discord.gg/unblocker" className="p-6"> <a href="https://discord.gg/unblocker" className="p-6">
<button className="font-roboto h-14 w-56 rounded-2xl border border-input-border-color bg-input p-2 text-center text-xl placeholder:text-input-text focus:outline-none text-input-text"> <button className="font-roboto h-14 w-56 rounded-2xl border border-input-border-color bg-input p-2 text-center text-xl text-input-text placeholder:text-input-text focus:outline-none">
{t("discord.button1")} {t("discord.button1")}
</button> </button>
</a> </a>
@ -33,7 +35,7 @@ export function DiscordPage() {
}} }}
className="p-6" className="p-6"
> >
<button className="font-roboto h-14 w-56 rounded-2xl border border-input-border-color bg-input p-2 text-center text-xl placeholder:text-input-text focus:outline-none text-input-text"> <button className="font-roboto h-14 w-56 rounded-2xl border border-input-border-color bg-input p-2 text-center text-xl text-input-text placeholder:text-input-text focus:outline-none">
{t("discord.button2")} {t("discord.button2")}
</button> </button>
</a> </a>

View file

@ -1,27 +1,27 @@
import { LocationProvider, Router, Route } from "preact-iso"; import { LocationProvider, Router, Route } from "preact-iso";
import { Home } from "./pages/Home"; import { Home } from "./pages/Home";
import { NotFound } from "./pages/_404"; import { NotFound } from "./pages/_404";
import { DiscordPage } from "./pages/discord"; import { DiscordPage } from "./pages/discord";
import { ProxyFrame } from "./pages/ProxyFrame.js"; import { ProxyFrame } from "./pages/ProxyFrame.js";
import { Radon } from "./pages/Radon"; import { Radon } from "./pages/Radon";
import { Settings } from "./pages/Settings/"; import { Settings } from "./pages/Settings/";
import { AboutBlank } from "./AboutBlank"; import { AboutBlank } from "./AboutBlank";
import "./style.css"; import "./style.css";
import "./i18n"; import "./i18n";
export default function Routes() { export default function Routes() {
return ( return (
<LocationProvider> <LocationProvider>
<Router> <Router>
<Route path="/" component={Home} /> <Route path="/" component={Home} />
<Route path="/discord" component={DiscordPage} /> <Route path="/discord" component={DiscordPage} />
<Route path="/games" component={Radon} /> <Route path="/games" component={Radon} />
<Route path="/go/:url" component={ProxyFrame} /> <Route path="/go/:url" component={ProxyFrame} />
<Route path="/settings" component={Settings} /> <Route path="/settings" component={Settings} />
<Route path="/ab/:url" component={AboutBlank} /> <Route path="/ab/:url" component={AboutBlank} />
<Route default component={NotFound} /> <Route default component={NotFound} />
</Router> </Router>
</LocationProvider> </LocationProvider>
); );
} }

View file

@ -1,38 +1,38 @@
import { Helmet } from "react-helmet"; import { Helmet } from "react-helmet";
interface Props { interface Props {
originalTitle: string; originalTitle: string;
originalFavicon: string; originalFavicon: string;
} }
const CloakedHead = (props: Props) => { const CloakedHead = (props: Props) => {
var isTitleCloaked = var isTitleCloaked =
localStorage.getItem("cloakTitle") !== null localStorage.getItem("cloakTitle") !== null
? localStorage.getItem("cloakTitle") !== "none" ? localStorage.getItem("cloakTitle") !== "none"
: false; : false;
var isFaviconCloaked = var isFaviconCloaked =
localStorage.getItem("cloakFavicon") !== null localStorage.getItem("cloakFavicon") !== null
? localStorage.getItem("cloakFavicon") !== "none" ? localStorage.getItem("cloakFavicon") !== "none"
: false; : false;
return ( return (
<Helmet> <Helmet>
<title> <title>
{isTitleCloaked {isTitleCloaked
? localStorage.getItem("cloakTitle") ? localStorage.getItem("cloakTitle")
: props.originalTitle} : props.originalTitle}
</title> </title>
<link <link
rel="icon" rel="icon"
href={ href={
isFaviconCloaked isFaviconCloaked
? localStorage.getItem("cloakFavicon") ? localStorage.getItem("cloakFavicon")
: props.originalFavicon : props.originalFavicon
} }
/> />
</Helmet> </Helmet>
); );
}; };
export default CloakedHead; export default CloakedHead;

22
src/util/IDB.js Normal file
View file

@ -0,0 +1,22 @@
function set(key, value) {
localforage.config({
driver: localforage.INDEXEDDB,
name: "Nebula",
version: 1.0,
storeName: "nebula_config",
description: "Nebula Config for things reliant on IndexedDB"
});
localforage.setItem(key, value);
}
async function get(key) {
localforage.config({
driver: localforage.INDEXEDDB,
name: "Nebula",
version: 1.0,
storeName: "nebula_config",
description: "Nebula Config for things reliant on IndexedDB"
});
return await localforage.getItem(key);
}
export { set, get };

19
src/util/SWHelper.js Normal file
View file

@ -0,0 +1,19 @@
function updateServiceWorkers() {
navigator.serviceWorker.getRegistrations().then(function (registrations) {
for (let registration of registrations) {
registration.update();
console.log("Service Worker Updated");
}
});
}
function uninstallServiceWorkers() {
navigator.serviceWorker.getRegistrations().then(function (registrations) {
for (let registration of registrations) {
registration.unregister();
console.log("Service Worker Unregistered");
}
});
}
export { updateServiceWorkers, uninstallServiceWorkers };

View file

@ -1,10 +1,10 @@
{ {
"discord.gg": "ultraviolet", "discord.gg": "ultraviolet",
"discord.com": "ultraviolet", "discord.com": "ultraviolet",
"example.org": "rammerhead", "example.org": "rammerhead",
"example.com": "ultraviolet", "example.com": "ultraviolet",
"spotify.com": "dynamic", "spotify.com": "dynamic",
"spotify.link": "dynamic", "spotify.link": "dynamic",
"youtube.com": "ultraviolet", "youtube.com": "ultraviolet",
"youtu.be": "ultraviolet" "youtu.be": "ultraviolet"
} }

View file

@ -4,6 +4,8 @@ import preact from "@preact/preset-vite";
import { viteStaticCopy } from "vite-plugin-static-copy"; import { viteStaticCopy } from "vite-plugin-static-copy";
import { uvPath } from "@nebula-services/ultraviolet"; import { uvPath } from "@nebula-services/ultraviolet";
import { dynamicPath } from "@nebula-services/dynamic"; import { dynamicPath } from "@nebula-services/dynamic";
import path from "path";
const __dirname = path.resolve();
console.log(dynamicPath); console.log(dynamicPath);
@ -22,6 +24,14 @@ export default defineConfig({
src: `${dynamicPath}/dynamic.*.js`.replace(/\\/g, "/"), src: `${dynamicPath}/dynamic.*.js`.replace(/\\/g, "/"),
dest: "dynamic", dest: "dynamic",
overwrite: false overwrite: false
},
{
src: `${__dirname}/node_modules/localforage/dist/localforage.*.js`.replace(
/\\/g,
"/"
),
dest: "localforage",
overwrite: false
} }
] ]
}), }),