fix(webui): make headless login self-explanatory (#5735)

* fix(webui): guide headless login

* fix(webui): correct SSH handoff and password fallback
This commit is contained in:
chengyongru authored and GitHub committed 2026-09-13 05:01:13 +08:00
1 parent 7cede64f07
commit f8c1f2ede0
15 files changed
+265 -86

No files matched your search

+18 -3
View File
@@ -382,9 +382,20 @@ function AuthForm({
className="flex w-full max-w-sm flex-col gap-4"
>
<div className="space-y-2">
<h1 className="text-sm font-medium text-foreground">
<label htmlFor="webui-access-password">{t("app.auth.label")}</label>
<h1 className="text-lg font-semibold text-foreground">
{t("app.auth.title")}
</h1>
<p id="webui-auth-help" className="text-sm text-muted-foreground">
{t("app.auth.help")}
</p>
</div>
<div className="space-y-2">
<label
htmlFor="webui-access-password"
className="text-sm font-medium text-foreground"
>
{t("app.auth.label")}
</label>
<div className="relative">
<Input
ref={inputRef}
@@ -399,7 +410,11 @@ function AuthForm({
}}
disabled={submitting}
aria-invalid={validationError ? true : undefined}
aria-describedby={validationError ? "webui-auth-error" : undefined}
aria-describedby={
validationError
? "webui-auth-help webui-auth-error"
: "webui-auth-help"
}
className="pr-10"
autoFocus
/>
+6 -4
View File
@@ -7,15 +7,17 @@
},
"error": {
"title": "Couldn't reach nanobot",
"gatewayHint": "Make sure the gateway is running (`nanobot gateway`) and that this page is open on the same machine."
"gatewayHint": "Make sure the gateway is running (`nanobot gateway`) and this browser can reach its WebUI address."
},
"auth": {
"label": "Password",
"title": "Connect to nanobot",
"label": "WebUI password",
"help": "Find this password at channels.websocket.tokenIssueSecret in the nanobot config, usually ~/.nanobot/config.json. If that value is empty, use channels.websocket.token.",
"showPassword": "Show password",
"hidePassword": "Hide password",
"submit": "Connect",
"required": "Enter your password.",
"invalid": "Incorrect password. Try again."
"required": "Enter the WebUI password.",
"invalid": "That WebUI password wasn't accepted. Copy it from the nanobot config and try again."
},
"account": {
"section": "Account",
+6 -4
View File
@@ -7,15 +7,17 @@
},
"error": {
"title": "No se pudo conectar con nanobot",
"gatewayHint": "Asegúrate de que la gateway esté en ejecución (`nanobot gateway`) y de que esta página esté abierta en la misma máquina."
"gatewayHint": "Asegúrate de que la gateway esté en ejecución (`nanobot gateway`) y de que este navegador pueda acceder a la dirección de la WebUI."
},
"auth": {
"label": "Contraseña",
"title": "Conectar con nanobot",
"label": "Contraseña de WebUI",
"help": "Busca esta contraseña en channels.websocket.tokenIssueSecret dentro de la configuración de nanobot, normalmente ~/.nanobot/config.json. Si ese valor está vacío, usa channels.websocket.token.",
"showPassword": "Mostrar contraseña",
"hidePassword": "Ocultar contraseña",
"submit": "Conectar",
"required": "Introduce la contraseña.",
"invalid": "Contraseña incorrecta. Inténtalo de nuevo."
"required": "Introduce la contraseña de WebUI.",
"invalid": "No se aceptó esa contraseña de WebUI. Cópiala de la configuración de nanobot e inténtalo de nuevo."
},
"account": {
"section": "Cuenta",
+6 -4
View File
@@ -7,15 +7,17 @@
},
"error": {
"title": "Impossible de joindre nanobot",
"gatewayHint": "Assurez-vous que la gateway est en cours d’exécution (`nanobot gateway`) et que cette page est ouverte sur la même machine."
"gatewayHint": "Assurez-vous que la gateway est en cours d’exécution (`nanobot gateway`) et que ce navigateur peut atteindre son adresse WebUI."
},
"auth": {
"label": "Mot de passe",
"title": "Se connecter à nanobot",
"label": "Mot de passe de la WebUI",
"help": "Ce mot de passe se trouve dans channels.websocket.tokenIssueSecret dans la configuration de nanobot, généralement ~/.nanobot/config.json. Si cette valeur est vide, utilisez channels.websocket.token.",
"showPassword": "Afficher le mot de passe",
"hidePassword": "Masquer le mot de passe",
"submit": "Se connecter",
"required": "Saisissez le mot de passe.",
"invalid": "Mot de passe incorrect. Réessayez."
"required": "Saisissez le mot de passe de la WebUI.",
"invalid": "Ce mot de passe de la WebUI n’a pas été accepté. Copiez-le depuis la configuration de nanobot et réessayez."
},
"account": {
"section": "Compte",
+6 -4
View File
@@ -7,15 +7,17 @@
},
"error": {
"title": "Tidak dapat menjangkau nanobot",
"gatewayHint": "Pastikan gateway sedang berjalan (`nanobot gateway`) dan halaman ini dibuka pada mesin yang sama."
"gatewayHint": "Pastikan gateway sedang berjalan (`nanobot gateway`) dan browser ini dapat menjangkau alamat WebUI-nya."
},
"auth": {
"label": "Kata sandi",
"title": "Hubungkan ke nanobot",
"label": "Kata sandi WebUI",
"help": "Temukan kata sandi ini di channels.websocket.tokenIssueSecret dalam konfigurasi nanobot, biasanya ~/.nanobot/config.json. Jika nilainya kosong, gunakan channels.websocket.token.",
"showPassword": "Tampilkan kata sandi",
"hidePassword": "Sembunyikan kata sandi",
"submit": "Hubungkan",
"required": "Masukkan kata sandi.",
"invalid": "Kata sandi salah. Coba lagi."
"required": "Masukkan kata sandi WebUI.",
"invalid": "Kata sandi WebUI tersebut tidak diterima. Salin dari konfigurasi nanobot lalu coba lagi."
},
"account": {
"section": "Akun",
+6 -4
View File
@@ -7,15 +7,17 @@
},
"error": {
"title": "nanobot に接続できませんでした",
"gatewayHint": "gateway(`nanobot gateway`)が起動しており、このページが同じマシン上で開かれていることを確認してください。"
"gatewayHint": "gateway(`nanobot gateway`)が起動しており、このブラウザーから WebUI のアドレスに到達できることを確認してください。"
},
"auth": {
"label": "パスワード",
"title": "nanobot に接続",
"label": "WebUI パスワード",
"help": "このパスワードは nanobot の設定内の channels.websocket.tokenIssueSecret にあります。通常は ~/.nanobot/config.json です。この値が空の場合は channels.websocket.token を使用してください。",
"showPassword": "パスワードを表示",
"hidePassword": "パスワードを隠す",
"submit": "接続",
"required": "パスワードを入力してください。",
"invalid": "パスワードが正しくありません。もう一度お試しください。"
"required": "WebUI パスワードを入力してください。",
"invalid": "その WebUI パスワードは受け付けられませんでした。nanobot の設定からコピーして、もう一度お試しください。"
},
"account": {
"section": "アカウント",
+6 -4
View File
@@ -7,15 +7,17 @@
},
"error": {
"title": "nanobot에 연결할 수 없습니다",
"gatewayHint": "gateway(`nanobot gateway`)가 실행 중인지, 그리고 이 페이지가 같은 머신에서 열려 있는지 확인하세요."
"gatewayHint": "gateway(`nanobot gateway`)가 실행 중이고 이 브라우저에서 WebUI 주소에 접근할 수 있는지 확인하세요."
},
"auth": {
"label": "비밀번호",
"title": "nanobot에 연결",
"label": "WebUI 비밀번호",
"help": "이 비밀번호는 nanobot 설정의 channels.websocket.tokenIssueSecret에 있으며, 일반적으로 ~/.nanobot/config.json에 저장됩니다. 이 값이 비어 있으면 channels.websocket.token을 사용하세요.",
"showPassword": "비밀번호 표시",
"hidePassword": "비밀번호 숨기기",
"submit": "연결",
"required": "비밀번호를 입력하세요.",
"invalid": "비밀번호가 올바르지 않습니다. 다시 시도하세요."
"required": "WebUI 비밀번호를 입력하세요.",
"invalid": "해당 WebUI 비밀번호가 허용되지 않았습니다. nanobot 설정에서 복사한 후 다시 시도하세요."
},
"account": {
"section": "계정",
+6 -4
View File
@@ -7,15 +7,17 @@
},
"error": {
"title": "Não foi possível conectar-se com o nanobot",
"gatewayHint": "Verifique se o gateway está em execução (`nanobot gateway`) e se esta página está aberta na mesma máquina."
"gatewayHint": "Verifique se o gateway está em execução (`nanobot gateway`) e se este navegador consegue acessar o endereço da WebUI."
},
"auth": {
"label": "Senha",
"title": "Conectar ao nanobot",
"label": "Senha da WebUI",
"help": "Encontre esta senha em channels.websocket.tokenIssueSecret na configuração do nanobot, normalmente em ~/.nanobot/config.json. Se esse valor estiver vazio, use channels.websocket.token.",
"showPassword": "Mostrar senha",
"hidePassword": "Ocultar senha",
"submit": "Conectar",
"required": "Digite a senha.",
"invalid": "Senha incorreta. Tente novamente."
"required": "Digite a senha da WebUI.",
"invalid": "Essa senha da WebUI não foi aceita. Copie-a da configuração do nanobot e tente novamente."
},
"account": {
"section": "Conta",
+6 -4
View File
@@ -7,15 +7,17 @@
},
"error": {
"title": "Không thể kết nối tới nanobot",
"gatewayHint": "Hãy chắc chắn gateway đang chạy (`nanobot gateway`) và trang này được mở trên cùng máy."
"gatewayHint": "Hãy chắc chắn gateway đang chạy (`nanobot gateway`) và trình duyệt này có thể truy cập địa chỉ WebUI của gateway."
},
"auth": {
"label": "Mật khẩu",
"title": "Kết nối với nanobot",
"label": "Mật khẩu WebUI",
"help": "Tìm mật khẩu này tại channels.websocket.tokenIssueSecret trong cấu hình nanobot, thường là ~/.nanobot/config.json. Nếu giá trị này trống, hãy dùng channels.websocket.token.",
"showPassword": "Hiện mật khẩu",
"hidePassword": "Ẩn mật khẩu",
"submit": "Kết nối",
"required": "Nhập mật khẩu.",
"invalid": "Mật khẩu không đúng. Hãy thử lại."
"required": "Nhập mật khẩu WebUI.",
"invalid": "Mật khẩu WebUI đó không được chấp nhận. Hãy sao chép từ cấu hình nanobot rồi thử lại."
},
"account": {
"section": "Tài khoản",
+6 -4
View File
@@ -7,15 +7,17 @@
},
"error": {
"title": "无法连接到 nanobot",
"gatewayHint": "请确认网关已启动(`nanobot gateway`),并且当前页面与网关运行在同一台机器上。"
"gatewayHint": "请确认网关已启动(`nanobot gateway`),并且当前浏览器可以访问它的 WebUI 地址。"
},
"auth": {
"label": "密码",
"title": "连接到 nanobot",
"label": "WebUI 密码",
"help": "请在 nanobot 配置中的 channels.websocket.tokenIssueSecret 查找此密码,配置文件通常位于 ~/.nanobot/config.json。若该值为空,请使用 channels.websocket.token。",
"showPassword": "显示密码",
"hidePassword": "隐藏密码",
"submit": "连接",
"required": "请输入密码。",
"invalid": "密码错误,请重试。"
"required": "请输入 WebUI 密码。",
"invalid": "该 WebUI 密码未通过验证。请从 nanobot 配置中复制密码后重试。"
},
"account": {
"section": "账户",
+6 -4
View File
@@ -7,15 +7,17 @@
},
"error": {
"title": "無法連線到 nanobot",
"gatewayHint": "請確認閘道已啟動(`nanobot gateway`),並且目前頁面與閘道在同一台機器上開啟。"
"gatewayHint": "請確認閘道已啟動(`nanobot gateway`),並且目前瀏覽器可以存取它的 WebUI 位址。"
},
"auth": {
"label": "密碼",
"title": "連線到 nanobot",
"label": "WebUI 密碼",
"help": "請在 nanobot 設定中的 channels.websocket.tokenIssueSecret 尋找此密碼,設定檔通常位於 ~/.nanobot/config.json。若該值為空,請使用 channels.websocket.token。",
"showPassword": "顯示密碼",
"hidePassword": "隱藏密碼",
"submit": "連線",
"required": "請輸入密碼。",
"invalid": "密碼錯誤,請再試一次。"
"required": "請輸入 WebUI 密碼。",
"invalid": "該 WebUI 密碼未通過驗證。請從 nanobot 設定中複製密碼後再試一次。"
},
"account": {
"section": "帳戶",
+20 -12
View File
@@ -349,9 +349,14 @@ describe("App layout", () => {
render(<App />);
expect(await screen.findByRole("heading", { level: 1, name: "Password" }))
expect(await screen.findByRole("heading", { level: 1, name: "Connect to nanobot" }))
.toBeInTheDocument();
const password = screen.getByLabelText("Password");
const password = screen.getByLabelText("WebUI password");
expect(screen.getByText(/channels\.websocket\.tokenIssueSecret/))
.toBeInTheDocument();
expect(password).toHaveAccessibleDescription(
/If that value is empty, use channels\.websocket\.token\./,
);
expect(password).toHaveAttribute(
"autocomplete",
"current-password",
@@ -359,7 +364,7 @@ describe("App layout", () => {
expect(password).not.toHaveAttribute("placeholder");
expect(screen.queryByText("Authentication required")).not.toBeInTheDocument();
expect(
screen.queryByText("Incorrect password. Try again."),
screen.queryByText(/WebUI password wasn't accepted/),
).not.toBeInTheDocument();
expect(connectSpy).not.toHaveBeenCalled();
});
@@ -372,7 +377,7 @@ describe("App layout", () => {
render(<App />);
const password = await screen.findByLabelText("Password");
const password = await screen.findByLabelText("WebUI password");
await user.type(password, "correct horse battery staple");
expect(password).toHaveAttribute("type", "password");
@@ -397,16 +402,19 @@ describe("App layout", () => {
render(<App />);
const password = await screen.findByLabelText("Password");
const password = await screen.findByLabelText("WebUI password");
const connect = screen.getByRole("button", { name: "Connect" });
expect(connect).toBeEnabled();
fireEvent.click(connect);
expect(await screen.findByRole("alert")).toHaveTextContent(
"Enter your password.",
"Enter the WebUI password.",
);
expect(password).toHaveAttribute("aria-invalid", "true");
expect(password).toHaveAttribute("aria-describedby", "webui-auth-error");
expect(password).toHaveAttribute(
"aria-describedby",
"webui-auth-help webui-auth-error",
);
expect(password).toHaveFocus();
expect(fetchBootstrap).toHaveBeenCalledTimes(1);
});
@@ -420,10 +428,10 @@ describe("App layout", () => {
render(<App />);
expect(await screen.findByRole("heading", { level: 1, name: "Password" }))
expect(await screen.findByRole("heading", { level: 1, name: "Connect to nanobot" }))
.toBeInTheDocument();
expect(
screen.queryByText("Incorrect password. Try again."),
screen.queryByText(/WebUI password wasn't accepted/),
).not.toBeInTheDocument();
expect(connectSpy).not.toHaveBeenCalled();
});
@@ -435,13 +443,13 @@ describe("App layout", () => {
render(<App />);
const password = await screen.findByLabelText("Password");
const password = await screen.findByLabelText("WebUI password");
fireEvent.change(password, { target: { value: "wrong-password" } });
fireEvent.click(screen.getByRole("button", { name: "Connect" }));
const retryPassword = await screen.findByLabelText("Password");
const retryPassword = await screen.findByLabelText("WebUI password");
expect(await screen.findByRole("alert")).toHaveTextContent(
"Incorrect password. Try again.",
"That WebUI password wasn't accepted. Copy it from the nanobot config and try again.",
);
expect(retryPassword).toHaveAttribute("aria-invalid", "true");
expect(retryPassword).toHaveFocus();