Tweak connection errors

This commit is contained in:
Jon Staab
2024-12-30 15:36:54 -08:00
parent 0c9109f387
commit 75bca31c14
2 changed files with 6 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
import {get} from "svelte/store" import {get} from "svelte/store"
import {ctx, sample, uniq, sleep, chunk, equals, choice} from "@welshman/lib" import {ctx, sample, uniq, sleep, chunk, equals} from "@welshman/lib"
import { import {
DELETE, DELETE,
PROFILE, PROFILE,
@@ -85,19 +85,6 @@ export const getPubkeyPetname = (pubkey: string) => {
return display return display
} }
export const makeMention = (pubkey: string, hints?: string[]) => [
"p",
pubkey,
choice(hints || getPubkeyHints(pubkey)),
getPubkeyPetname(pubkey),
]
export const makeIMeta = (url: string, data: Record<string, string>) => [
"imeta",
`url ${url}`,
...Object.entries(data).map(([k, v]) => [k, v].join(" ")),
]
export const getThunkError = async (thunk: Thunk) => { export const getThunkError = async (thunk: Thunk) => {
const result = await thunk.result const result = await thunk.result
const [{status, message}] = Object.values(result) as any const [{status, message}] = Object.values(result) as any
@@ -342,7 +329,7 @@ export const checkRelayAccess = async (url: string, claim = "") => {
const result = await thunk.result const result = await thunk.result
if (result[url].status !== PublishStatus.Success) { if (result[url].status === PublishStatus.Failure) {
const message = const message =
connection.auth.message?.replace(/^.*: /, "") || connection.auth.message?.replace(/^.*: /, "") ||
result[url].message?.replace(/^.*: /, "") || result[url].message?.replace(/^.*: /, "") ||

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import {displayRelayUrl} from "@welshman/util"
import Spinner from "@lib/components/Spinner.svelte" import Spinner from "@lib/components/Spinner.svelte"
import Button from "@lib/components/Button.svelte" import Button from "@lib/components/Button.svelte"
import Field from "@lib/components/Field.svelte" import Field from "@lib/components/Field.svelte"
@@ -47,7 +48,9 @@
<div slot="title">Access Error</div> <div slot="title">Access Error</div>
<div slot="info">We couldn't connect you to this space.</div> <div slot="info">We couldn't connect you to this space.</div>
</ModalHeader> </ModalHeader>
<p>We received an error from the relay indicating you don't have access to this space.</p> <p>
We received an error from the relay indicating you don't have access to {displayRelayUrl(url)}.
</p>
<p class="border-l border-solid border-error pl-4 text-error"> <p class="border-l border-solid border-error pl-4 text-error">
{error} {error}
</p> </p>