feat: support for generic repost

This commit is contained in:
codytseng 2025-11-20 13:34:05 +08:00
parent 14b3fbd496
commit a40d7b0676
11 changed files with 92 additions and 68 deletions

View file

@ -118,12 +118,22 @@ export function createRepostDraftEvent(event: Event): TDraftEvent {
const isProtected = isProtectedEvent(event)
const tags = [buildETag(event.id, event.pubkey), buildPTag(event.pubkey)]
if (event.kind === kinds.ShortTextNote) {
return {
kind: kinds.Repost,
content: isProtected ? '' : JSON.stringify(event),
tags,
created_at: dayjs().unix()
}
}
tags.push(buildKTag(event.kind))
if (isReplaceableEvent(event.kind)) {
tags.push(buildATag(event))
}
return {
kind: kinds.Repost,
kind: kinds.GenericRepost,
content: isProtected ? '' : JSON.stringify(event),
tags,
created_at: dayjs().unix()