From 4d959b649f8fa8f31e1c51bef2dd7a17e814b460 Mon Sep 17 00:00:00 2001 From: Stanislaw Grams Date: Fri, 13 Feb 2026 08:50:58 +0100 Subject: [PATCH] [fix](trx-frontend-http): don't redirect to login on 403 (insufficient permissions) Only redirect to login on 401 (unauthenticated). For 403 errors (authenticated but insufficient role), let the caller handle the error. This prevents rx-authenticated users from being redirected to login when they attempt to scroll the jog wheel or frequency input, which tries to call /set_freq (a control-only endpoint). RX users will now see "Insufficient permissions" hint instead of being sent to login screen. Co-Authored-By: Claude Opus 4.6 Signed-off-by: Stanislaw Grams --- .../trx-frontend/trx-frontend-http/assets/web/app.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js index 7a71f3d..93af71d 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js +++ b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/app.js @@ -961,13 +961,17 @@ function disconnect() { async function postPath(path) { const resp = await fetch(path, { method: "POST" }); - if (resp.status === 401 || resp.status === 403) { - // Auth error - return to login + if (resp.status === 401) { + // Not authenticated - return to login authRole = null; if (es) es.close(); showAuthGate(); throw new Error("Authentication required"); } + if (resp.status === 403) { + // Authenticated but insufficient permissions - don't redirect + throw new Error("Insufficient permissions"); + } if (!resp.ok) { const text = await resp.text(); throw new Error(text || resp.statusText);