feat: support sending 1984 reports

This commit is contained in:
codytseng
2025-09-06 00:15:54 +08:00
parent 7562ae2c77
commit 71994be407
23 changed files with 685 additions and 17 deletions

View File

@@ -432,6 +432,26 @@ export function createDeletionRequestDraftEvent(event: Event): TDraftEvent {
}
}
export function createReportDraftEvent(event: Event, reason: string): TDraftEvent {
const tags: string[][] = []
if (event.kind === kinds.Metadata) {
tags.push(['p', event.pubkey, reason])
} else {
tags.push(['p', event.pubkey])
tags.push(['e', event.id, reason])
if (isReplaceableEvent(event.kind)) {
tags.push(['a', getReplaceableCoordinateFromEvent(event), reason])
}
}
return {
kind: kinds.Report,
content: '',
tags,
created_at: dayjs().unix()
}
}
function generateImetaTags(imageUrls: string[]) {
return imageUrls
.map((imageUrl) => {