From fd96792fa917d16d1b192da653cf8f513f3f956f Mon Sep 17 00:00:00 2001 From: onlypuppy7 <35199523+onlypuppy7@users.noreply.github.com> Date: Sun, 24 Nov 2024 22:45:26 +0000 Subject: [PATCH] fix the borkiness on starting up after update --- .../src/client-static/src/shellshock.min.js | 75 ++++++++++++++----- 1 file changed, 56 insertions(+), 19 deletions(-) diff --git a/server-client/src/client-static/src/shellshock.min.js b/server-client/src/client-static/src/shellshock.min.js index c21cb519..e74bfece 100644 --- a/server-client/src/client-static/src/shellshock.min.js +++ b/server-client/src/client-static/src/shellshock.min.js @@ -2731,22 +2731,40 @@ function setGameTypeSelect() { // [LS] Load Sequence: Startup function onPageLoaded () { alreadyLoaded = true; - devlog("onPageLoaded"); + devlog("onPageLoaded", 0); selectedServer = getStoredNumber("selectedServer", 0); lastVer = getStoredString("lastVersionPlayed", version); localStorage.setItem("lastVersionPlayed", version); + devlog("onPageLoaded", 1); + var lastZipTimes = getStoredString("lastZipTimes", 0); localStorage.setItem("lastZipTimes", latestZipTimes); + devlog("onPageLoaded", 2); + localStorage.uuid = localStorage.uuid || Math.randomInt(1,4294967295); - if (lastVer != version || lastZipTimes != latestZipTimes) return (req = window.indexedDB.deleteDatabase(babylonDB)).onerror = function (event) { - window.location.reload(true) - }, void (req.onsuccess = function (event) { - window.location.reload(true) - }); + devlog("onPageLoaded", 3); + + var indexedDBdeleteDatabase; + + if (lastVer != version || lastZipTimes != latestZipTimes) { + indexedDBdeleteDatabase = true; + var req = window.indexedDB.deleteDatabase(babylonDB) + return req.onerror = function (event) { + window.location.reload(true); + }, void (req.onsuccess = function (event) { + window.location.reload(true) + }); + }; + + setTimeout(()=>{ + if (indexedDBdeleteDatabase) window.location.reload(true); + }, 2500); + + devlog("onPageLoaded", 4); // var req; @@ -2758,15 +2776,20 @@ function onPageLoaded () { localStorage || (str += "
  • LocalStorage", missingFeatures++); void 0 === new KeyboardEvent("").key && (str += "
  • KeyboardEvent.key", missingFeatures++); + devlog("onPageLoaded", 5); if (0 < missingFeatures) { str = 1 == missingFeatures ? "Your browser is missing a feature that LegacyShell requires:
    " : "Your browser is missing features that LegacyShell requires:
    "; openAlertDialog("Oh, no!", '
    ' + (str += "Downloading the latest version of your browser of choice will usually correct this. Internet Explorer is not supported.") + "
    "); } else { + devlog("onPageLoaded", 6); + chatInEl = document.getElementById("chatIn"); chatOutEl = document.getElementById("chatOut"); killEl = document.getElementById("killTicker"); "undefined" != typeof noAdBlock && (adBlock = false); + + devlog("onPageLoaded", 7); // document.getElementById("privacyOptionsLink").style.display = isFromEU ? "block" : "none"; gameType = getStoredNumber("gameType", 0); @@ -2774,6 +2797,8 @@ function onPageLoaded () { gameTypeSelect.selectedIndex = -1; setGameTypeSelect(); + + devlog("onPageLoaded", 8); (function () { var container = document.getElementById("bindingsContainer"); @@ -2791,11 +2816,19 @@ function onPageLoaded () { var nameCell = document.createElement("span"); nameCell.className = "label", nameCell.innerText = getLocText("ui_settings_bind_" + settingsKeyNames[k]), row.appendChild(nameCell), container.appendChild(row) }; + + devlog("onPageLoaded", 9); }()); + + devlog("onPageLoaded", 10); loadSettings(); + + devlog("onPageLoaded", 11); refreshMapPool(); + + devlog("onPageLoaded", 12); var playerList = document.getElementById("playerList"); var slotTemplate = document.getElementById("playerSlot"); @@ -2803,6 +2836,8 @@ function onPageLoaded () { var slot = slotTemplate.cloneNode(true); playerList.appendChild(slot) }; + + devlog("onPageLoaded", 13); for (var containerEl = document.getElementById("leaderboard"), team = 0; team < 3; team++) { var teamEl = document.getElementById("teamSummary").cloneNode(true); @@ -2814,6 +2849,8 @@ function onPageLoaded () { }; containerEl.appendChild(teamEl) }; + + devlog("onPageLoaded", 14); fetchTwitchStreams(); fetchServicesInfo(); @@ -3495,21 +3532,21 @@ function loadSounds(onComplete) { //6th, loads sounds (who knew?) }; function loadObjectMeshes (scene, onComplete) { //7th, loads basically all the things in the models/ folder (name from deobf leak) - // loadMeshes(scene, "models.zip", null, onComplete); + loadMeshes(scene, "models.zip?LEGACYSHELLMAPZIPTIMESTAMP", null, onComplete); //old - loadMeshes(scene, [ - "egg", - "gun_eggk47", - "gun_csg1", - "gun_cluck9mm", - "gun_dozenGauge", - "gun_rpegg", - "munitions", - "muzzleFlash", - "items", - "reticle" - ], null, onComplete); + // loadMeshes(scene, [ + // "egg", + // "gun_eggk47", + // "gun_csg1", + // "gun_cluck9mm", + // "gun_dozenGauge", + // "gun_rpegg", + // "munitions", + // "muzzleFlash", + // "items", + // "reticle" + // ], null, onComplete); }; //8th is defined below from the import