no error on no key
All checks were successful
Rebuild signaller for deprived.dev to rebuild site / test_service (push) Successful in 19s
All checks were successful
Rebuild signaller for deprived.dev to rebuild site / test_service (push) Successful in 19s
This commit is contained in:
parent
491387e6e9
commit
ba9cf8073a
2 changed files with 9 additions and 3 deletions
|
|
@ -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() {
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue