fix: add control UI auth guidance

This commit is contained in:
Peter Steinberger
2026-01-16 09:01:45 +00:00
parent 1791c1a765
commit 6c6bc6ff1c
2 changed files with 49 additions and 1 deletions

View File

@@ -31,6 +31,52 @@ export function renderOverview(props: OverviewProps) {
const tick = snapshot?.policy?.tickIntervalMs
? `${snapshot.policy.tickIntervalMs}ms`
: "n/a";
const authHint = (() => {
if (props.connected || !props.lastError) return null;
const lower = props.lastError.toLowerCase();
const authFailed = lower.includes("unauthorized") || lower.includes("connect failed");
if (!authFailed) return null;
const hasToken = Boolean(props.settings.token.trim());
const hasPassword = Boolean(props.password.trim());
if (!hasToken && !hasPassword) {
return html`
<div class="muted" style="margin-top: 8px;">
This gateway requires auth. Add a token or password, then click Connect.
<div style="margin-top: 6px;">
<span class="mono">clawdbot dashboard --no-open</span> → tokenized URL<br />
<span class="mono">clawdbot doctor --generate-gateway-token</span> → set token
</div>
<div style="margin-top: 6px;">
<a
class="session-link"
href="https://docs.clawd.bot/web/dashboard"
target="_blank"
rel="noreferrer"
title="Control UI auth docs (opens in new tab)"
>Docs: Control UI auth</a
>
</div>
</div>
`;
}
return html`
<div class="muted" style="margin-top: 8px;">
Auth failed. Re-copy a tokenized URL with
<span class="mono">clawdbot dashboard --no-open</span>, or update the token,
then click Connect.
<div style="margin-top: 6px;">
<a
class="session-link"
href="https://docs.clawd.bot/web/dashboard"
target="_blank"
rel="noreferrer"
title="Control UI auth docs (opens in new tab)"
>Docs: Control UI auth</a
>
</div>
</div>
`;
})();
return html`
<section class="grid grid-cols-2">
@@ -119,7 +165,8 @@ export function renderOverview(props: OverviewProps) {
</div>
${props.lastError
? html`<div class="callout danger" style="margin-top: 14px;">
${props.lastError}
<div>${props.lastError}</div>
${authHint ?? ""}
</div>`
: html`<div class="callout" style="margin-top: 14px;">
Use Connections to link WhatsApp, Telegram, Discord, Signal, or iMessage.