[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 <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,13 @@ function loadSetting(key, fallback) {
|
|||||||
return v !== null ? JSON.parse(v) : fallback;
|
return v !== null ? JSON.parse(v) : fallback;
|
||||||
} catch(e) { return fallback; }
|
} catch(e) { return fallback; }
|
||||||
}
|
}
|
||||||
|
function escapeMapHtml(input) {
|
||||||
|
return String(input)
|
||||||
|
.replaceAll("&", "&")
|
||||||
|
.replaceAll("<", "<")
|
||||||
|
.replaceAll(">", ">")
|
||||||
|
.replaceAll("\"", """);
|
||||||
|
}
|
||||||
|
|
||||||
// --- Authentication ---
|
// --- Authentication ---
|
||||||
let authRole = null; // null (not authenticated), "rx" (read-only), or "control" (full access)
|
let authRole = null; // null (not authenticated), "rx" (read-only), or "control" (full access)
|
||||||
@@ -4591,7 +4598,7 @@ Object.defineProperties(window.trx, {
|
|||||||
});
|
});
|
||||||
// -- Shared utility functions --
|
// -- Shared utility functions --
|
||||||
Object.assign(window.trx, {
|
Object.assign(window.trx, {
|
||||||
saveSetting, loadSetting, showHint, formatFreq, formatFreqForHumans,
|
saveSetting, loadSetting, showHint, escapeMapHtml, formatFreq, formatFreqForHumans,
|
||||||
formatWavelength, formatBwLabel, formatUptime, formatSigStrength, formatSignal,
|
formatWavelength, formatBwLabel, formatUptime, formatSigStrength, formatSignal,
|
||||||
postPath, scheduleUiFrameJob, navigateToTab, rigBadgeColor,
|
postPath, scheduleUiFrameJob, navigateToTab, rigBadgeColor,
|
||||||
latLonToMaidenhead, locatorToLatLon, haversineKm, formatDistanceKm,
|
latLonToMaidenhead, locatorToLatLon, haversineKm, formatDistanceKm,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
const T = window.trx;
|
const T = window.trx;
|
||||||
|
|
||||||
// Destructure shared utility functions for convenience
|
// Destructure shared utility functions for convenience
|
||||||
const { saveSetting, loadSetting, showHint, formatFreq, formatFreqForHumans,
|
const { saveSetting, loadSetting, showHint, escapeMapHtml, formatFreq, formatFreqForHumans,
|
||||||
postPath, scheduleUiFrameJob, navigateToTab, rigBadgeColor,
|
postPath, scheduleUiFrameJob, navigateToTab, rigBadgeColor,
|
||||||
formatUptime, latLonToMaidenhead, locatorToLatLon, haversineKm,
|
formatUptime, latLonToMaidenhead, locatorToLatLon, haversineKm,
|
||||||
formatDistanceKm, formatTimeAgo, currentDecodeHistoryRetentionMs,
|
formatDistanceKm, formatTimeAgo, currentDecodeHistoryRetentionMs,
|
||||||
@@ -2430,14 +2430,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeMapHtml(input) {
|
|
||||||
return String(input)
|
|
||||||
.replaceAll("&", "&")
|
|
||||||
.replaceAll("<", "<")
|
|
||||||
.replaceAll(">", ">")
|
|
||||||
.replaceAll("\"", """);
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatDecodeLocatorTime(tsMs) {
|
function formatDecodeLocatorTime(tsMs) {
|
||||||
if (!Number.isFinite(tsMs)) return "--:--:--";
|
if (!Number.isFinite(tsMs)) return "--:--:--";
|
||||||
return new Date(tsMs).toLocaleTimeString([], {
|
return new Date(tsMs).toLocaleTimeString([], {
|
||||||
|
|||||||
Reference in New Issue
Block a user