This commit is contained in:
parent
588c3756fd
commit
3c2bfbb4c6
@ -20,6 +20,6 @@
|
|||||||
"defaultRelays": {
|
"defaultRelays": {
|
||||||
"wss://relay.snort.social/": { "read": true, "write": true },
|
"wss://relay.snort.social/": { "read": true, "write": true },
|
||||||
"wss://nostr.wine/": { "read": true, "write": false },
|
"wss://nostr.wine/": { "read": true, "write": false },
|
||||||
"wss://nos.lol/": { "read": true, "write": true }
|
"wss://eden.nostr.land/": { "read": true, "write": false }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,6 @@
|
|||||||
"defaultRelays": {
|
"defaultRelays": {
|
||||||
"wss://relay.snort.social/": { "read": true, "write": true },
|
"wss://relay.snort.social/": { "read": true, "write": true },
|
||||||
"wss://nostr.wine/": { "read": true, "write": false },
|
"wss://nostr.wine/": { "read": true, "write": false },
|
||||||
"wss://nos.lol/": { "read": true, "write": true }
|
"wss://eden.nostr.land/": { "read": true, "write": false }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import { unixNowMs } from "@snort/shared";
|
|||||||
import * as secp from "@noble/curves/secp256k1";
|
import * as secp from "@noble/curves/secp256k1";
|
||||||
import * as utils from "@noble/curves/abstract/utils";
|
import * as utils from "@noble/curves/abstract/utils";
|
||||||
|
|
||||||
import { DefaultRelays, SnortPubKey } from "Const";
|
import { SnortPubKey } from "Const";
|
||||||
import { LoginStore, UserPreferences, LoginSession, LoginSessionType, SnortAppData, Newest } from "Login";
|
import { LoginStore, UserPreferences, LoginSession, LoginSessionType, SnortAppData, Newest } from "Login";
|
||||||
import { generateBip39Entropy, entropyToPrivateKey } from "nip6";
|
import { generateBip39Entropy, entropyToPrivateKey } from "nip6";
|
||||||
import { bech32ToHex, dedupeById, getCountry, sanitizeRelayUrl, unwrap } from "SnortUtils";
|
import { bech32ToHex, dedupeById, getCountry, sanitizeRelayUrl, unwrap } from "SnortUtils";
|
||||||
@ -93,13 +93,13 @@ export async function generateNewLogin(
|
|||||||
const ent = generateBip39Entropy();
|
const ent = generateBip39Entropy();
|
||||||
const entropy = utils.bytesToHex(ent);
|
const entropy = utils.bytesToHex(ent);
|
||||||
const privateKey = entropyToPrivateKey(ent);
|
const privateKey = entropyToPrivateKey(ent);
|
||||||
const newRelays = Object.fromEntries(DefaultRelays.entries());
|
const newRelays = {} as Record<string, RelaySettings>;
|
||||||
|
|
||||||
// Use current timezone info to determine approx location
|
// Use current timezone info to determine approx location
|
||||||
// use closest 5 relays
|
// use closest 5 relays
|
||||||
const country = getCountry();
|
const country = getCountry();
|
||||||
const api = new SnortApi();
|
const api = new SnortApi();
|
||||||
const closeRelays = await api.closeRelays(country.lat, country.lon, 10);
|
const closeRelays = await api.closeRelays(country.lat, country.lon, 20);
|
||||||
for (const cr of closeRelays.sort((a, b) => (a.distance > b.distance ? 1 : -1)).filter(a => !a.is_paid)) {
|
for (const cr of closeRelays.sort((a, b) => (a.distance > b.distance ? 1 : -1)).filter(a => !a.is_paid)) {
|
||||||
const rr = sanitizeRelayUrl(cr.url);
|
const rr = sanitizeRelayUrl(cr.url);
|
||||||
if (rr) {
|
if (rr) {
|
||||||
|
Loading…
Reference in New Issue
Block a user