Files
justice/www/html/Game/public/dev-local/bootstrap.js
T
2026-05-27 08:02:22 +00:00

47 lines
1.6 KiB
JavaScript

/**
* LOCALHOST ONLY — do NOT add this script to production room-lobby.html
* AppServ: add before other scripts in your LOCAL copy of room-lobby.html:
* <script src="https://srv1361159.hstgr.cloud/Game/dev-local/bootstrap.js"></script>
*/
(function (g) {
'use strict';
var h = (g.location && g.location.hostname || '').toLowerCase();
if (h !== 'localhost' && h !== '127.0.0.1') return;
var PROD = 'https://srv1361159.hstgr.cloud';
var PROD_GAME = PROD + '/Game';
g.GAME_NODE_ORIGIN = PROD;
g.GAME_SERVER = PROD;
g.GAME_API_FETCH_BASE = PROD_GAME;
g.__JD_GAME_API_BASE__ = PROD_GAME;
try {
if (g.localStorage.getItem('isLoggedIn') !== 'true') {
g.localStorage.setItem('isLoggedIn', 'true');
g.localStorage.setItem('loginType', 'guest');
}
if (!(g.localStorage.getItem('playerName') || '').trim()) {
g.localStorage.setItem('playerName', 'DevTester');
}
} catch (e) { /* ignore */ }
if (typeof g.fetch === 'function' && !g.__JD_DEV_LOCAL_FETCH__) {
g.__JD_DEV_LOCAL_FETCH__ = 1;
var nativeFetch = g.fetch.bind(g);
var bad = /^https?:\/\/(?:localhost|127\.0\.0\.1):(3004|3001|3010|13010)\/Game/i;
g.fetch = function (input, init) {
if (typeof input === 'string' && bad.test(input)) {
input = PROD_GAME + input.slice(input.indexOf('/Game') + 5);
}
return nativeFetch(input, init);
};
}
if (!g.io) {
document.write('<script src="' + PROD + '/Game/socket.io/socket.io.js"><\/script>');
}
g.jdDevLocalBootstrapLoaded = true;
})(typeof window !== 'undefined' ? window : this);