fix: service worker build
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Kieran 2023-10-20 13:26:43 +01:00
parent d06a914e01
commit 7b29290420
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -3,10 +3,9 @@ declare const self: ServiceWorkerGlobalScope & {
__WB_MANIFEST: (string | PrecacheEntry)[]; __WB_MANIFEST: (string | PrecacheEntry)[];
}; };
import { NostrLink, NostrPrefix, tryParseNostrLink } from "@snort/system"; import { NostrLink, NostrPrefix, TLVEntryType, encodeTLVEntries, tryParseNostrLink } from "@snort/system";
import { formatShort } from "Number"; import { formatShort } from "Number";
import { defaultAvatar, hexToBech32 } from "SnortUtils"; import { defaultAvatar, hexToBech32 } from "SnortUtils";
import { Nip4ChatSystem } from "chat/nip4";
import { clientsClaim } from "workbox-core"; import { clientsClaim } from "workbox-core";
import { PrecacheEntry, precacheAndRoute } from "workbox-precaching"; import { PrecacheEntry, precacheAndRoute } from "workbox-precaching";
@ -70,7 +69,11 @@ self.addEventListener("notificationclick", event => {
} }
} else if (ev.type == PushType.DirectMessage) { } else if (ev.type == PushType.DirectMessage) {
const reaction = ev.data as CompactReaction; const reaction = ev.data as CompactReaction;
return `/chat/${Nip4ChatSystem.makeChatId(reaction.author.pubkey)}`; return `/chat/${encodeTLVEntries("chat4" as NostrPrefix, {
type: TLVEntryType.Author,
value: reaction.author.pubkey,
length: 32,
})}`;
} }
return `/${new NostrLink(NostrPrefix.Note, id).encode()}`; return `/${new NostrLink(NostrPrefix.Note, id).encode()}`;
}; };