Feat/desktop passwordless auth - #160
Merged
Merged
Conversation
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- RouteErrorPage currently hardcodes English strings and bypasses the i18n system; consider wiring it into the existing translation keys so error messaging is localized and consistent with the rest of the dashboard.
- DesktopAuthGate swallows the desktop auth failure reason and displays only a generic error; you could surface
response.reason(or a mapped translation key) to help users diagnose why passwordless desktop auth failed before retrying.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- RouteErrorPage currently hardcodes English strings and bypasses the i18n system; consider wiring it into the existing translation keys so error messaging is localized and consistent with the rest of the dashboard.
- DesktopAuthGate swallows the desktop auth failure reason and displays only a generic error; you could surface `response.reason` (or a mapped translation key) to help users diagnose why passwordless desktop auth failed before retrying.
## Individual Comments
### Comment 1
<location path="dashboard/src/desktop/DesktopAuthGate.tsx" line_range="18" />
<code_context>
- const setReturnUrl = useAuthStore((state) => state.setReturnUrl);
- const returnUrl = `${location.pathname}${location.search}${location.hash}`;
-
- useEffect(() => {
- if (!hasToken) setReturnUrl(returnUrl);
- }, [hasToken, returnUrl, setReturnUrl]);
</code_context>
<issue_to_address>
**suggestion:** Desktop auth failures are surfaced as a generic error without diagnostic detail.
In the current effect, any `bridge.getAuthSession()` failure (non-OK response or missing token/username) is reduced to `status = 'error'`, and the UI only shows `desktopAuthFailed` with a retry. Consider logging `response.reason` or the thrown error to `console.error` (or a central logger) before handling it, so desktop bridge or JWT issues can be diagnosed without additional instrumentation later.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| const [attempt, setAttempt] = useState(0); | ||
| const [status, setStatus] = useState<DesktopAuthStatus>('waiting'); | ||
|
|
||
| useEffect(() => { |
There was a problem hiding this comment.
suggestion: Desktop auth failures are surfaced as a generic error without diagnostic detail.
In the current effect, any bridge.getAuthSession() failure (non-OK response or missing token/username) is reduced to status = 'error', and the UI only shows desktopAuthFailed with a retry. Consider logging response.reason or the thrown error to console.error (or a central logger) before handling it, so desktop bridge or JWT issues can be diagnosed without additional instrumentation later.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Desktop Dashboard 当前沿用浏览器端登录流程。首次安装时,用户无法方便地获知 AstrBot 自动生成的初始密码,导致进入 Desktop 后仍可能被登录页阻塞。
此外,Dashboard 更新后 WebView 可能继续使用旧版入口缓存,使旧 JS 请求新版构建中已经删除的
SetupPage-*.js,最终显示动态模块加载错误。本 PR 将 Desktop 调整为自动建立 JWT 会话,移除仅面向浏览器登录流程的页面和账户密码 UI,同时解决 Dashboard 更新后的旧资源缓存问题。AstrBot 后端鉴权机制仍然保留,并未改为无鉴权访问。
Summary / 改动概述
/auth/login、/auth/setup路由。_desktop_boot参数,避免 WebView 使用旧版index.html。Cargo.lock和dashboard/pnpm-lock.yaml。Verification / 验证方式
cargo fmt --check通过。git diff --cached --check通过。Checklist / 检查清单
src-tauri/Cargo.lock,dashboard/pnpm-lock.yaml). / 依赖变更已同步更新相关锁文件。Summary by Sourcery
Introduce passwordless desktop authentication for AstrBot Dashboard and harden desktop navigation against stale frontend bundles.
New Features:
Bug Fixes:
Enhancements:
Build:
Tests: