mirror of
https://github.com/zumbiepig/MineXLauncher.git
synced 2025-06-07 20:04:48 +00:00
minexlauncher v1.7.2
This commit is contained in:
parent
f5ffc1e94a
commit
441d585ac5
@ -1,6 +1,7 @@
|
||||
import eslint from '@eslint/js';
|
||||
import tseslint from 'typescript-eslint';
|
||||
import eslintConfigPrettier from 'eslint-config-prettier';
|
||||
// import tsdocPlugin from 'eslint-plugin-tsdoc';
|
||||
|
||||
export default tseslint.config(
|
||||
eslint.configs.recommended,
|
||||
@ -9,6 +10,9 @@ export default tseslint.config(
|
||||
...tseslint.configs.stylisticTypeChecked,
|
||||
eslintConfigPrettier,
|
||||
{
|
||||
/* plugins: {
|
||||
tsdoc: tsdocPlugin,
|
||||
}, */
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
projectService: true,
|
||||
@ -25,6 +29,7 @@ export default tseslint.config(
|
||||
'ts-check': true,
|
||||
},
|
||||
],
|
||||
// 'tsdoc/syntax': 'warn',
|
||||
},
|
||||
},
|
||||
);
|
||||
|
@ -28,7 +28,7 @@
|
||||
"devDependencies": {
|
||||
"@tsconfig/bun": "^1.0.7",
|
||||
"@tsconfig/strictest": "^2.0.5",
|
||||
"@types/bun": "^1.1.9",
|
||||
"@types/bun": "^1.1.10",
|
||||
"@types/compression": "^1.7.5",
|
||||
"@types/cookie-parser": "^1.4.7",
|
||||
"@types/errorhandler": "^1.5.3",
|
||||
@ -41,12 +41,12 @@
|
||||
"@types/semver": "^7.5.8",
|
||||
"@types/serve-favicon": "^2.5.7",
|
||||
"errorhandler": "^1.5.1",
|
||||
"eslint": "^9.10.0",
|
||||
"eslint": "^9.11.1",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"html-minifier": "^4.0.0",
|
||||
"javascript-obfuscator": "^4.1.1",
|
||||
"prettier": "^3.3.3",
|
||||
"typescript": "^5.6.2",
|
||||
"typescript-eslint": "^8.5.0"
|
||||
"typescript-eslint": "^8.7.0"
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
<link rel="stylesheet" href="/resources/styles/eagler.css" />
|
||||
<script src="/resources/scripts/google-tag.js"></script>
|
||||
<script src="/game/web/clients/astra/classes.js"></script>
|
||||
<script src="/resources/scripts/eagler-launch/1.8.8/eaglerpocketmobile.js"></script>
|
||||
<script src="/resources/scripts/eagler-launch/1.8.8/main.js"></script>
|
||||
</head>
|
||||
<body id="game_frame"></body>
|
||||
|
@ -11,7 +11,6 @@
|
||||
<script src="/game/web/clients/eaglerforge/ModLoader.js"></script>
|
||||
<script src="/game/web/clients/eaglerforge/ModGUI.js"></script>
|
||||
<script src="/game/web/clients/eaglerforge/classes.js"></script>
|
||||
<script src="/resources/scripts/eagler-launch/1.8.8/eaglermobile-ef.js"></script>
|
||||
<script src="/resources/scripts/eagler-launch/1.8.8/main.js"></script>
|
||||
</head>
|
||||
<body id="game_frame"></body>
|
||||
|
@ -9,7 +9,6 @@
|
||||
<link rel="stylesheet" href="/resources/styles/eagler.css" />
|
||||
<script src="/resources/scripts/google-tag.js"></script>
|
||||
<script src="/game/web/clients/resent/classes.js"></script>
|
||||
<script src="/resources/scripts/eagler-launch/1.8.8/eaglerpocketmobile.js"></script>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: Aller;
|
||||
|
@ -7,7 +7,6 @@
|
||||
<link rel="stylesheet" href="/resources/styles/eagler.css" />
|
||||
<script src="/resources/scripts/google-tag.js"></script>
|
||||
<script src="/game/web/clients/shadow/classes.js"></script>
|
||||
<script src="/resources/scripts/eagler-launch/1.8.8/eaglerpocketmobile.js"></script>
|
||||
<script>
|
||||
function initAPI(version) {
|
||||
var ModAPI = {};
|
||||
|
@ -8,7 +8,6 @@
|
||||
<link rel="stylesheet" href="/resources/styles/eagler.css" />
|
||||
<script src="/resources/scripts/google-tag.js"></script>
|
||||
<script src="/game/web/main/1.11.2/classes.js"></script>
|
||||
<script src="/resources/scripts/eagler-launch/1.8.8/eaglerpocketmobile.js"></script>
|
||||
<script src="/resources/scripts/eagler-launch/1.8.8/main.js"></script>
|
||||
</head>
|
||||
<body id="game_frame"></body>
|
||||
|
@ -8,7 +8,6 @@
|
||||
<link rel="stylesheet" href="/resources/styles/eagler.css" />
|
||||
<script src="/resources/scripts/google-tag.js"></script>
|
||||
<script src="/game/web/main/1.8.8/classes.js"></script>
|
||||
<script src="/resources/scripts/eagler-launch/1.8.8/eaglerpocketmobile.js"></script>
|
||||
<script src="/resources/scripts/eagler-launch/1.8.8/main.js"></script>
|
||||
</head>
|
||||
<body id="game_frame"></body>
|
||||
|
@ -8,7 +8,6 @@
|
||||
<link rel="stylesheet" href="/resources/styles/eagler.css" />
|
||||
<script src="/resources/scripts/google-tag.js"></script>
|
||||
<script src="/game/web/main/1.9.4/classes.js"></script>
|
||||
<script src="/resources/scripts/eagler-launch/1.8.8/eaglerpocketmobile.js"></script>
|
||||
<script src="/resources/scripts/eagler-launch/1.8.8/main.js"></script>
|
||||
</head>
|
||||
<body id="game_frame"></body>
|
||||
|
@ -1,64 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en" style="display: none">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>MineXLauncher</title>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/webp"
|
||||
href="/resources/images/icons/favicon.webp"
|
||||
/>
|
||||
<link rel="stylesheet" href="/resources/styles/themes/default.css" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
id="theme"
|
||||
onload="document.documentElement.style.display = ''"
|
||||
/>
|
||||
<script src="/resources/scripts/google-tag.js"></script>
|
||||
<script src="/resources/scripts/main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="launcher">
|
||||
<span class="title-bar">MineXLauncher</span>
|
||||
<div class="content">
|
||||
<div class="sidebar">
|
||||
<span class="username"></span>
|
||||
<nav class="nav-bar">
|
||||
<li class="selected" onclick="navigate.mobile()">
|
||||
<img src="/resources/images/icons/nav/game.webp" />
|
||||
<span>Mobile Site</span>
|
||||
</li>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="main-panel">
|
||||
<span class="top-title">Mobile</span>
|
||||
<div class="main-content">
|
||||
<img
|
||||
class="cover-image"
|
||||
src="/resources/images/covers/minecraft.webp"
|
||||
/>
|
||||
<div class="installations">
|
||||
<button onclick="game.play('/game/web/main/1.8.8/?mobile=true')">
|
||||
Play
|
||||
</button>
|
||||
<a
|
||||
class="play-button"
|
||||
style="text-decoration: none"
|
||||
href="/game/offline/mobile/EaglerPocketMobile_1.8.8.html"
|
||||
download
|
||||
>Download Offline</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom-bar">
|
||||
<span onclick="window.open('https://discord.gg/VRwbRJjXzt')"
|
||||
>Join the MineXLauncher Discord</span
|
||||
>
|
||||
<span>© 2024 MineXLauncher. All rights reserved.</span>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -42,6 +42,14 @@
|
||||
}
|
||||
],
|
||||
"updates": [
|
||||
{
|
||||
"version": "1.7.2",
|
||||
"changelog": [
|
||||
"Updated EaglercraftX 1.8 to u37",
|
||||
"Added Sweet Cherry 16x texture pack",
|
||||
"New setting to open new tab instead of popup"
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "1.7.1",
|
||||
"changelog": [
|
||||
@ -351,6 +359,14 @@
|
||||
"author": "The REAL Senpai",
|
||||
"authorLink": "https://www.planetminecraft.com/member/the_real_senpai/",
|
||||
"source": "https://www.planetminecraft.com/texture-pack/senpa1-1-8-9-1-16-texture-pack-netherite/"
|
||||
},
|
||||
{
|
||||
"id": "sweet-cherry-16x",
|
||||
"name": "Sweet Cherry 16x",
|
||||
"description": "Sweet Cherry 16x is a pack made for Alcheras reaching 5,000 subscribers! Perfect for 1.8 player vs player such as bedwars, duels & skywars!",
|
||||
"author": "VanillaSpooks",
|
||||
"authorLink": "https://www.planetminecraft.com/member/vanillaspooks/",
|
||||
"source": "https://www.planetminecraft.com/texture-pack/sweet-cherry-16x/"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
BIN
src/resources/mods/downloads/sweet-cherry-16x.zip
Normal file
BIN
src/resources/mods/downloads/sweet-cherry-16x.zip
Normal file
Binary file not shown.
BIN
src/resources/mods/icons/sweet-cherry-16x.webp
Normal file
BIN
src/resources/mods/icons/sweet-cherry-16x.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -1,45 +1,391 @@
|
||||
import { inflate } from 'pako';
|
||||
import { inflate, deflate } from 'pako';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
eaglercraftXOpts: {
|
||||
container: string;
|
||||
assetsURI: string;
|
||||
localesURI?: string;
|
||||
lang?: string;
|
||||
joinServer?: string;
|
||||
worldsDB?: string;
|
||||
resourcePacksDB?: string;
|
||||
demoMode?: boolean;
|
||||
servers: { addr: string; name: string }[];
|
||||
relays: { addr: string; comment: string; primary: boolean }[];
|
||||
checkShaderGLErrors?: boolean;
|
||||
enableDownloadOfflineButton?: boolean;
|
||||
downloadOfflineButtonLink?: string;
|
||||
html5CursorSupport?: boolean;
|
||||
allowUpdateSvc?: boolean;
|
||||
allowUpdateDL?: boolean;
|
||||
logInvalidCerts?: boolean;
|
||||
enableSignatureBadge?: boolean;
|
||||
checkRelaysForUpdates?: boolean;
|
||||
allowVoiceClient?: boolean;
|
||||
allowFNAWSkins?: boolean;
|
||||
localStorageNamespace?: string;
|
||||
enableMinceraft?: boolean;
|
||||
hooks?: {
|
||||
localStorageSaved?: (key: string, data: string) => void;
|
||||
localStorageLoaded?: (key: string) => string | null;
|
||||
};
|
||||
Mods?: string[];
|
||||
};
|
||||
eaglercraftXOpts: EaglercraftXOpts;
|
||||
main: () => void;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The EaglercraftX 1.8 client is configured primarily through a variable called window.eaglercraftXOpts that must be set before the client starts up.
|
||||
* @default
|
||||
* const relayId = Math.floor(Math.random() * 3);
|
||||
* window.eaglercraftXOpts = {
|
||||
* demoMode: false,
|
||||
* container: "game_frame",
|
||||
* assetsURI: "assets.epk",
|
||||
* localesURI: "lang/",
|
||||
* worldsDB: "worlds",
|
||||
* servers: [
|
||||
* { addr: "ws://localhost:8081/", name: "Local test server" }
|
||||
* ],
|
||||
* 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 }
|
||||
* ],
|
||||
* };
|
||||
*/
|
||||
interface EaglercraftXOpts {
|
||||
/**
|
||||
* the ID of the HTML element to create the canvas in
|
||||
* @default 'game_frame'
|
||||
*/
|
||||
container: string;
|
||||
/**
|
||||
* the URL of the assets.epk file
|
||||
* @default 'assets.epk'
|
||||
*/
|
||||
assetsURI: string;
|
||||
/**
|
||||
* the URL where extra .lang files can be found
|
||||
* @default 'lang/'
|
||||
*/
|
||||
localesURI?: string;
|
||||
/**
|
||||
* the default language to use for the game
|
||||
* @default 'en_US'
|
||||
*/
|
||||
lang?: string;
|
||||
/**
|
||||
* server address to join when the game launches
|
||||
*/
|
||||
joinServer?: string;
|
||||
/**
|
||||
* the name of the IndexedDB database to store worlds in
|
||||
* @default 'worlds'
|
||||
*/
|
||||
worldsDB?: string;
|
||||
/**
|
||||
* the name of the IndexedDB database to store resource packs in
|
||||
* @default 'resourcePacks'
|
||||
*/
|
||||
resourcePacksDB?: string;
|
||||
/**
|
||||
* whether to launch the game in java edition demo mode
|
||||
* @default false
|
||||
*/
|
||||
demoMode?: boolean;
|
||||
/**
|
||||
* a list of default servers to display on the Multiplayer screen
|
||||
* @default
|
||||
* [
|
||||
* {
|
||||
* "addr": "ws://localhost:8081/",
|
||||
* "hideAddr": false,
|
||||
* "name": "Local test server"
|
||||
* }
|
||||
* ]
|
||||
*/
|
||||
servers?: {
|
||||
/**
|
||||
* server address
|
||||
*/
|
||||
addr: string;
|
||||
/**
|
||||
* whether to hide the server address
|
||||
* @default false
|
||||
*/
|
||||
hideAddr?: boolean;
|
||||
/**
|
||||
* server name
|
||||
*/
|
||||
name: string;
|
||||
}[];
|
||||
/**
|
||||
* the default list of shared world relays to use for invites
|
||||
* @default
|
||||
* [
|
||||
* {
|
||||
* "addr": "wss://relay.deev.is/",
|
||||
* "primary": "$random_relay_primary_0",
|
||||
* "comment": "lax1dude relay #1"
|
||||
* },
|
||||
* {
|
||||
* "addr": "wss://relay.lax1dude.net/",
|
||||
* "primary": "$random_relay_primary_1",
|
||||
* "comment": "lax1dude relay #2"
|
||||
* },
|
||||
* {
|
||||
* "addr": "wss://relay.shhnowisnottheti.me/",
|
||||
* "primary": "$random_relay_primary_2",
|
||||
* "comment": "ayunami relay #1"
|
||||
* }
|
||||
* ]
|
||||
*/
|
||||
relays?: {
|
||||
/**
|
||||
* relay address
|
||||
*/
|
||||
addr: string;
|
||||
/**
|
||||
* relay name
|
||||
*/
|
||||
comment: string;
|
||||
/**
|
||||
* primary relay
|
||||
* @default false
|
||||
*/
|
||||
primary?: boolean;
|
||||
}[];
|
||||
/**
|
||||
* enables more verbose opengl error logging for the shaders
|
||||
* @default false
|
||||
*/
|
||||
checkShaderGLErrors?: boolean;
|
||||
/**
|
||||
* whether to show a "Download Offline" button on the title screen
|
||||
* @default true
|
||||
*/
|
||||
enableDownloadOfflineButton?: boolean;
|
||||
/**
|
||||
* overrides the download link for the "Download Offline" button
|
||||
*/
|
||||
downloadOfflineButtonLink?: string;
|
||||
/**
|
||||
* enables support for showing the CSS "pointer" cursor over buttons
|
||||
* @default false
|
||||
*/
|
||||
html5CursorSupport?: boolean;
|
||||
/**
|
||||
* enables the certificate-based update system
|
||||
* @default true
|
||||
*/
|
||||
allowUpdateSvc?: boolean;
|
||||
/**
|
||||
* allows the client to download new updates it finds
|
||||
* @default true
|
||||
*/
|
||||
allowUpdateDL?: boolean;
|
||||
/**
|
||||
* print update certificates with invalid signatures to console
|
||||
* @default false
|
||||
*/
|
||||
logInvalidCerts?: boolean;
|
||||
/**
|
||||
* show a badge on the title screen indicating if digital signature is valid
|
||||
* @default false
|
||||
*/
|
||||
enableSignatureBadge?: boolean;
|
||||
/**
|
||||
* proprietary feature used in offline downloads
|
||||
* @default true
|
||||
*/
|
||||
checkRelaysForUpdates?: boolean;
|
||||
/**
|
||||
* can be used to disable the voice chat feature
|
||||
* @default true
|
||||
*/
|
||||
allowVoiceClient?: boolean;
|
||||
/**
|
||||
* can be used to disable the high poly FNAW skins
|
||||
* @default true
|
||||
*/
|
||||
allowFNAWSkins?: boolean;
|
||||
/**
|
||||
* can be used to change the prefix of the local storage keys
|
||||
* @default '_eaglercraftX'
|
||||
*/
|
||||
localStorageNamespace?: string;
|
||||
/**
|
||||
* can be used to disable the "Minceraft" title screen
|
||||
* @default true
|
||||
*/
|
||||
enableMinceraft?: boolean;
|
||||
/**
|
||||
* display crash reports when `window.onerror` is fired
|
||||
* @default false
|
||||
*/
|
||||
crashOnUncaughtExceptions?: boolean;
|
||||
/**
|
||||
* open debug console automatically at launch
|
||||
* @default false
|
||||
*/
|
||||
openDebugConsoleOnLaunch?: boolean;
|
||||
/**
|
||||
* close debug console beforeunload instead of unload
|
||||
* @default false
|
||||
*/
|
||||
fixDebugConsoleUnloadListener?: boolean;
|
||||
/**
|
||||
* if the server info webview should be allowed even on browsers without the required safety features
|
||||
* @default false
|
||||
*/
|
||||
forceWebViewSupport?: boolean;
|
||||
/**
|
||||
* if the `csp` attibute should be set on the server info webview for extra security
|
||||
* @default true
|
||||
*/
|
||||
enableWebViewCSP?: boolean;
|
||||
/**
|
||||
* can be used to disable server cookies
|
||||
* @default true
|
||||
*/
|
||||
enableServerCookies?: boolean;
|
||||
/**
|
||||
* if servers should be allowed to make the client reconnect to a different address
|
||||
* @default true
|
||||
*/
|
||||
allowServerRedirects?: boolean;
|
||||
/**
|
||||
* if the viewport meta tag and style attributes on old offline downloads and websites should be automatically patched
|
||||
* @default true
|
||||
*/
|
||||
autoFixLegacyStyleAttr?: boolean;
|
||||
/**
|
||||
* if the client should always show the boot menu on every launch
|
||||
* @default false
|
||||
*/
|
||||
showBootMenuOnLaunch?: boolean;
|
||||
/**
|
||||
* if the boot menu should only be allowed to launch signed clients
|
||||
* @default false
|
||||
*/
|
||||
bootMenuBlocksUnsignedClients?: boolean;
|
||||
/**
|
||||
* can be used to disable the boot menu entirely
|
||||
* @default false
|
||||
*/
|
||||
allowBootMenu?: boolean;
|
||||
/**
|
||||
* if the profanity filter should be forced enabled
|
||||
* @default false
|
||||
*/
|
||||
forceProfanityFilter?: boolean;
|
||||
/**
|
||||
* if the game should force the browser to only use WebGL 1.0 for the canvas
|
||||
* @default false
|
||||
*/
|
||||
forceWebGL1?: boolean;
|
||||
/**
|
||||
* if the game should force the browser to only use WebGL 2.0 for the canvas
|
||||
* @default false
|
||||
*/
|
||||
forceWebGL2?: boolean;
|
||||
/**
|
||||
* if the game should be allowed to create an `experimental-webgl` context
|
||||
* @default true
|
||||
*/
|
||||
allowExperimentalWebGL1?: boolean;
|
||||
/**
|
||||
* can be used to disable all OpenGL ES extensions to test the game on a pure WebGL 1.0/2.0 context
|
||||
* @default true
|
||||
*/
|
||||
useWebGLExt?: boolean;
|
||||
/**
|
||||
* if the game should `setTimeout(..., 0)` every frame instead of using MessageChannel hacks
|
||||
* @default false
|
||||
*/
|
||||
useDelayOnSwap?: boolean;
|
||||
/**
|
||||
* if OGG vorbis files should be decoded using the JOrbis Java OGG decoder instead of using the browser
|
||||
* @default false
|
||||
*/
|
||||
useJOrbisAudioDecoder?: boolean;
|
||||
/**
|
||||
* if the game should use XMLHttpRequest for downloading resources instead of the fetch API
|
||||
* @default false
|
||||
*/
|
||||
useXHRFetch?: boolean;
|
||||
/**
|
||||
* if the game should resize some GUIs relative to `window.visualViewport` (needed on mobile browsers when the keyboard is open)
|
||||
* @default true
|
||||
*/
|
||||
useVisualViewport?: boolean;
|
||||
/**
|
||||
* can be used to disable the runtime stack-trace deobfuscation, reduces micro stutters if the game is logging errors
|
||||
* @default true
|
||||
*/
|
||||
deobfStackTraces?: boolean;
|
||||
/**
|
||||
* if the game should use `data:` URLs instead of `blob:` URLs for loading certain resources
|
||||
* @default false
|
||||
*/
|
||||
disableBlobURLs?: boolean;
|
||||
/**
|
||||
* can be used to disable "Vigg's Algorithm", an algorithm that delays and combines multiple EaglercraftX packets together if they are sent in the same tick (does not affect regular Minecraft 1.8 packets)
|
||||
* @default false
|
||||
*/
|
||||
eaglerNoDelay?: boolean;
|
||||
/**
|
||||
* if worlds and resource packs should be stored in RAM instead of IndexedDB
|
||||
* @default false
|
||||
*/
|
||||
ramdiskMode?: boolean;
|
||||
/**
|
||||
* if the game should run the client and integrated server in the same context instead of creating a worker object
|
||||
* @default false
|
||||
*/
|
||||
singleThreadMode?: boolean;
|
||||
/**
|
||||
* can be used to define JavaScript callbacks for certain events
|
||||
*/
|
||||
hooks?: {
|
||||
/**
|
||||
* JavaScript callback to save local storage keys
|
||||
* @param key local storage key name as a string
|
||||
* @param data base64-encoded byte array as a string
|
||||
*/
|
||||
localStorageSaved?: (key: 'p' | 'g' | 's' | 'r', data: string) => void;
|
||||
/**
|
||||
* JavaScript callback to load local storage keys
|
||||
* @param key local storage key name as a string
|
||||
* @returns base64-encoded byte array as a string or `null` if the key does not exist
|
||||
*/
|
||||
localStorageLoaded?: (key: 'p' | 'g' | 's' | 'r') => string | null;
|
||||
/**
|
||||
* JavaScript callback when a crash report is shown
|
||||
* @param report crash report as a string
|
||||
* @param customMessageCB callback function for appending text
|
||||
*/
|
||||
crashReportShow?: (
|
||||
report: string,
|
||||
customMessageCB: (customMessage: string) => void,
|
||||
) => void;
|
||||
/**
|
||||
* JavaScript callback when the screen changes/resizes
|
||||
* @param screenName screen name
|
||||
* @param scaledWidth scaled width
|
||||
* @param scaledHeight scaled height
|
||||
* @param realWidth real width
|
||||
* @param realHeight real height
|
||||
* @param scaleFactor scale factor
|
||||
*/
|
||||
screenChanged?: (
|
||||
screenName: string,
|
||||
scaledWidth: number,
|
||||
scaledHeight: number,
|
||||
realWidth: number,
|
||||
realHeight: number,
|
||||
scaleFactor: number,
|
||||
) => void;
|
||||
};
|
||||
/**
|
||||
* lets you load EaglerForge mods from eaglercraftxopts
|
||||
* @example ['example.js', 'anothermod.js']
|
||||
*/
|
||||
Mods?: string[];
|
||||
}
|
||||
|
||||
const base64Gzip = {
|
||||
compress: function (string: string): string {
|
||||
return btoa(
|
||||
String.fromCharCode(...deflate(new TextEncoder().encode(string))),
|
||||
);
|
||||
},
|
||||
decompress: function (string: string): string {
|
||||
return inflate(
|
||||
Uint8Array.from(atob(string), (c) => c.charCodeAt(0)),
|
||||
{ to: 'string' },
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
const storage = {
|
||||
local: {
|
||||
get: function (key: string) {
|
||||
const item = localStorage.getItem('minexlauncher');
|
||||
const item = localStorage.getItem('minexlauncher-v2');
|
||||
if (item !== null) {
|
||||
const json = JSON.parse(base64Gzip.decompress(item));
|
||||
if (json[key] !== undefined) {
|
||||
@ -49,15 +395,27 @@ const storage = {
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const base64Gzip = {
|
||||
decompress: function (string: string): string {
|
||||
return inflate(
|
||||
Uint8Array.from(atob(string), (c) => c.charCodeAt(0)),
|
||||
{ to: 'string' },
|
||||
);
|
||||
set: function (
|
||||
key: string,
|
||||
value: string | number | object | boolean | null | undefined,
|
||||
) {
|
||||
const item = localStorage.getItem('minexlauncher-v2');
|
||||
if (item === null) {
|
||||
const json: Record<string, unknown> = {};
|
||||
json[key] = value;
|
||||
localStorage.setItem(
|
||||
'minexlauncher-v2',
|
||||
base64Gzip.compress(JSON.stringify(json)),
|
||||
);
|
||||
} else {
|
||||
const json = JSON.parse(base64Gzip.decompress(item));
|
||||
json[key] = value;
|
||||
localStorage.setItem(
|
||||
'minexlauncher-v2',
|
||||
base64Gzip.compress(JSON.stringify(json)),
|
||||
);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@ -88,6 +446,39 @@ window.eaglercraftXOpts = {
|
||||
primary: randomRelay === 2,
|
||||
},
|
||||
],
|
||||
hooks: {
|
||||
localStorageSaved: (key, data) => {
|
||||
const dataStorage = storage.local.get('eaglercraftXData') ?? {};
|
||||
switch (key) {
|
||||
case 'p':
|
||||
dataStorage.profile = data;
|
||||
break;
|
||||
case 'g':
|
||||
dataStorage.settings = data;
|
||||
break;
|
||||
case 's':
|
||||
dataStorage.servers = data;
|
||||
break;
|
||||
case 'r':
|
||||
dataStorage.relays = data;
|
||||
break;
|
||||
}
|
||||
storage.local.set('eaglercraftXData', dataStorage);
|
||||
},
|
||||
localStorageLoaded: (key) => {
|
||||
const data = storage.local.get('eaglercraftXData');
|
||||
switch (key) {
|
||||
case 'p':
|
||||
return data.profile ? data.profile : null;
|
||||
case 'g':
|
||||
return data.settings ? data.settings : null;
|
||||
case 's':
|
||||
return data.servers ? data.servers : null;
|
||||
case 'r':
|
||||
return data.relays ? data.relays : null;
|
||||
}
|
||||
},
|
||||
},
|
||||
Mods: storage.local.get('mods') ?? [],
|
||||
};
|
||||
|
||||
|
@ -108,7 +108,11 @@ const game = {
|
||||
if (console) console.style.display = 'flex';
|
||||
|
||||
if (!window.gameWindow || window.gameWindow.closed) {
|
||||
window.gameWindow = window.open('about:blank', '_blank', 'popup');
|
||||
window.gameWindow = window.open(
|
||||
'about:blank',
|
||||
'_blank',
|
||||
`popup=${storage.local.get('noPopup') ? 'false' : 'true'}`,
|
||||
);
|
||||
if (window.gameWindow) {
|
||||
window.gameWindow.document.title = 'MineXLauncher';
|
||||
const icon = window.gameWindow.document.createElement('link');
|
||||
@ -291,11 +295,6 @@ const navigate = {
|
||||
storage.session.set('lastPage', navUrl);
|
||||
window.location.href = navUrl;
|
||||
},
|
||||
mobile: function () {
|
||||
const navUrl = '/mobile/';
|
||||
storage.session.set('lastPage', navUrl);
|
||||
window.location.href = navUrl;
|
||||
},
|
||||
updates: function () {
|
||||
const navUrl = '/updates/';
|
||||
storage.session.set('lastPage', navUrl);
|
||||
@ -683,15 +682,12 @@ function downloadFile(url: string, name?: string) {
|
||||
|
||||
if (window.location.pathname === '/') {
|
||||
const lastPage = storage.session.get('lastPage');
|
||||
const isMobile = detect.mobile();
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.src = !storage.local.get('lastVersion')
|
||||
? '/welcome/'
|
||||
: lastPage
|
||||
? lastPage
|
||||
: isMobile
|
||||
? '/mobile/'
|
||||
: '/home/game/';
|
||||
: '/home/game/';
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.body.append(iframe);
|
||||
@ -794,6 +790,9 @@ if (window.location.pathname === '/settings/general/') {
|
||||
const themeSelect = document.querySelector(
|
||||
'#theme-select',
|
||||
) as HTMLSelectElement | null;
|
||||
const noPopupCheckbox = document.querySelector(
|
||||
'#no-popup-checkbox',
|
||||
) as HTMLInputElement | null;
|
||||
const offlineCheckbox = document.querySelector(
|
||||
'#offline-checkbox',
|
||||
) as HTMLInputElement | null;
|
||||
@ -831,6 +830,13 @@ if (window.location.pathname === '/settings/general/') {
|
||||
);
|
||||
}
|
||||
|
||||
if (noPopupCheckbox) {
|
||||
noPopupCheckbox.checked = storage.local.get('noPopup');
|
||||
noPopupCheckbox.addEventListener('change', () =>
|
||||
storage.local.set('noPopup', noPopupCheckbox.checked),
|
||||
);
|
||||
}
|
||||
|
||||
if (offlineCheckbox) {
|
||||
offlineCheckbox.checked = storage.local.get('offlineCache') ?? false;
|
||||
offlineCheckbox.addEventListener('change', () => {
|
||||
@ -915,6 +921,7 @@ if (window.location.pathname === '/settings/general/') {
|
||||
|
||||
storage.local.set('username', username);
|
||||
storage.local.set('theme', themeSelect?.value ?? 'default');
|
||||
storage.local.set('noPopup', false);
|
||||
// storage.local.set('offlineCache', offlineCheckbox?.checked ?? false);
|
||||
// storage.local.set('showAds', true);
|
||||
storage.local.set('mods', []);
|
||||
@ -1026,5 +1033,6 @@ if (window.location.hostname === null) {
|
||||
consoleLog,
|
||||
openAboutBlank,
|
||||
$,
|
||||
detect,
|
||||
]);
|
||||
}
|
||||
|
@ -1,12 +1,13 @@
|
||||
html {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0px;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
background-color: #1e1e1e;
|
||||
background-image: url('/resources/images/icons/loading.webp');
|
||||
background-repeat: no-repeat;
|
||||
background-attachment: fixed;
|
||||
background-position: center;
|
||||
background-size: 15vh;
|
||||
background-color: black;
|
||||
}
|
||||
|
@ -79,6 +79,8 @@
|
||||
<select id="theme-select">
|
||||
<option disabled hidden value=""></option>
|
||||
</select>
|
||||
<label for="no-popup">Open new tab instead of popup:</label>
|
||||
<input id="no-popup-checkbox" type="checkbox" />
|
||||
<!-- <label for="offline-checkbox">Enable offline use:</label>
|
||||
<input id="offline-checkbox" type="checkbox" /> -->
|
||||
<!-- <label for="ads-checkbox">Show ads:</label>
|
||||
|
Loading…
x
Reference in New Issue
Block a user