mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 08:38:50 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43ce7f9377 | ||
|
|
5a55c670fb |
2
jsr.json
2
jsr.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@nostr/tools",
|
"name": "@nostr/tools",
|
||||||
"version": "2.10.2",
|
"version": "2.10.4",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./index.ts",
|
".": "./index.ts",
|
||||||
"./core": "./core.ts",
|
"./core": "./core.ts",
|
||||||
|
|||||||
17
nip10.ts
17
nip10.ts
@@ -108,23 +108,26 @@ export function parse(event: Pick<Event, 'tags'>): {
|
|||||||
|
|
||||||
// remove root and reply from mentions, inherit relay hints from authors if any
|
// remove root and reply from mentions, inherit relay hints from authors if any
|
||||||
;[result.reply, result.root].forEach(ref => {
|
;[result.reply, result.root].forEach(ref => {
|
||||||
let idx = result.mentions.indexOf(ref!)
|
if (!ref) return
|
||||||
|
|
||||||
|
let idx = result.mentions.indexOf(ref)
|
||||||
if (idx !== -1) {
|
if (idx !== -1) {
|
||||||
result.mentions.splice(idx, 1)
|
result.mentions.splice(idx, 1)
|
||||||
}
|
}
|
||||||
if (ref!.author) {
|
if (ref.author) {
|
||||||
let author = result.profiles.find(p => p.pubkey === ref!.author)
|
let author = result.profiles.find(p => p.pubkey === ref.author)
|
||||||
if (author && author.relays) {
|
if (author && author.relays) {
|
||||||
if (!ref!.relays) {
|
if (!ref.relays) {
|
||||||
ref!.relays = []
|
ref.relays = []
|
||||||
}
|
}
|
||||||
author.relays.forEach(url => {
|
author.relays.forEach(url => {
|
||||||
if (ref?.relays!?.indexOf(url) === -1) ref!.relays!.push(url)
|
if (ref.relays!?.indexOf(url) === -1) ref.relays!.push(url)
|
||||||
})
|
})
|
||||||
author.relays = ref!.relays
|
author.relays = ref.relays
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
result.mentions.forEach(ref => {
|
result.mentions.forEach(ref => {
|
||||||
if (ref!.author) {
|
if (ref!.author) {
|
||||||
let author = result.profiles.find(p => p.pubkey === ref.author)
|
let author = result.profiles.find(p => p.pubkey === ref.author)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"name": "nostr-tools",
|
"name": "nostr-tools",
|
||||||
"version": "2.10.2",
|
"version": "2.10.4",
|
||||||
"description": "Tools for making a Nostr client.",
|
"description": "Tools for making a Nostr client.",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -234,7 +234,7 @@
|
|||||||
"@scure/bip39": "1.2.1"
|
"@scure/bip39": "1.2.1"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"nostr-wasm": "v0.1.0"
|
"nostr-wasm": "0.1.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": ">=5.0.0"
|
"typescript": ">=5.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user