dsh-overleaf v0.2.7
dsh-overleaf v0.2.7
Editor Loading root causes found in field testing (codex fix, reviewed)
With projects now opening, deeper field testing exposed three defects that kept the editor on its Loading screen and broke interactions.
1. window.WebSocket wrapper dropped native static constants
Overleaf's connection manager compares connection state against WebSocket.OPEN/CONNECTING before creating a socket. The prototype-shuffle wrapper left both sides undefined, so canReconnect() stayed false forever and the editor never left Loading.
The wrapper now inherits the native prototype and statics (Object.setPrototypeOf(PatchedWebSocket, OriginalWebSocket)), also preserving instanceof semantics after wrapping.
2. Edge affinity cookies must follow the browser (GCLB 502)
Overleaf sits behind a load balancer that rotates an affinity cookie (gclb) on the socket.io handshake. The stored-credential-authority rule silently dropped that rotated value, so the WebSocket upgrade landed on a different backend where the fresh socket id did not exist → 502 → editor on Loading forever (this explains the intermittent 502s observed in field diagnostics).
mergeProxyCookieHeaders(browser, stored): application-session cookies stay stored-authoritative; known edge-routing cookies (gclb, awsalb*, __cf_bm, acw_tc, ...) keep the live browser value. Applied to both the HTTP path and the WebSocket upgrade.
3. Settings commits silently removed the editor's dynamic WebSocket route
applyRuntimeConfig rebuilt the ReverseProxy without preserving the companion WS tunnel port/origin. Saving any setting made editor pages loaded afterwards lose their only dynamic WebSocket route.
Diagnostics
The bridge now writes live state to <html data-dsh-overleaf-*> attributes (bridge, ws-port, ws-target, ws-state, last-error, last-rejection) — visible directly in the Elements panel.
Upgrade
dsh plugin --profile web add github:gychen-NJU/dsh-overleaf(already installed? remove first, re-add, restart the web service, then hard-refresh the DSH page with Ctrl+F5)