Skip to content

Commit

Permalink
Refactor connections
Browse files Browse the repository at this point in the history
  • Loading branch information
SnowCait committed Oct 14, 2023
1 parent 93d05a7 commit 7e8039d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
7 changes: 6 additions & 1 deletion web/src/routes/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ import { browser } from '$app/environment';
import { Login } from '$lib/Login';
import { WebStorage } from '$lib/WebStorage';
import '$lib/i18n';
import { rxNostr } from '$lib/timelines/MainTimeline';
import { defaultRelays } from '$lib/Constants';

export const load = async () => {
console.log('[layout load]');
if (browser) {
locale.set(window.navigator.language);
await tryLogin();
const success = await tryLogin();
if (!success) {
await rxNostr.switchRelays(defaultRelays);
}
}
await waitLocale();
};
Expand Down
4 changes: 0 additions & 4 deletions web/src/routes/[npub=npub]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@
return;
}
if (rxNostr.getRelays().length === 0) {
await rxNostr.switchRelays(relays);
}
let firstLength = events.length;
let count = 0;
let until =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@
return;
}
if (rxNostr.getRelays().length === 0) {
await rxNostr.switchRelays($readRelays);
}
let firstLength = $items.length;
let count = 0;
let until =
Expand Down
4 changes: 0 additions & 4 deletions web/src/routes/[slug=note]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@
clear();
if (rxNostr.getRelays().length === 0) {
await rxNostr.switchRelays($readRelays);
}
for (const relay of relays) {
await rxNostr.addRelay({ url: relay, read: true, write: false });
}
Expand Down

0 comments on commit 7e8039d

Please sign in to comment.