Fix some space joining errors

This commit is contained in:
Jon Staab
2026-06-24 11:09:44 -07:00
parent fdb4f859ee
commit 09adf33333
7 changed files with 47 additions and 33 deletions
+1 -1
View File
@@ -123,7 +123,7 @@
<div class="card2 bg-alt flex flex-col gap-4"> <div class="card2 bg-alt flex flex-col gap-4">
<p class="opacity-75">You're about to join:</p> <p class="opacity-75">You're about to join:</p>
<RelaySummary url={inviteData.url} /> <RelaySummary url={inviteData.url} />
<SpaceJoinSettings url={inviteData.url} bind:error bind:notifications /> <SpaceJoinSettings url={inviteData.url} {error} bind:notifications />
</div> </div>
</div> </div>
</div> </div>
+1 -1
View File
@@ -81,7 +81,7 @@
<Modal tag="form" onsubmit={preventDefault(join)}> <Modal tag="form" onsubmit={preventDefault(join)}>
<ModalBody> <ModalBody>
<RelaySummary {url} /> <RelaySummary {url} />
<SpaceJoinSettings {url} bind:error bind:notifications /> <SpaceJoinSettings {url} {error} bind:notifications />
</ModalBody> </ModalBody>
<ModalFooter> <ModalFooter>
<Button class="btn btn-link" onclick={back} disabled={loading}> <Button class="btn btn-link" onclick={back} disabled={loading}>
+1 -1
View File
@@ -10,7 +10,7 @@
notifications: boolean notifications: boolean
} }
let {url, error = $bindable(), notifications = $bindable()}: Props = $props() let {url, error, notifications = $bindable()}: Props = $props()
</script> </script>
<div class="card2 card2-sm bg-alt"> <div class="card2 card2-sm bg-alt">
+16 -16
View File
@@ -22,27 +22,27 @@
const title = getTagValue("title", event.tags) const title = getTagValue("title", event.tags)
</script> </script>
<Link <tr>
href={makeThreadPath(url, event.id)} <td>
class="grid grid-cols-[1fr_auto] gap-x-3 gap-y-1 border-b border-base-content/10 px-3 py-3 transition-colors hover:bg-base-200/50 sm:grid-cols-[1fr_8rem_5rem_8rem] sm:items-center sm:gap-x-4 sm:px-4"> <Link href={makeThreadPath(url, event.id)}>
<div class="col-span-2 min-w-0 sm:col-span-1"> <p class="ellipsize text-sm font-bold sm:text-base">{title || "Untitled thread"}</p>
<p class="ellipsize text-sm font-bold sm:text-base">{title || "Untitled thread"}</p> <p class="ellipsize mt-0.5 text-xs opacity-60 sm:hidden">
<p class="ellipsize mt-0.5 text-xs opacity-60 sm:hidden"> by <ProfileName pubkey={event.pubkey} {url} />
by <ProfileName pubkey={event.pubkey} {url} /> </p>
</p> </Link>
</div> </td>
<div class="hidden items-center gap-2 sm:flex"> <td>
<ProfileCircle pubkey={event.pubkey} {url} size={6} /> <ProfileCircle pubkey={event.pubkey} {url} size={6} />
<span class="ellipsize text-sm"> <span class="ellipsize text-sm">
<ProfileName pubkey={event.pubkey} {url} /> <ProfileName pubkey={event.pubkey} {url} />
</span> </span>
</div> </td>
<p class="text-right text-xs opacity-75 sm:text-center sm:text-sm"> <td>
<span class="opacity-60 sm:hidden">Replies · </span> <span class="opacity-60 sm:hidden">Replies · </span>
{replyCount} {replyCount}
</p> </td>
<p class="text-right text-xs opacity-75 sm:text-sm"> <td>
<span class="opacity-60 sm:hidden">Last · </span> <span class="opacity-60 sm:hidden">Last · </span>
{formatTimestamp(lastActive)} {formatTimestamp(lastActive)}
</p> </td>
</Link> </tr>
+1 -1
View File
@@ -99,7 +99,7 @@ export const mostlyRestrictedPolicy = (socket: Socket) => {
const pending = new Set<string>() const pending = new Set<string>()
const updateStatus = (error?: string) => { const updateStatus = (error?: string) => {
if (restricted > total / 2) { if (total > 5 && restricted > total / 2) {
if (error) { if (error) {
return relaysMostlyRestricted.update(assoc(socket.url, error)) return relaysMostlyRestricted.update(assoc(socket.url, error))
} }
+15 -5
View File
@@ -177,14 +177,24 @@ export const attemptRelayAccess = async (url: string, claim = "") => {
return `Failed to connect` return `Failed to connect`
} }
// Some relays are extra slow, remove this when welshman is updated
await poll({
signal: AbortSignal.timeout(3000),
condition: () => socket.auth.status === AuthStatus.Requested,
})
await socket.auth.attemptAuth(sign) await socket.auth.attemptAuth(sign)
// Some relays are extra slow, remove this when welshman is updated
await poll({
signal: AbortSignal.timeout(3000),
condition: () => socket.auth.status !== AuthStatus.PendingResponse,
})
if (![AuthStatus.None, AuthStatus.Ok].includes(socket.auth.status)) { if (![AuthStatus.None, AuthStatus.Ok].includes(socket.auth.status)) {
if (socket.auth.details) { const message = socket.auth.details || last(socket.auth.status.split(":"))
return `Failed to authenticate (${socket.auth.details})`
} else { return `Failed to authenticate (${message})`
return `Failed to authenticate (${last(socket.auth.status.split(":"))})`
}
} }
const error = await waitForThunkError(publishJoinRequest({url, claim})) const error = await waitForThunkError(publishJoinRequest({url, claim}))
+12 -8
View File
@@ -79,18 +79,22 @@ export const makeSpacePath = (url: string, ...extra: (string | undefined)[]) =>
return path return path
} }
export const goToSpace = async (url: string) => { export const goToSpace = (url: string) => {
const prevPath = lastPageBySpaceUrl.get(encodeRelay(url)) const prevPath = lastPageBySpaceUrl.get(encodeRelay(url))
if (prevPath && prevPath !== makeSpacePath(url)) { if (prevPath && prevPath !== makeSpacePath(url)) {
goto(prevPath, {replaceState: true}) return goto(prevPath, {replaceState: true})
} else if (!hasNip29(getRelay(url))) {
goto(makeSpaceChatPath(url), {replaceState: true})
} else if (window.matchMedia(`(min-width: ${theme.screens.md})`).matches) {
goto(makeSpacePath(url, "about"), {replaceState: true})
} else {
goto(makeSpacePath(url), {replaceState: true})
} }
if (!hasNip29(getRelay(url))) {
return goto(makeSpaceChatPath(url), {replaceState: true})
}
if (window.matchMedia(`(min-width: ${theme.screens.md})`).matches) {
return goto(makeSpacePath(url, "about"), {replaceState: true})
}
return goto(makeSpacePath(url), {replaceState: true})
} }
// Content types, events // Content types, events