mirror of
https://github.com/zumbiepig/MineXLauncher.git
synced 2025-06-08 09:24:48 +00:00
66 lines
1.7 KiB
TypeScript
66 lines
1.7 KiB
TypeScript
// @ts-nocheck
|
|
import { inflate } from 'pako';
|
|
const storage = {
|
|
local: {
|
|
get: function (key: string) {
|
|
const item = localStorage.getItem('minexlauncher');
|
|
if (item !== null) {
|
|
const json = JSON.parse(base64Gzip.decompress(item));
|
|
if (json[key] !== undefined) {
|
|
return json[key];
|
|
}
|
|
return undefined;
|
|
}
|
|
return undefined;
|
|
},
|
|
},
|
|
};
|
|
const base64Gzip = {
|
|
decompress: function (string: string): string {
|
|
return inflate(
|
|
Uint8Array.from(atob(string), (c) => c.charCodeAt(0)),
|
|
{ to: 'string' },
|
|
);
|
|
},
|
|
};
|
|
|
|
window.addEventListener('load', () => {
|
|
const relayId = Math.floor(Math.random() * 3);
|
|
window.eaglercraftXOpts = {
|
|
container: 'game_frame',
|
|
assetsURI: `${window.location.pathname}/assets.epk`,
|
|
localesURI: `${window.location.pathname}/lang/`,
|
|
servers: [
|
|
{ addr: 'wss://webmc.xyz/server', name: 'WebMC OneBlock' },
|
|
{ addr: 'wss://mc.ricenetwork.xyz', name: 'Rice Network' },
|
|
{ addr: 'wss://mc.lamplifesteal.xyz', name: 'LampLifesteal' },
|
|
{ addr: 'wss://electronmc.club', name: 'Electron Network' },
|
|
{ addr: 'wss://play.brickmc.net', name: 'BrickMC' },
|
|
],
|
|
relays: [
|
|
{
|
|
addr: 'wss://relay.deev.is/',
|
|
comment: 'lax1dude relay #1',
|
|
primary: relayId === 0,
|
|
},
|
|
{
|
|
addr: 'wss://relay.lax1dude.net/',
|
|
comment: 'lax1dude relay #2',
|
|
primary: relayId === 1,
|
|
},
|
|
{
|
|
addr: 'wss://relay.shhnowisnottheti.me/',
|
|
comment: 'ayunami relay #1',
|
|
primary: relayId === 2,
|
|
},
|
|
],
|
|
};
|
|
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
window.eaglercraftXOpts.joinServer = urlParams.get('server') ?? undefined;
|
|
window.eaglercraftXOpts.Mods = storage.local.get('mods') ?? [];
|
|
|
|
history.replaceState({}, '', '/play');
|
|
main();
|
|
});
|