Improve claim/access detection

This commit is contained in:
Jon Staab
2025-11-04 15:36:20 -08:00
parent fe626218ea
commit 6429f82829
4 changed files with 47 additions and 28 deletions
+7 -6
View File
@@ -107,6 +107,7 @@ import {
getSetting,
userInboxRelays,
userGroupSelections,
shouldIgnoreError,
} from "@app/core/state"
import {loadAlertStatuses} from "@app/core/requests"
import {platform, platformName, getPushInfo} from "@app/util/push"
@@ -288,14 +289,14 @@ export const attemptRelayAccess = async (url: string, claim = "") => {
const thunk = publishJoinRequest({url, claim})
const error = await waitForThunkError(thunk)
// Ignore messages about the relay ignoring our messages
if (error?.startsWith("mute: ")) return
if (shouldIgnoreError(error)) return
// If it's a strict NIP 29 relay don't worry about requesting access
// TODO: remove this if relay29 ever gets less strict
if (error?.includes("missing group (`h`) tag")) return
if (claim) {
const ignoreClaimError =
error.includes("invalid invite code size") || error.includes("failed to validate invite code")
return claim ? error?.replace(/^\w+: /, "") : ""
if (!ignoreClaimError) return error?.replace(/^\w+: /, "")
}
}
// Deletions