From 38300fcf797bfa5dbb1bc9c749bce6f91e5b91e0 Mon Sep 17 00:00:00 2001 From: Brian Krabach Date: Wed, 1 Apr 2026 13:18:10 -0700 Subject: [PATCH] feat: route remote terminal connections through federation proxy - connectWebSocket() now accepts remoteId instead of sourceUrl; when remoteId is set the WebSocket URL is ws://host/federation/{remoteId}/terminal/ws (same-origin, no cross-origin connections) - openTerminal() signature updated to accept remoteId parameter - openSession() in app.js routes remote connect POST to /api/federation/{remoteId}/connect/{name} instead of the remote URL - window._openTerminal() call passes remoteId instead of sourceUrl - _viewingSourceUrl state replaced with _viewingRemoteId - Tile and sidebar click handlers updated to pass remoteId - HTML attributes changed from data-source-url to data-remote-id - Test suite updated: removed cross-origin sourceUrl tests, added federation proxy path tests --- muxplex/frontend/app.js | 36 +++++++------- muxplex/frontend/terminal.js | 23 +++++---- muxplex/frontend/tests/test_terminal.mjs | 61 ++++++++++++++---------- 3 files changed, 66 insertions(+), 54 deletions(-) diff --git a/muxplex/frontend/app.js b/muxplex/frontend/app.js index 91787cf..48893f8 100644 --- a/muxplex/frontend/app.js +++ b/muxplex/frontend/app.js @@ -120,7 +120,7 @@ const MOBILE_THRESHOLD = 600; let _deviceId = ''; let _currentSessions = []; let _viewingSession = null; -let _viewingSourceUrl = ''; +let _viewingRemoteId = ''; let _viewMode = 'grid'; let _lastInteractionAt = Date.now() / 1000; let _pollingTimer; @@ -484,9 +484,9 @@ function buildTileHTML(session, index, mobile) { } const lastLines = allLines.slice(_lineCount).join('\n'); - const sourceUrlAttr = session.sourceUrl ? ` data-source-url="${escapeHtml(session.sourceUrl)}"` : ''; + const remoteIdAttr = session.remoteId ? ` data-remote-id="${escapeHtml(session.remoteId)}"` : ''; return ( - `
` + + `
` + `
` + `${escapeHtml(name)}` + badgeHtml + @@ -543,7 +543,7 @@ function buildSidebarHTML(session, currentSession) { const lastLines = allLines.slice(-20).join('\n'); return ( - `
` + + `
` + `