From 9220e8824aea6a102e091f589b5ec00cd2705725 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Fri, 2 Oct 2026 23:42:08 +0800 Subject: [PATCH] fix(mobile): pairing says what went wrong, and leaves the code alone The code field offered word suggestions over the keyboard; it is a code. A wrong, expired or unreachable code is explained with what to do next rather than the gateway's lower-case reason. --- mobile/src/main.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mobile/src/main.ts b/mobile/src/main.ts index 9ecfa17b..be758b27 100644 --- a/mobile/src/main.ts +++ b/mobile/src/main.ts @@ -937,6 +937,9 @@ function pairScreen(linked?: string) { spellcheck: false, ariaLabel: "Pairing code", }); + // A code, not words: no suggestions over the keyboard, no "fixing" it. + code.setAttribute("autocorrect", "off"); + code.setAttribute("autocomplete", "off"); const name = h("input", { class: "field-input", value: guessDeviceName(), @@ -1002,7 +1005,14 @@ function pairScreen(linked?: string) { const host = await api.pair(code.value.trim(), name.value.trim() || "phone"); hostScreen(host, "push"); } catch (e) { - error.textContent = errorText(e); + const text = errorText(e); + error.textContent = /not a tty7 pairing code/i.test(text) + ? "That isn't a pairing code. On your computer, open Settings → Mobile and click Show code." + : /used up or expired/i.test(text) + ? "That code has expired or was already used. Make a new one with New code on your computer." + : /^could not reach /i.test(text) + ? `${why(text, text.replace(/^could not reach ([^:]+):.*$/i, "$1"))} Check that tty7 is running there with phone access on.` + : sentence(text); submit.classList.remove("busy"); submit.textContent = "Pair"; submit.disabled = false;