This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import {BLOSSOM_SERVERS, asDecryptedEvent, readList} from "@welshman/util"
|
||||
import type {TrustedEvent} from "@welshman/util"
|
||||
import {DerivedPlugin} from "./base.js"
|
||||
import {Network} from "./network.js"
|
||||
import type {IApp} from "../app.js"
|
||||
|
||||
/**
|
||||
* Blossom server lists (kind 10063), keyed by pubkey. Loaded via the outbox
|
||||
* model (the author's write relays), so it depends on the relay-list collection.
|
||||
*/
|
||||
export class BlossomServerLists extends DerivedPlugin<ReturnType<typeof readList>> {
|
||||
constructor(app: IApp) {
|
||||
super(app, {
|
||||
filters: [{kinds: [BLOSSOM_SERVERS]}],
|
||||
eventToItem: (event: TrustedEvent) => readList(asDecryptedEvent(event)),
|
||||
getKey: list => list.event.pubkey,
|
||||
})
|
||||
}
|
||||
|
||||
fetch(pubkey: string, relayHints: string[] = []) {
|
||||
return this.app.use(Network).loadUsingOutbox(pubkey, {kinds: [BLOSSOM_SERVERS]}, relayHints)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user