note: support republishing a note to all connected relays
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/pr/woodpecker Pipeline was successful Details

while testing duplicated relies the note with the funny replies
was only available on damus which seemed to be under heavy load.
added a republish button to be able to move the note to our relay
for testing purpose.

republishing should probably be more finetuned to be able to
publish to individual relays, but that requires relay management
first. hiding this feature for the moment.
republish
OFF0 1 year ago
parent a3de8f1595
commit 0941a26ab4
Signed by: offbyn
GPG Key ID: 94A2F643C51F37FA

@ -229,6 +229,10 @@ document.body.addEventListener('click', (e) => {
hideNewMessage(true);
return;
}
if (button && button.name === 'republish') {
republish(id);
return;
}
const username = e.target.closest('.mbox-username')
if (username) {
history.pushState({author: pubkey}, '', `/${pubkey}`);
@ -255,6 +259,18 @@ document.body.addEventListener('click', (e) => {
// }
});
function republish(id) {
const note = textNoteList.find(note => note.id === id) || replyList.find(note => note.id === id);
pool.publish(note, (status, url) => {
if (status === 0) {
console.info(`publish request sent to ${url}`);
}
if (status === 1) {
console.info(`event published by ${url}`);
}
}).catch(console.error);
}
const textNoteList = []; // could use indexDB
const eventRelayMap = {}; // eventId: [relay1, relay2]
const hasEventTag = tag => tag[0] === 'e';
@ -455,6 +471,9 @@ function createTextNote(evt, relay) {
}),
elem('small', {data: {reactions: ''}}, hasReactions ? reactionMap[evt.id].length : ''),
]),
// elem('button', {className: 'btn-inline', name: 'republish'}, [
// elem('small', {}, 'republish')
// ]),
]),
// replies[0] ? elem('div', {className: 'mobx-replies'}, replyFeed.reverse()) : '',
]);

Loading…
Cancel
Save