diff --git a/CHANGELOG.md b/CHANGELOG.md index c65f9cf..ff209c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ The application version is maintained in `package.json` and displayed in the adm No changes recorded yet. +## 1.89.5 + +- Fix: after `npm restart` the page reloads itself, and on the Overlay menu page that turned it into a full-screen overlay window without the menu. The menu page is now `?view=overlays`; only a link with `overlayMode` (the stand-alone window and OBS links) opens full screen, so an old `?view=overlay` tab also comes back with the menu. + ## 1.89.4 - Overlay: a Last lap column that changes at every passing. The OBS TV tower and lower third get it (Show last lap, on by default, part of the OBS link), and in an Open Practice ranked on the best lap the leaderboard shows the last lap where the result only repeated the best lap. Ranked on laps in a row or minutes, the result stays (also in the OBS tower, which used to hide it). diff --git a/package-lock.json b/package-lock.json index 50aa1ee..94a14b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rc-racecore", - "version": "1.89.4", + "version": "1.89.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rc-racecore", - "version": "1.89.4", + "version": "1.89.5", "hasInstallScript": true, "dependencies": { "better-sqlite3": "^12.11.1", diff --git a/package.json b/package.json index fdb50f5..e4650e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rc-racecore", - "version": "1.89.4", + "version": "1.89.5", "private": true, "description": "RC RaceCore live timing and race control with AMMC ingest and SQLite persistence", "engines": { diff --git a/src/app.js b/src/app.js index 4f7f0d7..ae3d6e3 100644 --- a/src/app.js +++ b/src/app.js @@ -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"); diff --git a/tests/browser_overlay_driver_link.js b/tests/browser_overlay_driver_link.js index b74603b..5f832fe 100644 --- a/tests/browser_overlay_driver_link.js +++ b/tests/browser_overlay_driver_link.js @@ -37,7 +37,7 @@ export async function runOverlayDriverLinkSmoke({ evaluate, navigate, savedState console.log("PASS a click on a driver in the Overlay opens that driver's training stats"); // The stand-alone overlay window stays up and opens a new tab. - await navigate("overlay", "view"); + await navigate("overlay&overlayMode=leaderboard", "view"); await waitFor(async () => evaluate(`Boolean(${row})`), "the driver row is a link in the overlay window"); await evaluate(`window.__opened = []; window.open = (url, target) => { window.__opened.push([url, target]); return null; }; ${row}.click()`); const [openedUrl, target] = (await evaluate(`window.__opened`))[0]; diff --git a/tests/browser_smoke.js b/tests/browser_smoke.js index 7b87e7d..0f0619f 100644 --- a/tests/browser_smoke.js +++ b/tests/browser_smoke.js @@ -224,6 +224,20 @@ try { console.log("PASS decoder diagnostics update without resetting settings draft"); await runOverlaySmoke({ evaluate }); await runOverlayLiveMarksSmoke({ evaluate }); + // The Overlay menu page survives a reload (the page reloads itself after npm restart): it must + // come back with the menu, not as a full-screen overlay window. + await navigate("dashboard", "dashboardQuickPractice"); + await evaluate(`[...document.querySelectorAll(".nav-item")].find(el => el.textContent === "Overlay")?.click()`); + await waitFor(async () => await evaluate('Boolean(document.getElementById("overlayLaunchObs"))'), "Overlay menu page"); + const overlayUrl = await evaluate("location.search"); + if (!/view=overlays\b/.test(overlayUrl)) throw new Error("Overlay menu URL: " + overlayUrl); + for (const search of [overlayUrl, "?view=overlay"]) { + await send("Page.navigate", { url: base + "/" + search }); + await waitFor(async () => await evaluate('Boolean(document.getElementById("overlayLaunchObs")) && Boolean(document.querySelector(".nav-item"))'), "menu page after reload of " + search); + } + await send("Page.navigate", { url: base + "/?view=overlay&overlayMode=leaderboard" }); + await waitFor(async () => await evaluate('!document.getElementById("overlayLaunchObs") && Boolean(document.querySelector("[data-overlay-competitor], .overlay-shell"))'), "a real overlay window stays full screen"); + console.log("PASS the Overlay menu page reloads with the menu; an overlay window link stays full screen"); const mobileState = await savedState(); const mobileToken = "browser-mobile-profile-token-1234567890"; mobileState.training ||= {};