forked from Kieran/snort
fix: open note1 links from notification
This commit is contained in:
parent
fd746440b6
commit
2dd84bd280
@ -66,19 +66,13 @@ self.addEventListener("notificationclick", event => {
|
|||||||
if (ev.type === PushType.Zap || ev.type === PushType.Reaction) {
|
if (ev.type === PushType.Zap || ev.type === PushType.Reaction) {
|
||||||
const mention = ev.data as CompactReaction;
|
const mention = ev.data as CompactReaction;
|
||||||
if (mention.event) {
|
if (mention.event) {
|
||||||
return `/${new NostrLink(
|
return `/${new NostrLink(NostrPrefix.Note, mention.event).encode()}`;
|
||||||
NostrPrefix.Event,
|
|
||||||
mention.event,
|
|
||||||
undefined,
|
|
||||||
mention.author.pubkey,
|
|
||||||
undefined,
|
|
||||||
).encode()}`;
|
|
||||||
}
|
}
|
||||||
} 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/${Nip4ChatSystem.makeChatId(reaction.author.pubkey)}`;
|
||||||
}
|
}
|
||||||
return `/${id}`;
|
return `/${new NostrLink(NostrPrefix.Note, id).encode()}`;
|
||||||
};
|
};
|
||||||
for (const client of windows) {
|
for (const client of windows) {
|
||||||
if (client.url === url() && "focus" in client) return client.focus();
|
if (client.url === url() && "focus" in client) return client.focus();
|
||||||
@ -179,7 +173,7 @@ function makeNotification(n: PushNotification) {
|
|||||||
icon: evx.author.avatar ?? defaultAvatar(evx.author.pubkey),
|
icon: evx.author.avatar ?? defaultAvatar(evx.author.pubkey),
|
||||||
badge: CONFIG.appleTouchIconUrl,
|
badge: CONFIG.appleTouchIconUrl,
|
||||||
timestamp: evx.created_at * 1000,
|
timestamp: evx.created_at * 1000,
|
||||||
tag: new NostrLink(NostrPrefix.Event, evx.id, undefined, evx.author.pubkey, undefined).encode(),
|
tag: evx.id,
|
||||||
data: JSON.stringify(n),
|
data: JSON.stringify(n),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user