Auto register client plugins

This commit is contained in:
Jon Staab
2026-06-16 10:32:59 -07:00
parent ea9cc0bf26
commit 96b0116c9b
31 changed files with 505 additions and 726 deletions
+5 -8
View File
@@ -1,18 +1,15 @@
import {derived, readable} from "svelte/store"
import {readProfile, displayProfile, displayPubkey, PROFILE} from "@welshman/util"
import {RepositoryCollection} from "./repositoryCollection.js"
import type {ClientContext} from "./client.js"
import type {RelayLists} from "./relayLists.js"
import {RelayLists} from "./relayLists.js"
import type {IClient} from "./client.js"
/**
* Kind-0 profiles, keyed by pubkey. Loaded via the outbox model (the author's
* write relays), so it depends on the relay-list collection.
* write relays), resolved through the relay-list collection at fetch time.
*/
export class Profiles extends RepositoryCollection<ReturnType<typeof readProfile>> {
constructor(
ctx: ClientContext,
readonly relayLists: RelayLists,
) {
constructor(ctx: IClient) {
super(ctx, {
filters: [{kinds: [PROFILE]}],
eventToItem: readProfile,
@@ -21,7 +18,7 @@ export class Profiles extends RepositoryCollection<ReturnType<typeof readProfile
}
fetch(pubkey: string, relayHints: string[] = []) {
return this.relayLists.makeOutboxLoader(PROFILE)(pubkey, relayHints)
return this.ctx.use(RelayLists).makeOutboxLoader(PROFILE)(pubkey, relayHints)
}
display = (pubkey: string | undefined) =>