Allow relay requests through, fix positional e/a replies when mixed with q tags
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "paravel",
|
||||
"version": "0.5.4",
|
||||
"version": "0.5.5",
|
||||
"description": "Yet another toolkit for nostr",
|
||||
"author": "hodlbod",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -14,12 +14,17 @@ class SendQueue extends Queue {
|
||||
return false
|
||||
}
|
||||
|
||||
const [verb] = asMessage(message)
|
||||
const [verb, ...extra] = asMessage(message)
|
||||
|
||||
if (['AUTH', 'CLOSE'].includes(verb)) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Allow relay requests through
|
||||
if (verb === 'EVENT' && extra[0].kind === 28934) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Only defer for auth if we're not multiplexing
|
||||
if (isMessage(message) && ![AuthStatus.Ok, AuthStatus.Pending].includes(this.cxn.meta.authStatus)) {
|
||||
return false
|
||||
|
||||
+8
-5
@@ -85,15 +85,15 @@ export class Tags extends (Fluent<Tag> as OmitStatics<typeof Fluent<Tag>, 'from'
|
||||
|
||||
ancestors = () => {
|
||||
const tags = this.filter(t => ["a", "e", "q"].includes(t.key()) && !t.isContext())
|
||||
const parentTags = tags.filter(t => ["a", "e"].includes(t.key()))
|
||||
const mentionTags = tags.whereKey("q")
|
||||
const roots: string[][] = []
|
||||
const replies: string[][] = []
|
||||
const mentions: string[][] = []
|
||||
|
||||
tags
|
||||
parentTags
|
||||
.forEach((t: Tag, i: number) => {
|
||||
if (t.key() === "q") {
|
||||
mentions.push(t.valueOf())
|
||||
} else if (t.mark() === 'root') {
|
||||
if (t.mark() === 'root') {
|
||||
roots.push(t.valueOf())
|
||||
} else if (t.mark() === 'reply') {
|
||||
replies.push(t.valueOf())
|
||||
@@ -101,13 +101,16 @@ export class Tags extends (Fluent<Tag> as OmitStatics<typeof Fluent<Tag>, 'from'
|
||||
mentions.push(t.valueOf())
|
||||
} else if (i === 0) {
|
||||
roots.push(t.valueOf())
|
||||
} else if (i === tags.count() - 1) {
|
||||
} else if (i === parentTags.count() - 1) {
|
||||
replies.push(t.valueOf())
|
||||
} else {
|
||||
mentions.push(t.valueOf())
|
||||
}
|
||||
})
|
||||
|
||||
// Add quotes as mentions separately so positional logic above works
|
||||
mentionTags.forEach((t: Tag) => mentions.push(t.valueOf()))
|
||||
|
||||
return {
|
||||
roots: Tags.from(roots),
|
||||
replies: Tags.from(replies),
|
||||
|
||||
Reference in New Issue
Block a user