feat: support sending only to current relays

This commit is contained in:
codytseng
2025-02-05 15:18:58 +08:00
parent 29f5ccc4bb
commit ccf8c21954
11 changed files with 199 additions and 75 deletions

View File

@@ -51,6 +51,7 @@ export async function createShortTextNoteDraftEvent(
options: {
parentEvent?: Event
addClientTag?: boolean
protectedEvent?: boolean
} = {}
): Promise<TDraftEvent> {
const { pubkeys, otherRelatedEventIds, quoteEventIds, rootEventId, parentEventId } =
@@ -80,6 +81,10 @@ export async function createShortTextNoteDraftEvent(
tags.push(['client', 'jumble'])
}
if (options.protectedEvent) {
tags.push(['-'])
}
return {
kind: kinds.ShortTextNote,
content,
@@ -107,6 +112,7 @@ export async function createPictureNoteDraftEvent(
pictureInfos: { url: string; tags: string[][] }[],
options: {
addClientTag?: boolean
protectedEvent?: boolean
} = {}
): Promise<TDraftEvent> {
const { pubkeys, quoteEventIds } = await extractMentions(content)
@@ -125,6 +131,10 @@ export async function createPictureNoteDraftEvent(
tags.push(['client', 'jumble'])
}
if (options.protectedEvent) {
tags.push(['-'])
}
return {
kind: PICTURE_EVENT_KIND,
content,
@@ -139,6 +149,7 @@ export async function createCommentDraftEvent(
pictureInfos: { url: string; tags: string[][] }[],
options: {
addClientTag?: boolean
protectedEvent?: boolean
} = {}
): Promise<TDraftEvent> {
const {
@@ -174,6 +185,10 @@ export async function createCommentDraftEvent(
tags.push(['client', 'jumble'])
}
if (options.protectedEvent) {
tags.push(['-'])
}
return {
kind: COMMENT_EVENT_KIND,
content,