mirror of
https://github.com/NebulaServices/Nebula.git
synced 2025-05-12 11:30:01 -04:00
Feat: custom wisp server urls
This commit is contained in:
parent
9bc00baa38
commit
c9e92d92f8
17 changed files with 190 additions and 153 deletions
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
|
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
|
||||||
"changelog": ["@changesets/changelog-github", { "repo": "nebulaservices/nebula" }],
|
"changelog": ["@changesets/changelog-github", { "repo": "nebulaservices/nebula" }],
|
||||||
"commit": false,
|
"commit": false,
|
||||||
"fixed": [],
|
"fixed": [],
|
||||||
"linked": [],
|
"linked": [],
|
||||||
"access": "public",
|
"access": "public",
|
||||||
"baseBranch": "main",
|
"baseBranch": "main",
|
||||||
"updateInternalDependencies": "patch",
|
"updateInternalDependencies": "patch",
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"privatePackages": { "version": true, "tag": true }
|
"privatePackages": { "version": true, "tag": true }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
: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);
|
||||||
--border-color: #16121f;
|
--border-color: #16121f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ const ww = new WorkerWare({ debug: false });
|
||||||
if (navigator.userAgent.includes("Firefox")) {
|
if (navigator.userAgent.includes("Firefox")) {
|
||||||
Object.defineProperty(globalThis, "crossOriginIsolated", {
|
Object.defineProperty(globalThis, "crossOriginIsolated", {
|
||||||
value: true,
|
value: true,
|
||||||
writable: true
|
writable: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,33 +1,29 @@
|
||||||
import { createServer } from "node:http";
|
import { createServer } from "node:http";
|
||||||
import {
|
import { FastifyServerFactory, FastifyServerFactoryHandler, RawServerDefault } from "fastify";
|
||||||
FastifyServerFactory,
|
|
||||||
FastifyServerFactoryHandler,
|
|
||||||
RawServerDefault,
|
|
||||||
} from "fastify";
|
|
||||||
import wisp from "wisp-server-node";
|
import wisp from "wisp-server-node";
|
||||||
import { LOG_LEVEL, WispOptions } from "wisp-server-node/dist/Types.js";
|
import { LOG_LEVEL, WispOptions } from "wisp-server-node/dist/Types.js";
|
||||||
import { parsedDoc } from "./config.js";
|
import { parsedDoc } from "./config.js";
|
||||||
|
|
||||||
const wispOptions: WispOptions = {
|
const wispOptions: WispOptions = {
|
||||||
logLevel: parsedDoc.server.server.logging ? LOG_LEVEL.DEBUG : LOG_LEVEL.NONE,
|
logLevel: parsedDoc.server.server.logging ? LOG_LEVEL.DEBUG : LOG_LEVEL.NONE,
|
||||||
pingInterval: 30,
|
pingInterval: 30
|
||||||
};
|
};
|
||||||
|
|
||||||
const serverFactory: FastifyServerFactory = (
|
const serverFactory: FastifyServerFactory = (
|
||||||
handler: FastifyServerFactoryHandler
|
handler: FastifyServerFactoryHandler
|
||||||
): RawServerDefault => {
|
): RawServerDefault => {
|
||||||
const httpServer = createServer();
|
const httpServer = createServer();
|
||||||
httpServer.on("request", (req, res) => {
|
httpServer.on("request", (req, res) => {
|
||||||
handler(req, res);
|
handler(req, res);
|
||||||
});
|
});
|
||||||
httpServer.on("upgrade", (req, socket, head) => {
|
httpServer.on("upgrade", (req, socket, head) => {
|
||||||
if (parsedDoc.server.server.wisp) {
|
if (parsedDoc.server.server.wisp) {
|
||||||
if (req.url?.endsWith("/wisp/")) {
|
if (req.url?.endsWith("/wisp/")) {
|
||||||
wisp.routeRequest(req, socket as any, head, wispOptions);
|
wisp.routeRequest(req, socket as any, head, wispOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return httpServer;
|
return httpServer;
|
||||||
};
|
};
|
||||||
|
|
||||||
export { serverFactory };
|
export { serverFactory };
|
||||||
|
|
|
@ -3,12 +3,22 @@ interface Inputs {
|
||||||
input: boolean;
|
input: boolean;
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
|
validate?: boolean;
|
||||||
|
validateString?: string;
|
||||||
}
|
}
|
||||||
interface SelectOptions {
|
interface SelectOptions {
|
||||||
value: string;
|
value: string;
|
||||||
name: string;
|
name: string;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Both {
|
||||||
|
enabled: boolean;
|
||||||
|
showOnSelect?: {
|
||||||
|
value: string;
|
||||||
|
};
|
||||||
|
showOnInput?: boolean;
|
||||||
|
}
|
||||||
interface Selects {
|
interface Selects {
|
||||||
select: boolean;
|
select: boolean;
|
||||||
name?: string;
|
name?: string;
|
||||||
|
@ -24,27 +34,31 @@ interface Props {
|
||||||
description: string;
|
description: string;
|
||||||
input: Inputs;
|
input: Inputs;
|
||||||
select: Selects;
|
select: Selects;
|
||||||
|
both: Both;
|
||||||
button: Buttons;
|
button: Buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { title, description, input, select, button } = Astro.props;
|
const { title, description, input, select, both, button } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="w-64 rounded-3xl bg-navbar-color h-64 flex flex-col items-center p-4">
|
<div class={`${both.enabled ? "h-72" : "h-64"} w-64 rounded-3xl bg-navbar-color flex flex-col items-center p-4`}>
|
||||||
<h1 class="text-3xl font-bold mb-2"> { title } </h1>
|
<h1 class="text-3xl font-bold mb-2"> { title } </h1>
|
||||||
<p class="text-md w-full text-ellipsis text-center"> { description } </p>
|
<p class="text-md w-full text-ellipsis text-center"> { description } </p>
|
||||||
<div class="w-full h-full flex-grow flex justify-center items-center flex-col gap-4">
|
<div class="w-full h-full flex-grow flex justify-center items-center flex-col gap-4">
|
||||||
<!-- We only want to render an input if it's enabled -->
|
<!-- We only want to render an input if it's enabled -->
|
||||||
{input.input &&
|
{(input.input && !both.enabled) &&
|
||||||
<input class="text-md w-full h-10 p-2 bg-input border border-input-border-color rounded-md text-input-text" required={input.required} placeholder={input.placeholder}></input>
|
<input class="text-md w-full h-10 p-2 bg-input border border-input-border-color rounded-md text-input-text" required={input.required} placeholder={input.placeholder}></input>
|
||||||
}
|
}
|
||||||
<!-- Same with dropdown selections -->
|
<!-- Same with dropdown selections -->
|
||||||
{select.select &&
|
{select.select &&
|
||||||
<select id={select.name?.replace(/[^a-zA-Z0-9]/g, '').toLowerCase()} class="text-md w-full h-10 p-2 bg-input border border-input-border-color rounded-md text-input-text" multiple={select.multiple} name={select.name}>
|
<select id={select.name?.replace(/[^a-zA-Z0-9]/g, '').toLowerCase()} class="text-md w-full h-10 p-2 bg-input border border-input-border-color rounded-md text-input-text" multiple={select.multiple} name={select.name}>
|
||||||
{select.options!.map((option) => (
|
{select.options!.map((option) => (
|
||||||
<option disabled={option.disabled} value={option.value}>{option.name}</option>
|
<option id={option.value} disabled={option.disabled} value={option.value}>{option.name}</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
|
}
|
||||||
|
{(both.enabled && both.showOnSelect?.value) &&
|
||||||
|
<input id={'inputOnSelectValue' + both.showOnSelect?.value} class="hidden text-md w-full h-10 p-2 bg-input border border-input-border-color rounded-md text-input-text" required={input.required} placeholder={input.placeholder}></input>
|
||||||
}
|
}
|
||||||
<button id={button.id.replace(/[^a-zA-Z0-9]/g, '').toLowerCase()} class="w-36 h-10 rounded-md border border-input-border-color text-input-text bg-input hover:border-input hover:bg-input-border-color hover:text-input hover:font-bold active:bg-input active:text-input-text transition-all duration-200">
|
<button id={button.id.replace(/[^a-zA-Z0-9]/g, '').toLowerCase()} class="w-36 h-10 rounded-md border border-input-border-color text-input-text bg-input hover:border-input hover:bg-input-border-color hover:text-input hover:font-bold active:bg-input active:text-input-text transition-all duration-200">
|
||||||
{button.name}
|
{button.name}
|
||||||
|
|
|
@ -4,8 +4,8 @@ import Header from "@components/Header.astro";
|
||||||
import MobileNavigation from "@components/MobileNavigation.astro";
|
import MobileNavigation from "@components/MobileNavigation.astro";
|
||||||
import SettingsLoader from "@components/settings/Loader.astro";
|
import SettingsLoader from "@components/settings/Loader.astro";
|
||||||
interface Props {
|
interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
noHeader?: string;
|
noHeader?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { title, noHeader } = Astro.props;
|
const { title, noHeader } = Astro.props;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { Icon } from "astro-icon/components";
|
||||||
|
|
||||||
<div class="flex flex-row font-roboto">
|
<div class="flex flex-row font-roboto">
|
||||||
<div class="text-text-color mt-16 fixed inset-0 h-[calc(100%-4rem)] z-0 bg-primary flex-col flex md:flex-row">
|
<div class="text-text-color mt-16 fixed inset-0 h-[calc(100%-4rem)] z-0 bg-primary flex-col flex md:flex-row">
|
||||||
<div class="items-center md:p-3 sm:p-3 flex flex-row border-border-color md:gap-10 xl:gap-10 max-sm:gap-5 sm:gap-5 md:border-r-2 max:md:w-2/12 md:flex-col md:bg-navbar-color md:gap-0 overflow-x-auto md:overflow-x-hidden overflow-y-hidden max-md:ml-1 max-md:mr-1 max-md:max-h-24 max-md:min-h-24 max-md:justify-left max-md:scroll-ml-3 max-md:scroll-mr-3 max-md:snap-x max-md:snap-mandatory">
|
<div class="items-center md:p-3 sm:p-3 flex flex-row border-border-color md:gap-10 xl:gap-10 max-sm:gap-5 sm:gap-5 md:border-r-2 lg:w-2/12 md:w-3/12 md:flex-col md:bg-navbar-color md:gap-0 overflow-x-auto md:overflow-x-hidden overflow-y-hidden max-md:ml-1 max-md:mr-1 max-md:max-h-24 max-md:min-h-24 max-md:justify-left max-md:scroll-ml-3 max-md:scroll-mr-3 max-md:snap-x max-md:snap-mandatory">
|
||||||
<SidebarButton title={t("settings.appearance")} route={`/${lang}/settings/appearance`}>
|
<SidebarButton title={t("settings.appearance")} route={`/${lang}/settings/appearance`}>
|
||||||
<Icon name="ph:palette" class="h-6 w-6 text-text-color transition duration-500 group-hover:text-text-hover-color md:h-6 md:w-6" />
|
<Icon name="ph:palette" class="h-6 w-6 text-text-color transition duration-500 group-hover:text-text-hover-color md:h-6 md:w-6" />
|
||||||
</SidebarButton>
|
</SidebarButton>
|
||||||
|
@ -26,7 +26,7 @@ import { Icon } from "astro-icon/components";
|
||||||
<Icon name="ph:user" class="h-6 w-6 text-text-color transistion duration-500 group-hover:text-text-hover-color md:h-6 md:w=6" />
|
<Icon name="ph:user" class="h-6 w-6 text-text-color transistion duration-500 group-hover:text-text-hover-color md:h-6 md:w=6" />
|
||||||
</SidebarButton>
|
</SidebarButton>
|
||||||
</div>
|
</div>
|
||||||
<div class="p-8 md:pb-2 flex-grow overflow-y-auto">
|
<div class="p-8 md:pb-2 w-full flex-grow overflow-y-auto">
|
||||||
<p class="text-5xl font-semibold mb-5">{t("settings.settings")}</p>
|
<p class="text-5xl font-semibold mb-5">{t("settings.settings")}</p>
|
||||||
<p class="text-2xl">{title}</p>
|
<p class="text-2xl">{title}</p>
|
||||||
<slot />
|
<slot />
|
||||||
|
|
|
@ -4,12 +4,14 @@
|
||||||
id="pagnation_input"
|
id="pagnation_input"
|
||||||
placeholder="..."
|
placeholder="..."
|
||||||
/>
|
/>
|
||||||
<script is:inline data-astro-rerun>
|
<script>
|
||||||
document
|
import { pageLoad } from "@utils/events";
|
||||||
.getElementById("pagnation_input")
|
pageLoad(() => {
|
||||||
.addEventListener("keyup", function (event) {
|
const pagenationInput = document.getElementById('pagnation_input') as HTMLInputElement;
|
||||||
if (event.key === "Enter") {
|
pagenationInput?.addEventListener("keyup", function (event) {
|
||||||
window.location.href = document.getElementById("pagnation_input").value;
|
if (event.key === "Enter") {
|
||||||
}
|
window.location.href = pagenationInput?.value;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -11,15 +11,13 @@ export const prerender = true;
|
||||||
<iframe id="chango" class="w-full h-full"></iframe>
|
<iframe id="chango" class="w-full h-full"></iframe>
|
||||||
</Layout>
|
</Layout>
|
||||||
<script>
|
<script>
|
||||||
import { initSw, loadProxyScripts, setTransport } from "@utils/registerSW.ts"; //../../utils/registerSW.ts
|
import { setTransport, getSWStuff } from "@utils/registerSW.ts"; //../../utils/registerSW.ts
|
||||||
import { Settings } from "@utils/settings/index";
|
import { Settings } from "@utils/settings/index";
|
||||||
import { pageLoad } from "@utils/events";
|
import { pageLoad } from "@utils/events";
|
||||||
pageLoad(async () => {
|
pageLoad(async () => {
|
||||||
|
const { conn } = getSWStuff();
|
||||||
const iframe = document.getElementById("chango") as HTMLIFrameElement;
|
const iframe = document.getElementById("chango") as HTMLIFrameElement;
|
||||||
const conn = await loadProxyScripts();
|
|
||||||
await setTransport(conn, localStorage.getItem(Settings.ProxySettings.transport) as string);
|
await setTransport(conn, localStorage.getItem(Settings.ProxySettings.transport) as string);
|
||||||
await initSw().then(() => {
|
if (iframe) return iframe.src = __uv$config!.prefix + __uv$config.encodeUrl!("https://radon.games");
|
||||||
if (iframe) return iframe.src = __uv$config!.prefix + __uv$config.encodeUrl!("https://radon.games");
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -3,11 +3,8 @@ import Logo from "@components/Logo.astro";
|
||||||
import Layout from "@layouts/Layout.astro";
|
import Layout from "@layouts/Layout.astro";
|
||||||
import { getLangFromUrl, useTranslations } from "../../i18n/utils";
|
import { getLangFromUrl, useTranslations } from "../../i18n/utils";
|
||||||
export function getStaticPaths() {
|
export function getStaticPaths() {
|
||||||
const STATIC_PATHS = [
|
const STATIC_PATHS = [{ params: { lang: "en_US" } }, { params: { lang: "jp" } }];
|
||||||
{ params: { lang: "en_US" } },
|
return STATIC_PATHS;
|
||||||
{ params: { lang: "jp" } },
|
|
||||||
];
|
|
||||||
return STATIC_PATHS;
|
|
||||||
}
|
}
|
||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
const lang = getLangFromUrl(Astro.url);
|
const lang = getLangFromUrl(Astro.url);
|
||||||
|
@ -115,6 +112,7 @@ import { VERSION } from "astro:env/client";
|
||||||
const iframe = document.getElementById("neb-iframe") as HTMLIFrameElement;
|
const iframe = document.getElementById("neb-iframe") as HTMLIFrameElement;
|
||||||
const omnibox = document.getElementById("omnibox") as HTMLDivElement;
|
const omnibox = document.getElementById("omnibox") as HTMLDivElement;
|
||||||
const copyright = document.getElementById("version") as HTMLDivElement;
|
const copyright = document.getElementById("version") as HTMLDivElement;
|
||||||
|
const client = new BareClient();
|
||||||
input?.addEventListener("keypress", async function (event: any) {
|
input?.addEventListener("keypress", async function (event: any) {
|
||||||
if (event.key === "Enter") {
|
if (event.key === "Enter") {
|
||||||
copyright.classList.add("hidden");
|
copyright.classList.add("hidden");
|
||||||
|
@ -147,7 +145,6 @@ import { VERSION } from "astro:env/client";
|
||||||
omnibox.classList.add("hidden");
|
omnibox.classList.add("hidden");
|
||||||
}
|
}
|
||||||
if (value.length >= 3) {
|
if (value.length >= 3) {
|
||||||
const client = new BareClient();
|
|
||||||
const data = await client.fetch(`https://api.duckduckgo.com/ac?q=${encodeURIComponent(value)}&format=json`);
|
const data = await client.fetch(`https://api.duckduckgo.com/ac?q=${encodeURIComponent(value)}&format=json`);
|
||||||
const dataRes = await data.json();
|
const dataRes = await data.json();
|
||||||
const filteredData = dataRes.slice(0, 8); //Trim to only about 8 results. Any more and our omnibox dies
|
const filteredData = dataRes.slice(0, 8); //Trim to only about 8 results. Any more and our omnibox dies
|
||||||
|
|
|
@ -34,6 +34,7 @@ export const prerender = true;
|
||||||
{name: 'Japanese', value: 'jp', disabled: false},
|
{name: 'Japanese', value: 'jp', disabled: false},
|
||||||
]
|
]
|
||||||
}}
|
}}
|
||||||
|
both={{enabled: false}}
|
||||||
/>
|
/>
|
||||||
<SettingsCard
|
<SettingsCard
|
||||||
title="Proxy Catalog"
|
title="Proxy Catalog"
|
||||||
|
@ -47,7 +48,8 @@ export const prerender = true;
|
||||||
{name: 'False', value: 'false', disabled: false},
|
{name: 'False', value: 'false', disabled: false},
|
||||||
{name: 'True', value: 'true', disabled: false}
|
{name: 'True', value: 'true', disabled: false}
|
||||||
]
|
]
|
||||||
}}
|
}}
|
||||||
|
both={{enabled: false}}
|
||||||
/>
|
/>
|
||||||
<SettingsCard
|
<SettingsCard
|
||||||
title="Catalog URL"
|
title="Catalog URL"
|
||||||
|
@ -59,6 +61,7 @@ export const prerender = true;
|
||||||
}}
|
}}
|
||||||
button={{name: 'Change', id: 'setcataloghostname' }}
|
button={{name: 'Change', id: 'setcataloghostname' }}
|
||||||
select={{select: false}}
|
select={{select: false}}
|
||||||
|
both={{enabled: false}}
|
||||||
/>
|
/>
|
||||||
</SettingsSection>
|
</SettingsSection>
|
||||||
</SettingsLayout>
|
</SettingsLayout>
|
||||||
|
|
|
@ -12,11 +12,8 @@ import { getLangFromUrl, useTranslations } from "../../../i18n/utils";
|
||||||
const lang = getLangFromUrl(Astro.url);
|
const lang = getLangFromUrl(Astro.url);
|
||||||
const t = useTranslations(lang);
|
const t = useTranslations(lang);
|
||||||
export function getStaticPaths() {
|
export function getStaticPaths() {
|
||||||
const STATIC_PATHS = [
|
const STATIC_PATHS = [{ params: { lang: "en_US" } }, { params: { lang: "jp" } }];
|
||||||
{ params: { lang: "en_US" } },
|
return STATIC_PATHS;
|
||||||
{ params: { lang: "jp" } },
|
|
||||||
];
|
|
||||||
return STATIC_PATHS;
|
|
||||||
}
|
}
|
||||||
export const prerender = true;
|
export const prerender = true;
|
||||||
import { MARKETPLACE_ENABLED } from "astro:env/client";
|
import { MARKETPLACE_ENABLED } from "astro:env/client";
|
||||||
|
@ -44,7 +41,8 @@ import { MARKETPLACE_ENABLED } from "astro:env/client";
|
||||||
{ name: "Ultraviolet", value: "uv", disabled: false },
|
{ name: "Ultraviolet", value: "uv", disabled: false },
|
||||||
{ name: "Scramjet (COMING SOON)", value: "sj", disabled: true },
|
{ name: "Scramjet (COMING SOON)", value: "sj", disabled: true },
|
||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
|
both={{enabled: false}}
|
||||||
/>
|
/>
|
||||||
<SettingsCard
|
<SettingsCard
|
||||||
title="Open in"
|
title="Open in"
|
||||||
|
@ -60,7 +58,8 @@ import { MARKETPLACE_ENABLED } from "astro:env/client";
|
||||||
{ name: "About:Blank", value: "a:b", disabled: false },
|
{ name: "About:Blank", value: "a:b", disabled: false },
|
||||||
{ name: "Blob", value: "blob", disabled: false },
|
{ name: "Blob", value: "blob", disabled: false },
|
||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
|
both={{enabled: false}}
|
||||||
/>
|
/>
|
||||||
<SettingsCard
|
<SettingsCard
|
||||||
title="Search Engine"
|
title="Search Engine"
|
||||||
|
@ -75,12 +74,13 @@ import { MARKETPLACE_ENABLED } from "astro:env/client";
|
||||||
{ name: "Google", value: "google", disabled: false },
|
{ name: "Google", value: "google", disabled: false },
|
||||||
{ name: "Bing", value: "bing", disabled: false },
|
{ name: "Bing", value: "bing", disabled: false },
|
||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
|
both={{enabled: false}}
|
||||||
/>
|
/>
|
||||||
<SettingsCard
|
<SettingsCard
|
||||||
title="Wisp Server"
|
title="Wisp Server"
|
||||||
description="Choose the wisp server you feel is the fastest"
|
description="Choose the wisp server you feel is the fastest"
|
||||||
input={{ input: false }}
|
input={{ input: true, required: false, placeholder: 'wss://nebulaproxy.io/wisp' }}
|
||||||
button={{ name: "Select", id: "setwispurl" }}
|
button={{ name: "Select", id: "setwispurl" }}
|
||||||
select={{
|
select={{
|
||||||
select: true,
|
select: true,
|
||||||
|
@ -88,8 +88,13 @@ import { MARKETPLACE_ENABLED } from "astro:env/client";
|
||||||
options: [
|
options: [
|
||||||
{ name: "Default", value: "default", disabled: false },
|
{ name: "Default", value: "default", disabled: false },
|
||||||
{ name: "Ruby Network (US)", value: "ruby", disabled: false },
|
{ name: "Ruby Network (US)", value: "ruby", disabled: false },
|
||||||
|
{ name: "Custom", value: "custom", disabled: false }
|
||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
|
both={{
|
||||||
|
enabled: true,
|
||||||
|
showOnSelect: {value: 'custom'}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<SettingsCard
|
<SettingsCard
|
||||||
title="Transport"
|
title="Transport"
|
||||||
|
@ -103,7 +108,8 @@ import { MARKETPLACE_ENABLED } from "astro:env/client";
|
||||||
{ name: "Libcurl", value: "libcurl", disabled: false },
|
{ name: "Libcurl", value: "libcurl", disabled: false },
|
||||||
{ name: "Epoxy", value: "epoxy", disabled: false },
|
{ name: "Epoxy", value: "epoxy", disabled: false },
|
||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
|
both={{enabled: false}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</SettingsSection>
|
</SettingsSection>
|
||||||
|
@ -163,7 +169,7 @@ import { MARKETPLACE_ENABLED } from "astro:env/client";
|
||||||
class: "wispUrlMessage",
|
class: "wispUrlMessage",
|
||||||
}}
|
}}
|
||||||
client:load
|
client:load
|
||||||
/>
|
/>
|
||||||
<Toast
|
<Toast
|
||||||
toastProp={{
|
toastProp={{
|
||||||
toastType: "success",
|
toastType: "success",
|
||||||
|
@ -183,7 +189,8 @@ import { MARKETPLACE_ENABLED } from "astro:env/client";
|
||||||
openInVal: HTMLSelectElement,
|
openInVal: HTMLSelectElement,
|
||||||
searchEngineVal: HTMLSelectElement,
|
searchEngineVal: HTMLSelectElement,
|
||||||
wispServerVal: HTMLSelectElement,
|
wispServerVal: HTMLSelectElement,
|
||||||
transportVal: HTMLSelectElement
|
transportVal: HTMLSelectElement,
|
||||||
|
customUrl: HTMLInputElement
|
||||||
) {
|
) {
|
||||||
proxySelectVal.value = localStorage.getItem(
|
proxySelectVal.value = localStorage.getItem(
|
||||||
SettingsEnum.ProxySettings.proxy
|
SettingsEnum.ProxySettings.proxy
|
||||||
|
@ -194,48 +201,34 @@ import { MARKETPLACE_ENABLED } from "astro:env/client";
|
||||||
searchEngineVal.value = localStorage.getItem(
|
searchEngineVal.value = localStorage.getItem(
|
||||||
SettingsEnum.ProxySettings.searchEngine
|
SettingsEnum.ProxySettings.searchEngine
|
||||||
) as string;
|
) as string;
|
||||||
wispServerVal.value = localStorage.getItem(
|
wispServerVal.value = localStorage.getItem(SettingsEnum.ProxySettings.wispServerURL) as string;
|
||||||
SettingsEnum.ProxySettings.wispServerURL
|
if (wispServerVal.value === "custom") {
|
||||||
) as string;
|
customUrl.classList.remove("hidden");
|
||||||
|
customUrl.value = localStorage.getItem("customWispUrl") as string;
|
||||||
|
}
|
||||||
transportVal.value = localStorage.getItem(
|
transportVal.value = localStorage.getItem(
|
||||||
SettingsEnum.ProxySettings.transport
|
SettingsEnum.ProxySettings.transport
|
||||||
) as string;
|
) as string;
|
||||||
}
|
}
|
||||||
pageLoad(() => {
|
pageLoad(() => {
|
||||||
const proxyButton = document.getElementById(
|
const proxyButton = document.getElementById("setproxy") as HTMLButtonElement;
|
||||||
"setproxy"
|
const proxySelectVal = document.getElementById("proxy") as HTMLSelectElement;
|
||||||
) as HTMLButtonElement;
|
const openInButton = document.getElementById("setopenin") as HTMLButtonElement;
|
||||||
const proxySelectVal = document.getElementById(
|
|
||||||
"proxy"
|
|
||||||
) as HTMLSelectElement;
|
|
||||||
const openInButton = document.getElementById(
|
|
||||||
"setopenin"
|
|
||||||
) as HTMLButtonElement;
|
|
||||||
const openInVal = document.getElementById("openin") as HTMLSelectElement;
|
const openInVal = document.getElementById("openin") as HTMLSelectElement;
|
||||||
const searchEngineButton = document.getElementById(
|
const searchEngineButton = document.getElementById("setsearchengine") as HTMLButtonElement;
|
||||||
"setsearchengine"
|
const searchEngineVal = document.getElementById("searchengine") as HTMLSelectElement;
|
||||||
) as HTMLButtonElement;
|
const wispServerButton = document.getElementById("setwispurl") as HTMLButtonElement;
|
||||||
const searchEngineVal = document.getElementById(
|
const wispServerVal = document.getElementById("wispurl") as HTMLSelectElement;
|
||||||
"searchengine"
|
const transportButton = document.getElementById("settransport") as HTMLButtonElement;
|
||||||
) as HTMLSelectElement;
|
const transportVal = document.getElementById("transport") as HTMLSelectElement;
|
||||||
const wispServerButton = document.getElementById(
|
const customWispUrl = document.getElementById("inputOnSelectValuecustom") as HTMLInputElement;
|
||||||
"setwispurl"
|
|
||||||
) as HTMLButtonElement;
|
|
||||||
const wispServerVal = document.getElementById(
|
|
||||||
"wispurl"
|
|
||||||
) as HTMLSelectElement;
|
|
||||||
const transportButton = document.getElementById(
|
|
||||||
"settransport"
|
|
||||||
) as HTMLButtonElement;
|
|
||||||
const transportVal = document.getElementById(
|
|
||||||
"transport"
|
|
||||||
) as HTMLSelectElement;
|
|
||||||
setup(
|
setup(
|
||||||
proxySelectVal,
|
proxySelectVal,
|
||||||
openInVal,
|
openInVal,
|
||||||
searchEngineVal,
|
searchEngineVal,
|
||||||
wispServerVal,
|
wispServerVal,
|
||||||
transportVal
|
transportVal,
|
||||||
|
customWispUrl
|
||||||
);
|
);
|
||||||
proxyButton.addEventListener("click", () => {
|
proxyButton.addEventListener("click", () => {
|
||||||
settings.proxySettings.changeProxy(proxySelectVal.value);
|
settings.proxySettings.changeProxy(proxySelectVal.value);
|
||||||
|
@ -250,8 +243,23 @@ import { MARKETPLACE_ENABLED } from "astro:env/client";
|
||||||
toast(".searchEngineMessage");
|
toast(".searchEngineMessage");
|
||||||
});
|
});
|
||||||
wispServerButton.addEventListener("click", () => {
|
wispServerButton.addEventListener("click", () => {
|
||||||
settings.proxySettings.setWispURL(wispServerVal.value);
|
if (wispServerVal.value === "custom") {
|
||||||
toast(".wispUrlMessage");
|
if (customWispUrl.classList.contains('hidden')) {
|
||||||
|
customWispUrl.classList.remove("hidden");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
localStorage.setItem("customWispUrl", customWispUrl.value);
|
||||||
|
settings.proxySettings.setWispURL(wispServerVal.value);
|
||||||
|
toast(".wispUrlMessage");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!customWispUrl.classList.contains('hidden')) {
|
||||||
|
customWispUrl.classList.add("hidden");
|
||||||
|
}
|
||||||
|
settings.proxySettings.setWispURL(wispServerVal.value);
|
||||||
|
toast(".wispUrlMessage");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
transportButton.addEventListener("click", () => {
|
transportButton.addEventListener("click", () => {
|
||||||
settings.proxySettings.setTransport(transportVal.value);
|
settings.proxySettings.setTransport(transportVal.value);
|
||||||
|
|
|
@ -32,6 +32,7 @@ export const prerender = true;
|
||||||
{name: 'Google Classroom', value: 'classroom', disabled: false},
|
{name: 'Google Classroom', value: 'classroom', disabled: false},
|
||||||
{name: 'Powerschool', value: 'powerschool', disabled: false}
|
{name: 'Powerschool', value: 'powerschool', disabled: false}
|
||||||
] }}
|
] }}
|
||||||
|
both={{enabled: false}}
|
||||||
/>
|
/>
|
||||||
<SettingsCard
|
<SettingsCard
|
||||||
title="A:B & Blob"
|
title="A:B & Blob"
|
||||||
|
@ -42,6 +43,7 @@ export const prerender = true;
|
||||||
{name: 'About:Blank', value: 'a:b', disabled: false},
|
{name: 'About:Blank', value: 'a:b', disabled: false},
|
||||||
{name: 'Blob', value: 'blob', disabled: false}
|
{name: 'Blob', value: 'blob', disabled: false}
|
||||||
] }}
|
] }}
|
||||||
|
both={{enabled: false}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</SettingsSection>
|
</SettingsSection>
|
||||||
|
|
|
@ -32,6 +32,7 @@ function setTransport(conn: BareMuxConnection, transport?: string) {
|
||||||
//wrap in a promise so we don't register sw until a transport is set.
|
//wrap in a promise so we don't register sw until a transport is set.
|
||||||
const wispServer = localStorage.getItem(Settings.ProxySettings.wispServerURL);
|
const wispServer = localStorage.getItem(Settings.ProxySettings.wispServerURL);
|
||||||
return new Promise<void>((resolve) => {
|
return new Promise<void>((resolve) => {
|
||||||
|
console.log(`Wisp server set: ${wispServer ? WispServerURLS[wispServer] : WispServerURLS.default}`)
|
||||||
switch (transport) {
|
switch (transport) {
|
||||||
case "epoxy":
|
case "epoxy":
|
||||||
conn.setTransport("/epoxy/index.mjs", [
|
conn.setTransport("/epoxy/index.mjs", [
|
||||||
|
@ -78,7 +79,7 @@ function getSWStuff(): SWStuff {
|
||||||
const stuff: SWStuff = {
|
const stuff: SWStuff = {
|
||||||
sw: swReg,
|
sw: swReg,
|
||||||
conn: baremuxConn
|
conn: baremuxConn
|
||||||
}
|
};
|
||||||
return stuff;
|
return stuff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,31 +17,31 @@ interface SWPagePlugin extends Omit<Plug, "name" | "src"> {
|
||||||
|
|
||||||
type SWPluginFunction<T extends unknown> = (args: T) => void | unknown;
|
type SWPluginFunction<T extends unknown> = (args: T) => void | unknown;
|
||||||
|
|
||||||
type Events =
|
type Events =
|
||||||
"abortpayment" |
|
| "abortpayment"
|
||||||
"activate" |
|
| "activate"
|
||||||
"backgroundfetchabort" |
|
| "backgroundfetchabort"
|
||||||
"backgroundfetchclick" |
|
| "backgroundfetchclick"
|
||||||
"backgroundfetchfail" |
|
| "backgroundfetchfail"
|
||||||
"backgroundfetchsuccess" |
|
| "backgroundfetchsuccess"
|
||||||
"canmakepayment" |
|
| "canmakepayment"
|
||||||
"contentdelete" |
|
| "contentdelete"
|
||||||
"cookiechange" |
|
| "cookiechange"
|
||||||
"fetch" |
|
| "fetch"
|
||||||
"install" |
|
| "install"
|
||||||
"message" |
|
| "message"
|
||||||
"messageerror" |
|
| "messageerror"
|
||||||
"notificationclick" |
|
| "notificationclick"
|
||||||
"notificationclose" |
|
| "notificationclose"
|
||||||
"paymentrequest" |
|
| "paymentrequest"
|
||||||
"periodicsync" |
|
| "periodicsync"
|
||||||
"push" |
|
| "push"
|
||||||
"pushsubscriptionchange" |
|
| "pushsubscriptionchange"
|
||||||
"sync"
|
| "sync";
|
||||||
|
|
||||||
interface SWPlugin extends Omit<Plug, "src"> {
|
interface SWPlugin extends Omit<Plug, "src"> {
|
||||||
function: string | SWPluginFunction<any>;
|
function: string | SWPluginFunction<any>;
|
||||||
events: Events[]
|
events: Events[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Package {
|
interface Package {
|
||||||
|
@ -53,4 +53,13 @@ interface Package {
|
||||||
plugin?: Plug;
|
plugin?: Plug;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { type PluginType, type MarketplacePluginType, type PackageType, type Plug as Plugin, type SWPagePlugin, type SWPlugin, type Package, type SWPluginFunction }
|
export {
|
||||||
|
type PluginType,
|
||||||
|
type MarketplacePluginType,
|
||||||
|
type PackageType,
|
||||||
|
type Plug as Plugin,
|
||||||
|
type SWPagePlugin,
|
||||||
|
type SWPlugin,
|
||||||
|
type Package,
|
||||||
|
type SWPluginFunction
|
||||||
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { type SWPagePlugin, type SWPlugin, type SWPluginFunction as PluginFunction } from "./types";
|
import { type SWPluginFunction as PluginFunction, type SWPagePlugin, type SWPlugin } from "./types";
|
||||||
|
|
||||||
interface PagePlugin extends Omit<SWPagePlugin, "type"> {};
|
interface PagePlugin extends Omit<SWPagePlugin, "type"> {}
|
||||||
interface ServiceWorkerPlugin extends Omit<SWPlugin, "type"> {};
|
interface ServiceWorkerPlugin extends Omit<SWPlugin, "type"> {}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
function entryFunc(): PagePlugin | ServiceWorkerPlugin;
|
function entryFunc(): PagePlugin | ServiceWorkerPlugin;
|
||||||
|
|
|
@ -1,4 +1,11 @@
|
||||||
import { type PackageType, type Package, type PluginType, type Plugin, type SWPagePlugin, type SWPlugin } from "./marketplace/types";
|
import {
|
||||||
|
type Package,
|
||||||
|
type PackageType,
|
||||||
|
type Plugin,
|
||||||
|
type PluginType,
|
||||||
|
type SWPagePlugin,
|
||||||
|
type SWPlugin
|
||||||
|
} from "./marketplace/types";
|
||||||
const wispUrl = (location.protocol === "https:" ? "wss://" : "ws://") + location.host + "/wisp/";
|
const wispUrl = (location.protocol === "https:" ? "wss://" : "ws://") + location.host + "/wisp/";
|
||||||
type TabCloaks = "default" | "google" | "wikipedia" | "canvas" | "classroom" | "powerschool";
|
type TabCloaks = "default" | "google" | "wikipedia" | "canvas" | "classroom" | "powerschool";
|
||||||
type AbCloaks = "a:b" | "blob";
|
type AbCloaks = "a:b" | "blob";
|
||||||
|
@ -13,10 +20,10 @@ const SearchEngines: Record<string, string> = {
|
||||||
type SearchEngine = "ddg" | "google" | "bing";
|
type SearchEngine = "ddg" | "google" | "bing";
|
||||||
const WispServerURLS: Record<string, string> = {
|
const WispServerURLS: Record<string, string> = {
|
||||||
default: wispUrl,
|
default: wispUrl,
|
||||||
ruby: "wss://ruby.rubynetwork.co/wisp/"
|
ruby: "wss://ruby.rubynetwork.co/wisp/",
|
||||||
|
custom: localStorage.getItem("customWispUrl") as string
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
type TabCloaks,
|
type TabCloaks,
|
||||||
type AbCloaks,
|
type AbCloaks,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue