feat: improve the relays used for sending replies

This commit is contained in:
codytseng
2025-02-23 23:35:56 +08:00
parent e7cb7342aa
commit e6516d7acd
4 changed files with 48 additions and 14 deletions

View File

@@ -65,7 +65,7 @@ export function getParentEventId(event?: Event) {
}
}
export function getRootEventId(event?: Event) {
export function getRootEventTag(event?: Event) {
if (!event) return undefined
let tag = event.tags.find(isRootETag)
if (!tag) {
@@ -74,6 +74,11 @@ export function getRootEventId(event?: Event) {
([tagName, tagValue]) => tagName === 'e' && !embeddedEventIds.includes(tagValue)
)
}
return tag
}
export function getRootEventId(event?: Event) {
const tag = getRootEventTag(event)
if (!tag) return undefined
try {