fix(overlay): the Overlay menu page reloads with the menu, not as a full-screen window (1.89.5)

This commit is contained in:
larssand committed 2026-11-10 20:45:35 +01:00
1 parent d5f81f4290
commit 39eaad64ed
6 files changed
+30 -7

No files matched your search

+8 -3
View File
@@ -5735,7 +5735,10 @@ const allowedOverlayModes = ["leaderboard", "speaker", "results", "tv", "team",
const publicOverlayMatch = window.location.pathname.match(/^\/public-overlay(?:\/([a-z0-9_-]+))?\/?$/i);
const routeOverlayMode = String(publicOverlayMatch?.[1] || "").toLowerCase();
const queryOverlayMode = String(urlParams.get("overlayMode") || "").toLowerCase();
const overlayMode = urlParams.get("view") === "overlay" || Boolean(publicOverlayMatch);
// A stand-alone overlay window always carries overlayMode (buildOverlayUrl); a bare ?view=overlay
// is the Overlay menu page as older versions wrote it, so it opens with the menu.
const OVERLAY_MENU_VIEW_PARAM = "overlays";
const overlayMode = (urlParams.get("view") === "overlay" && urlParams.has("overlayMode")) || Boolean(publicOverlayMatch);
const overlayViewMode = allowedOverlayModes.includes(routeOverlayMode)
? routeOverlayMode
: allowedOverlayModes.includes(queryOverlayMode)
@@ -5759,7 +5762,9 @@ const raceController = overlayMode ? null : createRaceController({
const isRaceMaster = () => Boolean(raceController?.isMaster());
const state = loadState();
const sessionReplay = createSessionReplayRuntime();
const requestedView = String(urlParams.get("view") || "").toLowerCase();
// The Overlay menu page is ?view=overlays: ?view=overlay&overlayMode=… is the stand-alone overlay
// window (and OBS links), so a reload after an update must not turn the menu page full screen.
const requestedView = ((view) => (view === OVERLAY_MENU_VIEW_PARAM ? "overlay" : view))(String(urlParams.get("view") || "").toLowerCase());
let currentView = overlayMode ? "overlay" : NAV_ITEMS.some((item) => item.id === requestedView) ? requestedView : "dashboard";
let wsClients = { main: null, split: null, pit_entry: null, pit_exit: null };
let reconnectTimers = { main: null, split: null, pit_entry: null, pit_exit: null };
@@ -7311,7 +7316,7 @@ function renderNav() {
function updateViewUrl(view, driverId = "", classId = "") {
if (overlayMode) return;
const nextUrl = new URL(window.location.href);
if (view && view !== "dashboard") nextUrl.searchParams.set("view", view);
if (view && view !== "dashboard") nextUrl.searchParams.set("view", view === "overlay" ? OVERLAY_MENU_VIEW_PARAM : view);
else nextUrl.searchParams.delete("view");
if (view === "training" && driverId) nextUrl.searchParams.set("driver", driverId);
else nextUrl.searchParams.delete("driver");