Auto register client plugins
This commit is contained in:
@@ -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) =>
|
||||
|
||||
Reference in New Issue
Block a user