Merge pull request 'Fix: No feed when nos2x-fox gives an empty relay list' (#548) from vivganes/snort:patch-547 into main
Reviewed-on: #548
This commit is contained in:
commit
48852f3099
@ -88,7 +88,7 @@ export class MultiAccountStore extends ExternalStore<LoginSession> {
|
|||||||
if (this.#accounts.has(key)) {
|
if (this.#accounts.has(key)) {
|
||||||
throw new Error("Already logged in with this pubkey");
|
throw new Error("Already logged in with this pubkey");
|
||||||
}
|
}
|
||||||
const initRelays = relays ?? Object.fromEntries(DefaultRelays.entries());
|
const initRelays = this.decideInitRelays(relays);
|
||||||
const newSession = {
|
const newSession = {
|
||||||
...LoggedOut,
|
...LoggedOut,
|
||||||
publicKey: key,
|
publicKey: key,
|
||||||
@ -105,6 +105,13 @@ export class MultiAccountStore extends ExternalStore<LoginSession> {
|
|||||||
return newSession;
|
return newSession;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
decideInitRelays(relays: Record<string, RelaySettings> | undefined): Record<string, RelaySettings> {
|
||||||
|
if (relays && Object.keys(relays).length > 0) {
|
||||||
|
return relays;
|
||||||
|
}
|
||||||
|
return Object.fromEntries(DefaultRelays.entries());
|
||||||
|
}
|
||||||
|
|
||||||
loginWithPrivateKey(key: HexKey, entropy?: string, relays?: Record<string, RelaySettings>) {
|
loginWithPrivateKey(key: HexKey, entropy?: string, relays?: Record<string, RelaySettings>) {
|
||||||
const pubKey = secp.utils.bytesToHex(secp.schnorr.getPublicKey(key));
|
const pubKey = secp.utils.bytesToHex(secp.schnorr.getPublicKey(key));
|
||||||
if (this.#accounts.has(pubKey)) {
|
if (this.#accounts.has(pubKey)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user