refactor: use nostr-social-graph

This commit is contained in:
2024-09-21 23:22:21 +01:00
parent 304976d66d
commit 415e4e3705
30 changed files with 106 additions and 895 deletions

View File

@ -9,7 +9,6 @@ import {
KeyStorage,
NotEncrypted,
RelaySettings,
socialGraphInstance,
UserState,
UserStateObject,
} from "@snort/system";
@ -84,10 +83,6 @@ export class MultiAccountStore extends ExternalStore<LoginSession> {
if (!this.#activeAccount) {
this.#activeAccount = this.#accounts.keys().next().value;
}
if (this.#activeAccount) {
const pubKey = this.#accounts.get(this.#activeAccount)?.publicKey;
socialGraphInstance.setRoot(pubKey || "");
}
for (const [, v] of this.#accounts) {
// reset readonly on load
if (v.type === LoginSessionType.PrivateKey && v.readonly) {
@ -146,8 +141,6 @@ export class MultiAccountStore extends ExternalStore<LoginSession> {
switchAccount(id: string) {
if (this.#accounts.has(id)) {
this.#activeAccount = id;
const pubKey = this.#accounts.get(id)?.publicKey || "";
socialGraphInstance.setRoot(pubKey);
this.#save();
}
}
@ -172,7 +165,6 @@ export class MultiAccountStore extends ExternalStore<LoginSession> {
if (this.#accounts.has(key)) {
throw new Error("Already logged in with this pubkey");
}
socialGraphInstance.setRoot(key);
const initRelays = this.decideInitRelays(relays);
const newSession = {
...LoggedOut,
@ -224,7 +216,6 @@ export class MultiAccountStore extends ExternalStore<LoginSession> {
if (this.#accounts.has(pubKey)) {
throw new Error("Already logged in with this pubkey");
}
socialGraphInstance.setRoot(pubKey);
const initRelays = this.decideInitRelays(relays);
const newSession = {
...LoggedOut,