Files
uconsole_asw_game/data/commander/js/net/version.js
T
Claude 0ed16ffca6 Reload a Remote Crew page once after a host update (1.3.49)
The host sends X-U-Jagd-Version on every reply and names its version in the
served page; a page from before an update reloads itself once.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RyrzxkJ2eWnWk5E66xWhSB
2026-09-28 20:12:23 +00:00

25 lines
982 B
JavaScript

// The host names its version on every API response (X-U-Jagd-Version) and in
// the page it served (<meta name="u-jagd-version">). A page that outlived a
// host update runs the old client against a new host, so it reloads itself
// once to fetch the matching client. Both come from the same host process
// and are never cached (no-store), so a reload cannot loop. The page layer
// (main.js) reads the meta tag and hands it over; transport never reads the page.
let pageVersion = null;
let reloading = false;
export function setPageVersion(version) {
pageVersion = typeof version === "string" && version && version.length <= 32 ? version : null;
}
export function clientVersion() {
return pageVersion;
}
export function checkHostVersion(hostVersion) {
if (reloading || !pageVersion || typeof hostVersion !== "string" || !hostVersion ||
hostVersion.length > 32 || hostVersion === pageVersion) return false;
reloading = true;
location.reload();
return true;
}