diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index c076a12..430e443 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -36,7 +36,7 @@ jobs: cache: "pnpm" - name: Install dependencies - run: pnpm install --no-frozen-lockfile + run: pnpm install --frozen-lockfile - name: Create Release Pull Request or Publish id: changesets diff --git a/src/components/SettingsNav.astro b/src/components/SettingsNav.astro index 8a7577a..7470454 100644 --- a/src/components/SettingsNav.astro +++ b/src/components/SettingsNav.astro @@ -17,4 +17,7 @@ const { active } = Astro.props; Social Links + + Cloaking + diff --git a/src/pages/index.astro b/src/pages/index.astro index 2394a1c..2acc52e 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -127,6 +127,9 @@ const link = Astro.url.searchParams.get("redir"); customElements.define('link-element', CustomComponent); document.addEventListener("astro:page-load", async () => { - await init(); + try { + await init(); + } + catch (_) {} }); diff --git a/src/pages/settings/cloaking.astro b/src/pages/settings/cloaking.astro new file mode 100644 index 0000000..a98f475 --- /dev/null +++ b/src/pages/settings/cloaking.astro @@ -0,0 +1,63 @@ +--- +import SettingsLayout from "@layouts/SettingsLayout.astro"; +import Input from "@components/ui/Input.astro"; +import Button from "@components/ui/Button.astro"; +--- + +
+
+
+
+

About Blank

+ +
+
+
+
+
+
+

Blob

+ +
+
+
+
+
+
+
+ diff --git a/src/pages/settings/index.astro b/src/pages/settings/index.astro index f0a4080..b487ee6 100644 --- a/src/pages/settings/index.astro +++ b/src/pages/settings/index.astro @@ -82,7 +82,7 @@ Object.keys(SearchEngines).forEach((k) => seEl.addEventListener("change", async () => { opts.settings.searchEngine(seEl.value); }); - } + } const wispServer = async (opts: Options) => { const wispServerSwitcher = document.getElementById("wispServerSwitcher") as HTMLInputElement; diff --git a/src/utils/proxy.ts b/src/utils/proxy.ts index 166e05c..ab5ae7b 100644 --- a/src/utils/proxy.ts +++ b/src/utils/proxy.ts @@ -37,7 +37,7 @@ class SW { } } - #search(input: string, template: string) { + search(input: string, template: string) { try { return new URL(input).toString(); } catch (_) {} @@ -52,7 +52,7 @@ class SW { encodeURL(string: string): string { const proxy = this.#storageManager.getVal("proxy") as "uv" | "sj"; - const input = this.#search(string, this.#storageManager.getVal("searchEngine")); + const input = this.search(string, this.#storageManager.getVal("searchEngine")); return proxy === "uv" ? `${__uv$config.prefix}${__uv$config.encodeUrl!(input)}` : this.#scramjetController!.encodeUrl(input); diff --git a/src/utils/settings.ts b/src/utils/settings.ts index e39b8b3..a3bddcf 100644 --- a/src/utils/settings.ts +++ b/src/utils/settings.ts @@ -80,6 +80,48 @@ class Settings { this.#storageManager.setVal("searchEngine", engine || SearchEngines.DuckDuckGo); } + cloak(location: string) { + return { + aboutBlank: () => { + const win = window.open(); + if (!win) return; + window.location.replace(location); + const iframe = win.document.createElement("iframe") as HTMLIFrameElement; + win.document.body.setAttribute('style', 'margin: 0; height: 100vh; width: 100%;'); + iframe.setAttribute('style', 'border: none; width: 100%; height: 100%; margin: 0;'); + iframe.src = window.location.href; + win.document.body.appendChild(iframe); + }, + blob: () => { + const win = window.open(); + if (!win) return; + window.location.replace(location); + const content = ` + + + + + + + + + + `; + const blob = new Blob([content], { type: 'text/html' }); + const url = URL.createObjectURL(blob); + win.location.href = url; + } + } + } + async *#init() { yield this.theme(this.#storageManager.getVal("theme") || "default"); } diff --git a/src/utils/types.ts b/src/utils/types.ts index 2f5caf1..9a96394 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -1,7 +1,7 @@ import type { Props } from "astro"; interface SettingsProps extends Props { - active: "appearance" | "credits" | "links" | "proxy"; + active: "appearance" | "credits" | "links" | "proxy" | "cloaking"; title: string; }