fix: follow graph / readonly login

This commit is contained in:
2024-05-01 10:34:28 +01:00
parent 778ce1a24f
commit 6398e470ef
11 changed files with 36 additions and 24 deletions

View File

@ -94,7 +94,7 @@ export class UserState<TAppData> extends EventEmitter<UserStateEvents> {
this.#relays.on("change", () => this.emit("change", UserStateChangeType.Relays));
}
async init(signer: EventSigner, system: SystemInterface) {
async init(signer: EventSigner | undefined, system: SystemInterface) {
if (this.#didInit) {
return;
}
@ -124,7 +124,7 @@ export class UserState<TAppData> extends EventEmitter<UserStateEvents> {
);
// update relay metadata with value from contact list if not found
if (this.#relays.value === undefined && this.#contacts.value?.content !== undefined) {
if (this.#relays.value === undefined && this.#contacts.value?.content !== undefined && signer) {
this.#log("Saving relays to NIP-65 relay list using %O", this.relays);
for (const r of this.relays ?? []) {
await this.addRelay(r.url, r.settings, false);
@ -135,7 +135,7 @@ export class UserState<TAppData> extends EventEmitter<UserStateEvents> {
// migrate mutes into blocks
const muteList = this.#standardLists.get(EventKind.MuteList);
if (muteList && muteList.tags.length > 0) {
if (muteList && muteList.tags.length > 0 && signer) {
this.#log("Migrating mutes into blocks mutes=%i, blocks=%i", muteList.tags.length, muteList.encryptedTags.length);
muteList.replace([], false);
muteList.add(muteList!.tags, true);