redacted my info, into my database #1

Merged
botalex merged 21 commits from dev into main 2025-10-09 06:42:05 +02:00
2 changed files with 9 additions and 3 deletions
Showing only changes of commit ba9cf8073a - Show all commits

View file

@ -47,7 +47,7 @@
lock.name = "darkreader-lock"; lock.name = "darkreader-lock";
document.head.appendChild(lock); document.head.appendChild(lock);
console.log(await re.TryGetUnredacter()); await re.TryGetUnredacter();
}); });
function nextTheme() { function nextTheme() {

View file

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