Fetch dvm relays in feeds
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@welshman/app",
|
"name": "@welshman/app",
|
||||||
"version": "0.2.1",
|
"version": "0.2.2",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "A collection of svelte stores for use in building nostr client applications.",
|
"description": "A collection of svelte stores for use in building nostr client applications.",
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export class RelaysStorageAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sync() {
|
sync() {
|
||||||
return throttled(3000, relays).subscribe($relays => Boolean(console.log('relays', $relays))||bulkPut(this.options.name, $relays))
|
return throttled(3000, relays).subscribe($relays => bulkPut(this.options.name, $relays))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@welshman/feeds",
|
"name": "@welshman/feeds",
|
||||||
"version": "0.2.0",
|
"version": "0.2.1",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "Utilities for building dynamic nostr feeds.",
|
"description": "Utilities for building dynamic nostr feeds.",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {partition, now, nthEq, race} from "@welshman/lib"
|
import {partition, now, nthEq, race} from "@welshman/lib"
|
||||||
import {makeEvent, Filter, getPubkeyTagValues, TrustedEvent} from "@welshman/util"
|
import {makeEvent, Filter, getPubkeyTagValues, TrustedEvent, asDecryptedEvent, readList, getRelaysFromList, RELAYS} from "@welshman/util"
|
||||||
import {Nip01Signer, ISigner} from "@welshman/signer"
|
import {Nip01Signer, ISigner} from "@welshman/signer"
|
||||||
import {Repository} from "@welshman/relay"
|
import {Repository} from "@welshman/relay"
|
||||||
import {Router, getFilterSelections, addMinimalFallbacks} from "@welshman/router"
|
import {Router, getFilterSelections, addMinimalFallbacks} from "@welshman/router"
|
||||||
@@ -82,8 +82,14 @@ export const requestDVM = async ({
|
|||||||
signer = Nip01Signer.ephemeral(),
|
signer = Nip01Signer.ephemeral(),
|
||||||
}: RequestDVMOptions) => {
|
}: RequestDVMOptions) => {
|
||||||
if (relays.length === 0) {
|
if (relays.length === 0) {
|
||||||
|
const events = await request({
|
||||||
|
autoClose: true,
|
||||||
|
filters: [{kinds: [RELAYS], authors: getPubkeyTagValues(tags)}],
|
||||||
|
relays: Router.get().Index().policy(addMinimalFallbacks).getUrls(),
|
||||||
|
})
|
||||||
|
|
||||||
relays = Router.get()
|
relays = Router.get()
|
||||||
.FromPubkeys(getPubkeyTagValues(tags))
|
.FromRelays(events.flatMap(e => getRelaysFromList(readList(asDecryptedEvent(e)))))
|
||||||
.policy(addMinimalFallbacks)
|
.policy(addMinimalFallbacks)
|
||||||
.getUrls()
|
.getUrls()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user