This commit is contained in:
reya 2023-11-15 10:27:47 +07:00
parent b6caab15e1
commit 025d7a623b
2 changed files with 7 additions and 1 deletions

View File

@ -165,7 +165,7 @@ export function ImportAccountScreen() {
> >
<h5 className="mb-1.5 font-semibold">Account found</h5> <h5 className="mb-1.5 font-semibold">Account found</h5>
<div className="flex w-full flex-col gap-2"> <div className="flex w-full flex-col gap-2">
<div className="flex h-full w-full items-center justify-between rounded-lg bg-neutral-200 p-2"> <div className="flex h-full w-full items-center justify-between rounded-lg bg-neutral-200 p-2 dark:bg-neutral-800">
<User pubkey={pubkey} variant="simple" /> <User pubkey={pubkey} variant="simple" />
<button <button
type="button" type="button"

View File

@ -26,6 +26,9 @@ export const NDKInstance = () => {
const relays = await db.getExplicitRelayUrls(); const relays = await db.getExplicitRelayUrls();
const onlineRelays = new Set(relays); const onlineRelays = new Set(relays);
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 8000);
for (const relay of relays) { for (const relay of relays) {
try { try {
const url = new URL(relay); const url = new URL(relay);
@ -34,6 +37,7 @@ export const NDKInstance = () => {
headers: { headers: {
Accept: 'application/nostr+json', Accept: 'application/nostr+json',
}, },
signal: controller.signal,
}); });
if (!res.ok) { if (!res.ok) {
@ -45,6 +49,8 @@ export const NDKInstance = () => {
} catch { } catch {
toast.warning(`${relay} is not working, skipping...`); toast.warning(`${relay} is not working, skipping...`);
onlineRelays.delete(relay); onlineRelays.delete(relay);
} finally {
clearTimeout(timeoutId);
} }
} }