From a4271bb89cc951733813d7917ed52263c75f9269 Mon Sep 17 00:00:00 2001 From: Brian Krabach Date: Thu, 16 Apr 2026 08:34:46 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20local=20sessions=20404=20=E2=80=94=20use?= =?UTF-8?q?=20remoteId=20(not=20deviceId)=20for=20routing=20attribute?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit buildTileHTML and buildSidebarHTML were using session.deviceId for the data-remote-id attribute. Since deviceId is now non-null for ALL sessions (including local), openSession() routed local sessions through federation endpoints which returned 404. Fixed to use session.remoteId which is null for local sessions, preserving the local vs federation routing distinction. --- muxplex/frontend/app.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/muxplex/frontend/app.js b/muxplex/frontend/app.js index ed326e4..f23b55c 100644 --- a/muxplex/frontend/app.js +++ b/muxplex/frontend/app.js @@ -531,9 +531,12 @@ function buildTileHTML(session, index, mobile) { } const lastLines = allLines.slice(_lineCount).join('\n'); - // Prefer deviceId (device_id string from backend) over legacy integer remoteId - var _effRemoteId = session.deviceId != null ? session.deviceId : session.remoteId; - const remoteIdAttr = _effRemoteId != null ? ` data-remote-id="${escapeHtml(_effRemoteId)}"` : ''; + // Use remoteId (null for local sessions, device_id string for remote sessions) so + // openSession() can correctly distinguish local vs federation routing. + // deviceId is the local device's own UUID for local sessions — using it here would + // cause openSession() to route local sessions through /api/federation/{deviceId}/… + // which returns 404 because the local device is not a registered remote instance. + const remoteIdAttr = session.remoteId != null ? ` data-remote-id="${escapeHtml(String(session.remoteId))}"` : ''; return ( `
` + `
` + @@ -588,8 +591,10 @@ function buildSidebarHTML(session, currentSession) { } const lastLines = allLines.slice(-20).join('\n'); - // Prefer deviceId (device_id string from backend) over legacy integer remoteId - var _sidebarEffRemoteId = session.deviceId != null ? session.deviceId : (session.remoteId != null ? session.remoteId : ''); + // Use remoteId (null for local sessions, device_id string for remote sessions). + // Do NOT use deviceId here: for local sessions deviceId is the local machine's UUID + // which is not a registered remote_instance, so routing through federation would 404. + var _sidebarEffRemoteId = session.remoteId != null ? String(session.remoteId) : ''; return ( `
` + `