AIStudio2API
AIStudio2API copied to clipboard
[Feature] Surface session / bound cookie expiration time in Accounts API and display lifetime badge in Web UI
想要什么,用来做什么 / What you want and what for
What I want & Use Case
For accounts imported via Paste cookies or CDP, authentication tokens like __Secure-1PSIDRTS expire after ~2–6 hours (or 14 days without DBSC), causing sudden 401 auth_required interruptions during generation tasks.
Currently, the user has no visibility into when an account's session will expire until it fails with 401. In internal/aistudio/auth.go, StorageState.BoundCookieLifetime and cookie.Expires already parse and calculate exact cookie timestamps. Exposing this information in AdminAccount and displaying a simple countdown / badge in AccountsPanel.vue would allow users with multi-account pools to know at a glance which accounts need fresh cookies before starting heavy workloads.
Proposed Implementation Direction
- Backend (
internal/api/admin.go,internal/app/admin.go):- Add
CookieExpiresAt *time.Time(orSessionExpiresAt) toapi.AdminAccount. - In
adminAccountDTO, compute the earliest expiration among critical session cookies inaccount.StorageState.Cookies(e.g.__Secure-1PSIDRTS,__Secure-1PSIDTS,SAPISIDwhereExpires > 0).
- Add
- Frontend (
web/src/components/AccountsPanel.vue):- In the account row summary (next to proxy/locale), display remaining session time (e.g.
⏳ 2h 15mor⏳ 18m). - Highlight when expiring soon (< 30 minutes in amber, expired in red).
- In the state filter dropdown, optionally allow filtering accounts that are
Expiring soon(< 1h).
- In the account row summary (next to proxy/locale), display remaining session time (e.g.
版本 / Version
v0.3.13