fix: build

This commit is contained in:
2024-04-22 15:24:25 +01:00
parent 80a4b5d8e6
commit bfdcbca08b
20 changed files with 135 additions and 128 deletions

View File

@ -100,7 +100,7 @@ export async function subscribeToNotifications(publisher: EventPublisher) {
endpoint: sub.endpoint,
p256dh: base64.encode(new Uint8Array(unwrap(sub.getKey("p256dh")))),
auth: base64.encode(new Uint8Array(unwrap(sub.getKey("auth")))),
scope: `${location.protocol}//${location.hostname}`,
scope: `${globalThis.location.protocol}//${globalThis.location.hostname}`,
});
}
}

View File

@ -134,12 +134,12 @@ class ZapPool extends ExternalStore<Array<ZapPoolRecipient>> {
}
#save() {
self.localStorage.setItem("zap-pool", JSON.stringify(this.takeSnapshot()));
self.localStorage.setItem("zap-pool-last-payout", this.#lastPayout.toString());
globalThis.localStorage.setItem("zap-pool", JSON.stringify(this.takeSnapshot()));
globalThis.localStorage.setItem("zap-pool-last-payout", this.#lastPayout.toString());
}
#load() {
const existing = self.localStorage.getItem("zap-pool");
const existing = globalThis.localStorage.getItem("zap-pool");
if (existing) {
const arr = JSON.parse(existing) as Array<ZapPoolRecipient>;
this.#store = new Map(arr.map(a => [`${a.pubkey}-${a.type}`, a]));
@ -157,7 +157,7 @@ class ZapPool extends ExternalStore<Array<ZapPoolRecipient>> {
]);
}
const lastPayout = self.localStorage.getItem("zap-pool-last-payout");
const lastPayout = globalThis.localStorage.getItem("zap-pool-last-payout");
if (lastPayout) {
this.#lastPayout = Number(lastPayout);
}