From de3b9f0bbb14043ea1bab574671148cae92aea6b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 1 Apr 2026 10:49:19 +0000 Subject: [PATCH] [fix](trx-frontend-http): move escapeMapHtml to global scope in app.js escapeMapHtml was defined inside the map-core.js IIFE, making it inaccessible to app.js and plugin files (aprs, ais, vdes, cw, hf-aprs) that call it from global scope, causing ReferenceError at runtime. Move the function definition to app.js (global scope), export it via window.trx, and destructure it in map-core.js like other shared utils. https://claude.ai/code/session_01RhL8cCcszaguKqoWn5XUxL Signed-off-by: Claude --- .../trx-frontend/trx-frontend-http/assets/web/app.js | 9 ++++++++- .../trx-frontend-http/assets/web/map-core.js | 10 +--------- 2 files changed, 9 insertions(+), 10 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 00276c6..946ffb4 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 @@ -35,6 +35,13 @@ function loadSetting(key, fallback) { return v !== null ? JSON.parse(v) : fallback; } catch(e) { return fallback; } } +function escapeMapHtml(input) { + return String(input) + .replaceAll("&", "&") + .replaceAll("<", "<") + .replaceAll(">", ">") + .replaceAll("\"", """); +} // --- Authentication --- let authRole = null; // null (not authenticated), "rx" (read-only), or "control" (full access) @@ -4591,7 +4598,7 @@ Object.defineProperties(window.trx, { }); // -- Shared utility functions -- Object.assign(window.trx, { - saveSetting, loadSetting, showHint, formatFreq, formatFreqForHumans, + saveSetting, loadSetting, showHint, escapeMapHtml, formatFreq, formatFreqForHumans, formatWavelength, formatBwLabel, formatUptime, formatSigStrength, formatSignal, postPath, scheduleUiFrameJob, navigateToTab, rigBadgeColor, latLonToMaidenhead, locatorToLatLon, haversineKm, formatDistanceKm, diff --git a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/map-core.js b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/map-core.js index 3463c7e..2159237 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/assets/web/map-core.js +++ b/src/trx-client/trx-frontend/trx-frontend-http/assets/web/map-core.js @@ -5,7 +5,7 @@ const T = window.trx; // Destructure shared utility functions for convenience - const { saveSetting, loadSetting, showHint, formatFreq, formatFreqForHumans, + const { saveSetting, loadSetting, showHint, escapeMapHtml, formatFreq, formatFreqForHumans, postPath, scheduleUiFrameJob, navigateToTab, rigBadgeColor, formatUptime, latLonToMaidenhead, locatorToLatLon, haversineKm, formatDistanceKm, formatTimeAgo, currentDecodeHistoryRetentionMs, @@ -2430,14 +2430,6 @@ }); } - function escapeMapHtml(input) { - return String(input) - .replaceAll("&", "&") - .replaceAll("<", "<") - .replaceAll(">", ">") - .replaceAll("\"", """); - } - function formatDecodeLocatorTime(tsMs) { if (!Number.isFinite(tsMs)) return "--:--:--"; return new Date(tsMs).toLocaleTimeString([], {