AIStudio2API
AIStudio2API copied to clipboard
Allow seamless in-place cookie replacement for auth_required and restricted accounts without deleting runtime-state.json
想要什么,用来做什么 / What you want and what for
What I want & Use Case
For accounts added via Paste cookies (which often carry __Secure-1PSIDRTS and expire after ~2 hours without Chrome OAuth/DBSC renewal material, hitting 401 auth_required — see #203), users regularly need to paste fresh cookies for an existing account email.
Right now, the UI and import checks push users toward Delete -> Re-add, which calls AccountStore.Delete (os.RemoveAll) and destroys auth/<email>/runtime-state.json — wiping cooldowns, benefit_tier, model_access, and Drive resources bindings for that account.
Current Friction Points (verified in v0.3.13 / c77dd89)
auth_requiredaccounts hide their "Already imported" status and have no cookie-update row action:- In
internal/app/admin.go,accountIDs()explicitly skipsAccountAuthRequired. In the Paste cookies dialog (DiscoverCookieAccounts), an expired account showsimported: falseinstead of indicating it will update the existing account in place. - On the account row (
web/src/components/AccountsPanel.vue),account.state === 'auth_required'only shows Re-login (Camoufox browser login), with no Update cookies action for cookie-imported accounts. (CallingImportAccountStatewithout deleting actually works viaupsertAccount->updateImportedAccountand preservesruntime-state.json, but the UI obscures this.)
- In
restrictedaccounts block in-place cookie updates completely:- In
internal/app/admin.go,checkAccountAccessrejectsImportAccountStatewith403 account_restrictedbased on the oldadmin.accountIDs()state before even checking the newly submittedStorageState, andAccountsPanel.vuedisables the checkbox (:disabled="candidate.restricted !== ''"). - Once an account is
restricted(e.g.,403 verification), a user who verified the account in a browser and exported fresh cookies cannot overwrite cookies in place — they must either delete the account (wipingruntime-state.json) or reset state toready(which also clears allCooldowns).
- In
Proposed Improvement
- Preserve
"Already imported"/ updatable indicator forauth_requiredaccounts inDiscoverCookieAccounts(e.g., distinguishimported: true+stateor let the Paste cookies UI clearly show it will replace cookies in place). - Allow
ImportAccountStateto replace cookies for an existingrestrictedaccount when the newly submittedStorageStatepasseschromeauth.CheckAccess(instead of short-circuiting on the stalerestrictedstatus incheckAccountAccess), clearingruntimeState.Restrictedupon successful verification while keepingruntimeState.Cooldowns,Resources, andModelAccessintact. - Add an "Update cookies" row action (or pre-targeted Paste cookies shortcut) for existing accounts (especially
auth_required/restricted) so users can refresh expired cookies without deleting the account.
版本 / Version
v0.3.13