From 469acd7e3f8b9e7dc1cb9527f0548c4d04fa2dbb Mon Sep 17 00:00:00 2001 From: Ken Date: Thu, 28 May 2026 07:38:04 +0000 Subject: [PATCH] fix: align terminal.js token response field with API contract and remove stale ttyd refs - terminal.js:55: read data.port instead of data.muxtermPort to match the /api/terminal-token response shape ({token, port}) - test_terminal.mjs:37: update mock to return {port: 9999} matching API - app.js: replace two stale ttyd references in comments with muxterm --- muxplex/frontend/app.js | 4 ++-- muxplex/frontend/terminal.js | 2 +- muxplex/frontend/tests/test_terminal.mjs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/muxplex/frontend/app.js b/muxplex/frontend/app.js index 41f54be..2945caa 100644 --- a/muxplex/frontend/app.js +++ b/muxplex/frontend/app.js @@ -311,7 +311,7 @@ function trackInteraction() { /** * Restore application state from the server on page load. * Calls GET /api/state and, if an active session exists, re-opens it, - * skipping only the zoom animation (ttyd is re-spawned to handle service restarts). + * skipping only the zoom animation (muxterm handles terminal sessions). * Always resolves — errors are logged as warnings so the app can start normally. * @returns {Promise} */ @@ -2941,7 +2941,7 @@ async function openSession(name, opts = {}) { // Wait for animation to finish (may already be done if /connect was slow) await animDone; - // Mount terminal NOW — /connect has completed, new ttyd is serving the correct session + // Mount terminal NOW — muxterm is serving the correct session // Prefer _switchTerminal (cache-aware) over _openTerminal (always creates fresh) if (window._switchTerminal) window._switchTerminal(name, _deviceId, getDisplaySettings().fontSize); else if (window._openTerminal) window._openTerminal(name, _deviceId, getDisplaySettings().fontSize); diff --git a/muxplex/frontend/terminal.js b/muxplex/frontend/terminal.js index a4cd60d..0360129 100644 --- a/muxplex/frontend/terminal.js +++ b/muxplex/frontend/terminal.js @@ -52,7 +52,7 @@ function connectWebSocket() { fetch('/api/terminal-token', { method: 'GET' }) .then(function(res) { return res.json(); }) .then(function(data) { - _muxtermPort = data.muxtermPort; + _muxtermPort = data.port; _muxtermToken = data.token; _openMuxtermSocket(); }) diff --git a/muxplex/frontend/tests/test_terminal.mjs b/muxplex/frontend/tests/test_terminal.mjs index cac1f4e..34f93dd 100644 --- a/muxplex/frontend/tests/test_terminal.mjs +++ b/muxplex/frontend/tests/test_terminal.mjs @@ -34,7 +34,7 @@ function loadTerminal() { let capturedCloseHandler = null; let lastFetchUrl = null; let lastFetchOpts = null; - let fetchReturnValue = { muxtermPort: 9999, token: 'test-token-abc' }; + let fetchReturnValue = { port: 9999, token: 'test-token-abc' }; const mockTerm = { cols: 80,