diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/features/messages.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/features/messages.js b/src/features/messages.js index 03fabee..5ec55c7 100644 --- a/src/features/messages.js +++ b/src/features/messages.js @@ -11822,8 +11822,18 @@ export function messagesFeature(ctx) { if (iBoosted(ev.id)) { toast(t('postBoostedAlready')); return; } const id = await requireIdentity(); const relays = await noteRelaysFor(ev); + // The copy inside must carry its author's signature, or every client + // that checks it (this one too) throws the boost away. A post painted + // from the saved feed was stored without one: fetch it whole first. + let whole = ev.sig && verifyEvent({ ...ev }) ? ev : null; + if (!whole) { + const got = await queryOn([...new Set([...relays, ...NOTE_RELAYS])], { ids: [ev.id] }, 4000).catch(() => []); + whole = got.find((e) => e.id === ev.id && e.sig && verifyEvent(e)) || null; + } + if (!whole) { toast(t('msgSendFailed')); return; } + whole = { id: whole.id, pubkey: whole.pubkey, created_at: whole.created_at, kind: whole.kind, tags: whole.tags, content: whole.content, sig: whole.sig }; const partial = { - kind: 6, content: JSON.stringify(ev), created_at: Math.floor(Date.now() / 1000), + kind: 6, content: JSON.stringify(whole), created_at: Math.floor(Date.now() / 1000), tags: [['e', ev.id, relays[0] || '', 'mention'], ['p', ev.pubkey], CLIENT_TAG], }; const evt = id.signer instanceof Uint8Array ? finalizeEvent(partial, id.signer) : await id.signer.signEvent(partial); |
