From 160725594898c682a5458a78cbfc0c814d795855 Mon Sep 17 00:00:00 2001 From: peshomir <80340328+peshomir@users.noreply.github.com> Date: Tue, 30 Dec 2025 21:34:41 +0200 Subject: [PATCH] Automatic patches for the custom lobby version --- patches/misc.js | 10 ++++++++++ src/main.js | 13 +++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/patches/misc.js b/patches/misc.js index 2070f27..b90e80e 100644 --- a/patches/misc.js +++ b/patches/misc.js @@ -1,4 +1,5 @@ import { definePatch, insert } from "../modUtils.js" +import { styleText } from "node:util"; export default definePatch(({ insertCode, modifyCode }) => { @@ -13,4 +14,13 @@ export default definePatch(({ insertCode, modifyCode }) => { return; } ${insert(`if (!__fx.settings.hidePropagandaPopup && !__fx.customLobby.isActive())`)} a.g.h(5);`) + // for the custom lobby version + try { + modifyCode(`new a("⚔️
" + __L(), function() { + ${insert(`if (__fx.isCustomLobbyVersion) alert("This version is for use with custom lobbies only. For normal multiplayer, use the version at https://fxclient.github.io/FXclient/") + else`)} b(0); + }, ${insert(`__fx.isCustomLobbyVersion ? "rgba(50, 50, 50, 0.6)" : `)} c.d)`) + } catch (error) { + console.warn(styleText("yellow", `Warning: failed to apply patches specific to the custom lobby version`)) + } }) \ No newline at end of file diff --git a/src/main.js b/src/main.js index 54b848a..b00ae53 100644 --- a/src/main.js +++ b/src/main.js @@ -14,15 +14,16 @@ import customLobby from './customLobby.js'; import { displayChangelog } from './changelog.js'; import { reportError } from './debugging.js'; -const savedVersion = localStorage.getItem("fx_version"); -if (savedVersion !== version) { - localStorage.setItem("fx_version", version); - if (savedVersion !== null) displayChangelog(); -} - window.__fx = window.__fx || {}; const __fx = window.__fx; __fx.version = version + " " + lastUpdated; +__fx.isCustomLobbyVersion = window.location.href.startsWith("https://fxclient.github.io/custom-lobbies") + +const savedVersion = localStorage.getItem("fx_version"); +if (savedVersion !== version && !__fx.isCustomLobbyVersion) { + localStorage.setItem("fx_version", version); + if (savedVersion !== null) displayChangelog(); +} __fx.settingsManager = settingsManager; __fx.leaderboardFilter = leaderboardFilter;