Remove auto-connect after version reload
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Maintainer-controlled web client version.
|
// Maintainer-controlled web client version.
|
||||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||||
window.CHGRID_WEB_VERSION = "2026.02.22 R176";
|
window.CHGRID_WEB_VERSION = "2026.02.22 R177";
|
||||||
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ const HEARTBEAT_INTERVAL_MS = 10_000;
|
|||||||
const RECONNECT_DELAY_MS = 5_000;
|
const RECONNECT_DELAY_MS = 5_000;
|
||||||
const RECONNECT_MAX_ATTEMPTS = 3;
|
const RECONNECT_MAX_ATTEMPTS = 3;
|
||||||
const AUDIO_SUBSCRIPTION_REFRESH_MS = 500;
|
const AUDIO_SUBSCRIPTION_REFRESH_MS = 500;
|
||||||
const AUTO_RECONNECT_AFTER_RELOAD_KEY = 'chatGridAutoReconnectAfterReload';
|
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
@@ -589,13 +588,8 @@ function handleSignalingStatus(message: string): void {
|
|||||||
pushChatMessage(message);
|
pushChatMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Performs cache-busted navigation and marks session for one-time auto-connect. */
|
/** Performs cache-busted navigation so the browser loads the newest client bundle. */
|
||||||
function reloadClientForVersion(version: string): void {
|
function reloadClientForVersion(version: string): void {
|
||||||
try {
|
|
||||||
sessionStorage.setItem(AUTO_RECONNECT_AFTER_RELOAD_KEY, '1');
|
|
||||||
} catch {
|
|
||||||
// Ignore sessionStorage failures.
|
|
||||||
}
|
|
||||||
const nextUrl = new URL(window.location.href);
|
const nextUrl = new URL(window.location.href);
|
||||||
nextUrl.searchParams.set('v', version || 'unknown');
|
nextUrl.searchParams.set('v', version || 'unknown');
|
||||||
nextUrl.searchParams.set('t', String(Date.now()));
|
nextUrl.searchParams.set('t', String(Date.now()));
|
||||||
@@ -2291,21 +2285,3 @@ if (storedNickname) {
|
|||||||
updateConnectAvailability();
|
updateConnectAvailability();
|
||||||
updateDeviceSummary();
|
updateDeviceSummary();
|
||||||
updateStatus('Welcome to the Chat Grid. Press the Settings button to configure your audio, then Connect to join the grid.');
|
updateStatus('Welcome to the Chat Grid. Press the Settings button to configure your audio, then Connect to join the grid.');
|
||||||
try {
|
|
||||||
if (sessionStorage.getItem(AUTO_RECONNECT_AFTER_RELOAD_KEY) === '1') {
|
|
||||||
sessionStorage.removeItem(AUTO_RECONNECT_AFTER_RELOAD_KEY);
|
|
||||||
window.setTimeout(() => {
|
|
||||||
const effectiveNickname = sanitizeName(dom.preconnectNickname.value || storedNickname);
|
|
||||||
if (effectiveNickname) {
|
|
||||||
dom.preconnectNickname.value = effectiveNickname;
|
|
||||||
state.player.nickname = effectiveNickname;
|
|
||||||
updateConnectAvailability();
|
|
||||||
void connect();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
updateConnectAvailability();
|
|
||||||
}, 250);
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
// Ignore sessionStorage failures.
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user