fix up some rammerhead removal things

This commit is contained in:
rift 2024-11-03 20:24:09 -06:00
parent fc414951d1
commit 19a3856768

View file

@ -12,8 +12,11 @@ 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 = [{ params: { lang: "en_US" } }, { params: { lang: "jp" } }]; const STATIC_PATHS = [
return STATIC_PATHS; { params: { lang: "en_US" } },
{ 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";
@ -21,175 +24,238 @@ import { MARKETPLACE_ENABLED } from "astro:env/client";
<Layout title="Settings"> <Layout title="Settings">
<SettingsLayout title={t("settings.proxy")}> <SettingsLayout title={t("settings.proxy")}>
<SettingsSection title="Proxy" subtitle="A wide variety of settings for the proxy/rewriter itself."> <SettingsSection
<div class="w-full h-full flex flex-col items-center justify-center flex-wrap md:flex-row md:items-start md:justify-start gap-4"> title="Proxy"
subtitle="A wide variety of settings for the proxy/rewriter itself."
>
<div
class="w-full h-full flex flex-col items-center justify-center flex-wrap md:flex-row md:items-start md:justify-start gap-4"
>
<SettingsCard <SettingsCard
title="Proxy" title="Proxy"
description="Choose the proxy/rewriter that fits your needs" description="Choose the proxy/rewriter that fits your needs"
input={{input:false}} input={{ input: false }}
button={{name: 'Change', id: 'setproxy'}} button={{ name: "Change", id: "setproxy" }}
select={{ select={{
select: true, select: true,
name: 'proxy', name: "proxy",
options: [ options: [
{name: 'Automatic', value: 'automatic', disabled: false}, { name: "Automatic", value: "automatic", disabled: false },
{name: 'Ultraviolet', value: 'uv', disabled: false}, { name: "Ultraviolet", value: "uv", disabled: false },
{name: 'Rammerhead', value: 'rh', disabled: false} { name: "Scramjet (COMING SOON)", value: "sj", disabled: true },
] ],
}} }}
/> />
<SettingsCard <SettingsCard
title="Open in" title="Open in"
description="Choose how to open your sites" description="Choose how to open your sites"
input={{input:false}} input={{ input: false }}
button={{name: 'Set', id: 'setopenin'}} button={{ name: "Set", id: "setopenin" }}
select={{ select={{
select: true, select: true,
name: 'openin', name: "openin",
options: [ options: [
{name: 'Embed', value: 'embed', disabled: false}, { name: "Embed", value: "embed", disabled: false },
{name: 'Direct', value: 'direct', disabled: false}, { name: "Direct", value: "direct", disabled: false },
{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 },
] ],
}} }}
/> />
<SettingsCard <SettingsCard
title="Search Engine" title="Search Engine"
description="Choose your search engine" description="Choose your search engine"
input={{input: false}} input={{ input: false }}
button={{name: 'Set Search Engine', id: 'setsearchengine'}} button={{ name: "Set Search Engine", id: "setsearchengine" }}
select={{ select={{
select: true, select: true,
name: 'searchengine', name: "searchengine",
options: [ options: [
{name: 'DuckDuckGo', value: 'ddg', disabled: false}, { name: "DuckDuckGo", value: "ddg", disabled: false },
{name: 'Google', value: 'google', disabled: false}, { name: "Google", value: "google", disabled: false },
{name: 'Bing', value: 'bing', disabled: false} { name: "Bing", value: "bing", disabled: 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: false }}
button={{name: 'Select', id: 'setwispurl'}} button={{ name: "Select", id: "setwispurl" }}
select={{ select={{
select: true, select: true,
name: 'wispurl', name: "wispurl",
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 },
] ],
}} }}
/> />
<SettingsCard <SettingsCard
title="Transport" title="Transport"
description="Select the transport to use" description="Select the transport to use"
input={{input: false}} input={{ input: false }}
button={{name: 'Set transport', id: 'settransport'}} button={{ name: "Set transport", id: "settransport" }}
select={{ select={{
select: true, select: true,
name: 'transport', name: "transport",
options: [ options: [
{name: 'Libcurl', value: 'libcurl', disabled: false}, { name: "Libcurl", value: "libcurl", disabled: false },
{name: 'Epoxy', value: 'epoxy', disabled: false} { name: "Epoxy", value: "epoxy", disabled: false },
] ],
}} }}
/> />
</div> </div>
</SettingsSection>
{MARKETPLACE_ENABLED &&
<SettingsSection title="Plugins" subtitle="Plugins allow you to modify the way the proxy works (UV only, plugins are auto applied)">
<div class="flex flex-row gap-6 justify-center md:justify-normal">
<InstalledPlugins client:only="svelte" />
<a href={`/${lang}/catalog/1`} class="rounded-3xl bg-navbar-color w-64 flex flex-col">
<div class="w-full items-center justify-center flex aspect-[16/9]">
<Icon name="ph:plus-bold" class="h-16 w-16" />
</div>
<div class="h-2/6 text-center content-center p-3 font-semibold">
Get more plugins in the <strong>Nebula Catalog!</strong>
</div>
</a>
</div>
</SettingsSection> </SettingsSection>
{
MARKETPLACE_ENABLED && (
<SettingsSection
title="Plugins"
subtitle="Plugins allow you to modify the way the proxy works (UV only, plugins are auto applied)"
>
<div class="flex flex-row gap-6 justify-center md:justify-normal">
<InstalledPlugins client:only="svelte" />
<a
href={`/${lang}/catalog/1`}
class="rounded-3xl bg-navbar-color w-64 flex flex-col"
>
<div class="w-full items-center justify-center flex aspect-[16/9]">
<Icon name="ph:plus-bold" class="h-16 w-16" />
</div>
<div class="h-2/6 text-center content-center p-3 font-semibold">
Get more plugins in the <strong>Nebula Catalog!</strong>
</div>
</a>
</div>
</SettingsSection>
)
} }
</SettingsLayout> </SettingsLayout>
<ToastWrapper client:load> <ToastWrapper client:load>
<Toast toastProp={{ <Toast
toastType: 'success', toastProp={{
text: 'Successfully changed proxy!', toastType: "success",
class: 'proxyMessage' text: "Successfully changed proxy!",
}} class: "proxyMessage",
client:load /> }}
<Toast toastProp={{ client:load
toastType: 'success', />
text: 'Saved selection!', <Toast
class: 'openInMessage' toastProp={{
}} toastType: "success",
client:load /> text: "Saved selection!",
<Toast toastProp={{ class: "openInMessage",
toastType: 'success', }}
text: 'Saved Search Engine Selection!', client:load
class: 'searchEngineMessage' />
}} <Toast
client:load /> toastProp={{
<Toast toastProp={{ toastType: "success",
toastType: 'success', text: "Saved Search Engine Selection!",
text: 'Wisp server selected!', class: "searchEngineMessage",
class: 'wispUrlMessage' }}
}} client:load
client:load /> />
<Toast toastProp={{ <Toast
toastType: 'success', toastProp={{
text: 'Transport set!', toastType: "success",
class: 'transportMessage' text: "Wisp server selected!",
}} class: "wispUrlMessage",
client:load /> }}
client:load
/>
<Toast
toastProp={{
toastType: "success",
text: "Transport set!",
class: "transportMessage",
}}
client:load
/>
</ToastWrapper> </ToastWrapper>
</Layout> </Layout>
<script> <script>
import { toast } from "@utils/toast.ts"; import { toast } from "@utils/toast.ts";
import { settings, Settings as SettingsEnum } from "@utils/settings/index"; import { settings, Settings as SettingsEnum } from "@utils/settings/index";
import { pageLoad } from "@utils/events"; import { pageLoad } from "@utils/events";
function setup(proxySelectVal: HTMLSelectElement, openInVal: HTMLSelectElement, searchEngineVal: HTMLSelectElement, wispServerVal: HTMLSelectElement, transportVal: HTMLSelectElement) { function setup(
proxySelectVal.value = localStorage.getItem(SettingsEnum.ProxySettings.proxy) as string; proxySelectVal: HTMLSelectElement,
openInVal.value = localStorage.getItem(SettingsEnum.ProxySettings.openIn) as string; openInVal: HTMLSelectElement,
searchEngineVal.value = localStorage.getItem(SettingsEnum.ProxySettings.searchEngine) as string; searchEngineVal: HTMLSelectElement,
wispServerVal.value = localStorage.getItem(SettingsEnum.ProxySettings.wispServerURL) as string; wispServerVal: HTMLSelectElement,
transportVal.value = localStorage.getItem(SettingsEnum.ProxySettings.transport) as string; transportVal: HTMLSelectElement
} ) {
pageLoad(() => { proxySelectVal.value = localStorage.getItem(
const proxyButton = document.getElementById("setproxy") as HTMLButtonElement; SettingsEnum.ProxySettings.proxy
const proxySelectVal = document.getElementById('proxy') as HTMLSelectElement; ) as string;
const openInButton = document.getElementById('setopenin') as HTMLButtonElement; openInVal.value = localStorage.getItem(
const openInVal = document.getElementById('openin') as HTMLSelectElement; SettingsEnum.ProxySettings.openIn
const searchEngineButton = document.getElementById('setsearchengine') as HTMLButtonElement; ) as string;
const searchEngineVal = document.getElementById('searchengine') as HTMLSelectElement; searchEngineVal.value = localStorage.getItem(
const wispServerButton = document.getElementById('setwispurl') as HTMLButtonElement; SettingsEnum.ProxySettings.searchEngine
const wispServerVal = document.getElementById('wispurl') as HTMLSelectElement; ) as string;
const transportButton = document.getElementById('settransport') as HTMLButtonElement; wispServerVal.value = localStorage.getItem(
const transportVal = document.getElementById('transport') as HTMLSelectElement; SettingsEnum.ProxySettings.wispServerURL
setup(proxySelectVal, openInVal, searchEngineVal, wispServerVal, transportVal); ) as string;
proxyButton.addEventListener("click", () => { transportVal.value = localStorage.getItem(
settings.proxySettings.changeProxy(proxySelectVal.value); SettingsEnum.ProxySettings.transport
toast('.proxyMessage'); ) as string;
}); }
openInButton.addEventListener("click", () => { pageLoad(() => {
settings.proxySettings.openIn(openInVal.value) const proxyButton = document.getElementById(
toast('.openInMessage'); "setproxy"
}); ) as HTMLButtonElement;
searchEngineButton.addEventListener('click', () => { const proxySelectVal = document.getElementById(
settings.proxySettings.setSearchEngine(searchEngineVal.value); "proxy"
toast('.searchEngineMessage'); ) as HTMLSelectElement;
}); const openInButton = document.getElementById(
wispServerButton.addEventListener('click', () => { "setopenin"
settings.proxySettings.setWispURL(wispServerVal.value); ) as HTMLButtonElement;
toast('.wispUrlMessage'); const openInVal = document.getElementById("openin") as HTMLSelectElement;
}); const searchEngineButton = document.getElementById(
transportButton.addEventListener('click', () => { "setsearchengine"
settings.proxySettings.setTransport(transportVal.value); ) as HTMLButtonElement;
toast('.transportMessage'); const searchEngineVal = document.getElementById(
}); "searchengine"
}) ) as HTMLSelectElement;
const wispServerButton = document.getElementById(
"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(
proxySelectVal,
openInVal,
searchEngineVal,
wispServerVal,
transportVal
);
proxyButton.addEventListener("click", () => {
settings.proxySettings.changeProxy(proxySelectVal.value);
toast(".proxyMessage");
});
openInButton.addEventListener("click", () => {
settings.proxySettings.openIn(openInVal.value);
toast(".openInMessage");
});
searchEngineButton.addEventListener("click", () => {
settings.proxySettings.setSearchEngine(searchEngineVal.value);
toast(".searchEngineMessage");
});
wispServerButton.addEventListener("click", () => {
settings.proxySettings.setWispURL(wispServerVal.value);
toast(".wispUrlMessage");
});
transportButton.addEventListener("click", () => {
settings.proxySettings.setTransport(transportVal.value);
toast(".transportMessage");
});
});
</script> </script>