Files
welshman/packages/app/src/plugins/blossom.ts
T
Jon Staab e2a6ef21cd
tests / tests (push) Failing after 5m14s
Refine domain, integrate into app
2026-06-19 22:21:06 -07:00

24 lines
812 B
TypeScript

import {BLOSSOM_SERVERS} from "@welshman/util"
import {BlossomServerList} from "@welshman/domain"
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<BlossomServerList> {
constructor(app: IApp) {
super(app, {
filters: [{kinds: [BLOSSOM_SERVERS]}],
eventToItem: BlossomServerList.factory(app.user?.signer),
getKey: list => list.author(),
})
}
fetch(pubkey: string, relayHints: string[] = []) {
return this.app.use(Network).loadUsingOutbox(pubkey, {kinds: [BLOSSOM_SERVERS]}, relayHints)
}
}