improve parent hints
This commit is contained in:
@@ -25,6 +25,9 @@ export const asUnsignedEvent = ({kind, tags, content, created_at, pubkey}: Unsig
|
||||
export const asRumor = ({kind, tags, content, created_at, pubkey, id}: Rumor): Rumor =>
|
||||
({kind, tags, content, created_at, pubkey, id})
|
||||
|
||||
export const asEvent = ({kind, tags, content, created_at, pubkey, id, sig}: Event): Event =>
|
||||
({kind, tags, content, created_at, pubkey, id, sig})
|
||||
|
||||
export const hasValidSignature = cached<string, boolean, [Event]>({
|
||||
maxSize: 10000,
|
||||
getKey: ([e]: [Event]) => {
|
||||
|
||||
@@ -122,6 +122,7 @@ export class Router {
|
||||
|
||||
return this.scenario([
|
||||
tags.replies().relays().valueOf(),
|
||||
tags.roots().relays().valueOf(),
|
||||
...this.getContextRelayGroups(event),
|
||||
...tags.whereKey("p").values().valueOf()
|
||||
.map(pk => this.options.getPubkeyRelays(pk, RelayMode.Outbox)),
|
||||
@@ -135,6 +136,7 @@ export class Router {
|
||||
|
||||
return this.scenario([
|
||||
tags.roots().relays().valueOf(),
|
||||
tags.replies().relays().valueOf(),
|
||||
...this.getContextRelayGroups(event),
|
||||
...tags.whereKey("p").values().valueOf()
|
||||
.map(pk => this.options.getPubkeyRelays(pk, RelayMode.Outbox)),
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ import {EventTemplate} from 'nostr-tools'
|
||||
import {Fluent} from './Fluent'
|
||||
import type {OmitStatics} from './Tools'
|
||||
import {last} from './Tools'
|
||||
import {isShareableRelayUrl} from './Relays'
|
||||
import {isShareableRelayUrl, normalizeRelayUrl} from './Relays'
|
||||
import type {Address} from './Address'
|
||||
import {encodeAddress, decodeAddress} from './Address'
|
||||
import {GROUP_DEFINITION, COMMUNITY_DEFINITION} from './Kinds'
|
||||
@@ -79,7 +79,7 @@ export class Tags extends (Fluent<Tag> as OmitStatics<typeof Fluent<Tag>, 'from'
|
||||
|
||||
entries = () => this.mapTo(t => t.entry())
|
||||
|
||||
relays = () => this.flatMap((t: Tag) => t.valueOf().filter(isShareableRelayUrl)).uniq()
|
||||
relays = () => this.flatMap((t: Tag) => t.valueOf().filter(isShareableRelayUrl).map(normalizeRelayUrl)).uniq()
|
||||
|
||||
topics = () => this.whereKey("t").values().map((t: string) => t.replace(/^#/, ""))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user