[fix](trx-frontend-http): serve the band plan to every session
/bandplan.json needed the control role. Route access is decided by suffix for static assets — .js, .css, .png and so on — and ".json" is not among them, so the band plan matched nothing and fell through to the catch-all. It is compiled into the binary and identical for every user, so it is public now, like the rest of them. Two things followed from that. Read-only sessions never saw a band plan at all. And since the page asks for it during startup, the request can land before the session is established: that 401 was swallowed by an empty catch and never retried, which is why the allocations sometimes only appeared after a manual reload. So the client no longer hides the failure, retries once the auth gate clears — which is exactly when a startup 401 becomes fixable — and schedules a draw when the data lands, since the strip is painted from the spectrum draw and a rig sitting between frames would stay blank. The fixture can now refuse the first request the way the server did, and the spectrum layout test holds the client to recovering from it. Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -1839,6 +1839,7 @@ function hideAuthGate() {
|
||||
});
|
||||
navigateToTab(tabFromPath2(), { updateHistory: false, replaceHistory: true });
|
||||
syncTopBarAccess();
|
||||
if (!bandplanData) void loadBandplanJson();
|
||||
}
|
||||
function showAuthError(msg) {
|
||||
const el = requiredElement("auth-error");
|
||||
@@ -9353,8 +9354,8 @@ var bandplanCacheKey = "";
|
||||
var bandplanStripEl = document.getElementById("spectrum-bandplan-strip");
|
||||
var bandplanRegionSelect = document.getElementById("bandplan-region-select");
|
||||
var bandplanLabelsCheck = document.getElementById("bandplan-labels-check");
|
||||
(function loadBandplanJson() {
|
||||
fetch("/bandplan.json").then(async (response) => {
|
||||
function loadBandplanJson() {
|
||||
return fetch("/bandplan.json").then(async (response) => {
|
||||
if (!response.ok) throw new Error(String(response.status));
|
||||
return await responseJsonUnknown(response);
|
||||
}).then((data) => {
|
||||
@@ -9362,9 +9363,12 @@ var bandplanLabelsCheck = document.getElementById("bandplan-labels-check");
|
||||
bandplanData = data;
|
||||
bandplanSegmentsCache = null;
|
||||
bandplanCacheKey = "";
|
||||
}).catch(() => {
|
||||
if (lastSpectrumData) scheduleSpectrumDraw();
|
||||
}).catch((err) => {
|
||||
console.warn("Band plan unavailable", err);
|
||||
});
|
||||
})();
|
||||
}
|
||||
void loadBandplanJson();
|
||||
if (bandplanRegionSelect) {
|
||||
bandplanRegionSelect.value = bandplanRegion;
|
||||
bandplanRegionSelect.addEventListener("change", () => {
|
||||
|
||||
Reference in New Issue
Block a user