AIStudio2API icon indicating copy to clipboard operation
AIStudio2API copied to clipboard

[Feature] Surface session / bound cookie expiration time in Accounts API and display lifetime badge in Web UI

Open photobrand opened this issue 1 week ago • 0 comments

想要什么,用来做什么 / 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

  1. Backend (internal/api/admin.go, internal/app/admin.go):
    • Add CookieExpiresAt *time.Time (or SessionExpiresAt) to api.AdminAccount.
    • In adminAccountDTO, compute the earliest expiration among critical session cookies in account.StorageState.Cookies (e.g. __Secure-1PSIDRTS, __Secure-1PSIDTS, SAPISID where Expires > 0).
  2. Frontend (web/src/components/AccountsPanel.vue):
    • In the account row summary (next to proxy/locale), display remaining session time (e.g. ⏳ 2h 15m or ⏳ 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).

版本 / Version

v0.3.13

photobrand avatar Nov 21 '26 17:11 photobrand