diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 7b37f0e..efee0f4 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -47,7 +47,7 @@ lock.name = "darkreader-lock"; document.head.appendChild(lock); - console.log(await re.TryGetUnredacter()); + await re.TryGetUnredacter(); }); function nextTheme() { diff --git a/src/ts/Redaction/Redactor.ts b/src/ts/Redaction/Redactor.ts index 978bc41..2a2aa8b 100644 --- a/src/ts/Redaction/Redactor.ts +++ b/src/ts/Redaction/Redactor.ts @@ -5,6 +5,7 @@ import type { Readable, Subscriber, Unsubscriber } from "svelte/store"; class Redactor implements Readable { public unredactedProfile: Profile | undefined = undefined; + public wrongKey: boolean | undefined = undefined; private subs = new Set>(); subscribe(run: Subscriber): Unsubscriber { @@ -16,7 +17,7 @@ class Redactor implements Readable { this.subs.forEach((s) => s(this.unredactedProfile)); } - async TryGetUnredacter(): Promise { + async TryGetUnredacter(): Promise { if (this.unredactedProfile) return this.unredactedProfile; const storedKey = localStorage.getItem("key"); @@ -32,6 +33,11 @@ class Redactor implements Readable { const unredactHash = hashResJson.response; initEnv(); + if (unredactHash == "nawh") { + console.log("Wrong key, keeping info about alex secret"); + return "Wrong key"; + } + const url = `${env.POCKETBASE_URL}/api/collections/redacted_content/records/${unredactHash}`; const res = await fetch(url, { @@ -46,7 +52,7 @@ class Redactor implements Readable { ); this.unredactedProfile = parseProfile(replaced.json); this.notify(); // <-- tell Svelte to update - return this.unredactedProfile; + return "success"; } t(path: string, fallback: string): string {