Sharing works again.

This commit is contained in:
Thomas Mathews 2022-12-27 22:12:53 -08:00
parent cc9b614c07
commit 281de7de24
7 changed files with 73 additions and 61 deletions

View file

@ -61,6 +61,24 @@ function broadcast_event(ev) {
DAMUS.pool.send(["EVENT", ev])
}
async function share(evid) {
const model = DAMUS;
const e = model.all_events[evid];
if (!e)
return;
let ev = {
kind: KIND_SHARE,
created_at: new_creation_time(),
pubkey: model.pubkey,
content: JSON.stringify(e),
tags: [["e", e.id], ["p", e.pubkey]],
}
ev.id = await nostrjs.calculate_id(ev);
ev = await sign_event(ev);
broadcast_event(ev);
return ev;
}
async function update_profile(profile={}) {
let ev = {
kind: KIND_METADATA,