Re-authenticate in place when the Perforce ticket expires

Perforce ends the ticket on its own schedule, so a long day outlives a login.
Every command then failed and the only way back was Exit + restart, which threw
away the scope, selection and open panels.

- p4.ts routes all ~110 commands through one invoke wrapper that recognises an
  auth failure (isAuthError) and raises onAuthLost, so no call site can miss it.
  p4_login / p4_restore / p4_clients are exempt: they report bad credentials
  inline and would otherwise loop the prompt.
- The server poll no longer treats an expired ticket as an outage. The server
  answered, it just refused us — the offline banner it used to raise never
  cleared, since polling stayed refused forever.
- ReauthModal asks for the password over the running app, keeping all state,
  and offers Sign out as the way back to the Connect screen.

The failed command is NOT retried automatically — re-auth then refresh only.
Replaying a half-finished submit or revert unattended is worse than asking.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bonchellon
2026-07-18 17:25:14 +03:00
parent 23fabe11ec
commit 30e77664d5
4 changed files with 108 additions and 3 deletions

View File

@ -947,6 +947,11 @@ body.resizing-v{cursor:row-resize!important;user-select:none}
.dropinner svg{width:44px;height:44px}
.dropinner span{font-size:15px;font-weight:600;color:var(--txt)}
/* re-auth: who we're signing back in as */
.reauth-who{display:flex;flex-wrap:wrap;gap:6px;margin:2px 0 14px}
.reauth-who span{font-family:var(--mono);font-size:11px;color:var(--muted);
background:var(--panel-3);border:1px solid var(--border);border-radius:6px;padding:3px 8px}
/* toast */
.toast{position:fixed;bottom:18px;left:50%;transform:translateX(-50%);z-index:200;max-width:72%;
background:var(--elevated);border:1px solid var(--border);color:var(--txt);