feat(account): scaffold configurable backend login panel#212
Open
appergb wants to merge 1 commit into
Open
Conversation
- 5 Tauri commands: set/get backend_url, login, logout, get_status - token stored in keyring (service=opentake-account), no plaintext - UI: Settings > Account pane with backend URL + login form + status badge - disclaim: no official backend, does not block local features - DTO camelCase three-way sync (Rust + types.ts + api.ts)
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.
Summary
Account scaffold (HANDOFF §3.8). OpenTake ships no official backend; this PR adds a Settings → Account pane that lets a user point the app at a self-hosted backend, verify a token against it, and store that token in the OS keychain. Nothing here gates local editing — the disclaimer is shown prominently and every editing / export / Agent feature works unchanged when signed out.
Changes
Backend (Rust)
src-tauri/src/account.rs(new) — 5#[tauri::command]s:account_set_backend_url/account_get_backend_url— persist/clear the backend URL in the keychain (service=opentake-account,account=backend-url). Local only, no network.account_login—POST {backend}/api/auth/verifywithAuthorization: Bearer, 10s timeout, stores the token in the keychain on success, status →Online.account_logout— clears the token, status →Offline.account_get_status— liveAccountStatus(offline/connecting/online/error).AccountInfo { userId, email?, plan? }andAccountStatusare#[serde(tag="type", rename_all="camelCase")]— multi-word fields are camelCase on the wire (the repo's docs: CapCut 差距分析 + 进阶能力与 Web 动效插件设计 #1 IPC bug class)."No backend configured. OpenTake has no official backend; set a custom backend URL in Settings."verbatim.src-tauri/src/lib.rs—mod account,app.manage(AccountState::default()), 5 commands ingenerate_handler!.src-tauri/Cargo.toml—reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }(matchesopentake-gen; no system OpenSSL).Frontend (React/TS)
web/src/lib/types.ts—AccountInfo,AccountStatus(discriminated union bytype).web/src/lib/api.ts— 5 IPC wrappers, all degrade gracefully outside Tauri.web/src/components/settings/AccountPane.tsx(new) — backend URL input + save/clear, token input + login, status badge, logout button, prominent disclaimer. Style mirrors the other panes.web/src/components/settings/SettingsView.tsx— "Account" pane in the sidebar (User icon), between AI and About.web/src/i18n/dict.ts—account.*keys in bothzh-CNanden, including the "no official backend" disclaimer.Invariants (verified)
KeyringStoreunder a dedicatedopentake-accountservice; plaintext never crosses to JS memory or localStorage.Verification (all green)
Closes #HANDOFF-3.8.