From cf5c9d506086f8e1b46af1a56f0c0ade9760bca4 Mon Sep 17 00:00:00 2001 From: oliver Date: Tue, 8 Sep 2026 10:10:37 +0800 Subject: [PATCH] Reconnect remote.mux after UDS login so session history uses new cookies. Co-authored-by: Cursor --- uds-auth/lib/client.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/uds-auth/lib/client.js b/uds-auth/lib/client.js index dd3362c9..08130dc7 100644 --- a/uds-auth/lib/client.js +++ b/uds-auth/lib/client.js @@ -102,6 +102,17 @@ window.__ModuleLoader__.load({ return getCookie('PORTALSSOUser') || getCookie('ZTEDPGSSOUser') || getCookie('UDS_FALLBACK_USER') || null } + /** After UDS login, remote.mux still has pre-login identity — reconnect to re-upgrade with cookies. */ + function reconnectAfterLogin() { + try { + if (typeof window.__udsAuthReconnect === 'function') { + window.__udsAuthReconnect() + return + } + } catch { /* fall through */ } + window.location.reload() + } + function getAuthToken() { return getCookie('PORTALSSOCookie') || getCookie('ZTEDPGSSOCookie') || null } @@ -573,6 +584,7 @@ window.__ModuleLoader__.load({ setQrStatus('\u767b\u5f55\u6210\u529f\uff01') await refreshUser() setOpen(false) + reconnectAfterLogin() } else { setQrStatus('\u7f3a\u5c11 token\uff0c\u65e0\u6cd5\u5b8c\u6210\u6821\u9a8c') } @@ -610,6 +622,7 @@ window.__ModuleLoader__.load({ setFbPass('') await refreshUser() setOpen(false) + reconnectAfterLogin() } catch (err) { setFbErr(err.data?.error || err.message || '\u767b\u5f55\u5931\u8d25') } finally { @@ -761,6 +774,14 @@ window.__ModuleLoader__.load({ } function apply(ctx) { + try { + ctx.inject(['connection'], (cctx) => { + window.__udsAuthReconnect = () => { + try { cctx.connection.reconnect() } catch { window.location.reload() } + } + }) + } catch { /* connection may be unavailable */ } + // Default ACL attrs before /api/me — anonymous stays locked until AuthBadge confirms. ctx.effect(() => {