no error on no key
All checks were successful
Rebuild signaller for deprived.dev to rebuild site / test_service (push) Successful in 19s

This commit is contained in:
BOTAlex 2025-10-09 06:39:00 +02:00
parent 491387e6e9
commit ba9cf8073a
2 changed files with 9 additions and 3 deletions

View file

@ -5,6 +5,7 @@ import type { Readable, Subscriber, Unsubscriber } from "svelte/store";
class Redactor implements Readable<Profile | undefined> {
public unredactedProfile: Profile | undefined = undefined;
public wrongKey: boolean | undefined = undefined;
private subs = new Set<Subscriber<Profile | undefined>>();
subscribe(run: Subscriber<Profile | undefined>): Unsubscriber {
@ -16,7 +17,7 @@ class Redactor implements Readable<Profile | undefined> {
this.subs.forEach((s) => s(this.unredactedProfile));
}
async TryGetUnredacter(): Promise<Profile> {
async TryGetUnredacter(): Promise<Profile | string> {
if (this.unredactedProfile) return this.unredactedProfile;
const storedKey = localStorage.getItem("key");
@ -32,6 +33,11 @@ class Redactor implements Readable<Profile | undefined> {
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<Profile | undefined> {
);
this.unredactedProfile = parseProfile(replaced.json);
this.notify(); // <-- tell Svelte to update
return this.unredactedProfile;
return "success";
}
t(path: string, fallback: string): string {