Files
rustguac/static
Dave Kempe 38943c9d4c Reconnect button: relaunch entry instead of reloading dead session
The previous commit (Fix zombie WebSocket) wired tunnel.onerror /
onstatechange into client.onerror so the disconnected overlay
appears when a mid-path WS drop is detected. That fixes the
"frozen tab" symptom but leaves the Reconnect button doing
window.location.reload(), which re-opens client.html?session=<id>
against a session that no longer exists. By the time the WS
proxy task in src/websocket.rs returns BrowserEnded, disconnect_viewer
has decremented active_connections to 0 and complete_session has
flipped status to Completed; the guacd stream was dropped when the
proxy task ended. So a reload just walks back into the same overlay.

Reconnect now relaunches against the original Connections entry
when one exists, which is the user's actual intent. The fetch at
the top of setupClient already pulls /api/sessions/:id; we now
stash address_book_entry, address_book_folder, and
entry_display_name from that response into a relaunchInfo object.
On Reconnect click:

  - shareToken viewer: reload (unchanged; nothing better to offer).
  - relaunchInfo present: POST to
    /api/addressbook/folders/{scope}/{folder}/entries/{entry}/connect
    with the current window dims and DPI, then navigate to
    data.client_url + ?name=<display>. Fresh session id, fresh
    guacd connection, RDP/xrdp resumes the desktop state on the
    server side.
  - relaunchInfo absent (ad-hoc) or any non-2xx (412 missing creds,
    403 forbidden, 404 entry deleted) or network error: redirect to
    /connections.html so the user can fill in what is missing or
    pick somewhere else to go.

Splitting scope/folder/entry from the composite entry_key relies
on the constraint enforced in vault.rs validate_name: entry names
cannot contain slashes. Folder paths can, but only ever sit
between scope and entry, so first-slash gives scope and last-slash
gives entry.

Bundled fix: client.onerror now clearInterval(_thumbInterval) when
it runs. That closes the secondary leak called out in the prior
commit message (thumbnail XHR uploader continuing to 404 against
an already cleaned-up session) for users who walk away from the
overlay rather than clicking Close or Reconnect immediately.

Web sessions (Chromium + Xvnc) are entry-backed too and will
relaunch via the same path. The new session means a fresh
Chromium process with empty tab state, but that matches what the
user expects from Reconnect on a web session anyway.
2026-04-25 15:41:42 +10:00
..
2026-02-06 14:38:53 +11:00
2026-04-21 17:45:38 +10:00