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
This commit is contained in:
@@ -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<void>}
|
||||
*/
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
})
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user