mirror of
https://github.com/zumbiepig/MineXLauncher.git
synced 2025-06-08 09:24:48 +00:00
.
This commit is contained in:
parent
71999367c6
commit
3928bab178
@ -20,6 +20,7 @@
|
|||||||
"express": "^4.19.2",
|
"express": "^4.19.2",
|
||||||
"helmet": "^7.1.0",
|
"helmet": "^7.1.0",
|
||||||
"morgan": "^1.10.0",
|
"morgan": "^1.10.0",
|
||||||
|
"pako": "^2.1.0",
|
||||||
"semver": "^7.6.3",
|
"semver": "^7.6.3",
|
||||||
"serve-favicon": "^2.5.0"
|
"serve-favicon": "^2.5.0"
|
||||||
},
|
},
|
||||||
@ -32,6 +33,7 @@
|
|||||||
"@types/errorhandler": "^1.5.3",
|
"@types/errorhandler": "^1.5.3",
|
||||||
"@types/eslint__js": "^8.42.3",
|
"@types/eslint__js": "^8.42.3",
|
||||||
"@types/morgan": "^1.9.9",
|
"@types/morgan": "^1.9.9",
|
||||||
|
"@types/pako": "^2.0.3",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.5.8",
|
||||||
"@types/serve-favicon": "^2.5.7",
|
"@types/serve-favicon": "^2.5.7",
|
||||||
"eslint": "^9.9.1",
|
"eslint": "^9.9.1",
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { gt, coerce } from 'semver';
|
import { gt, coerce } from 'semver';
|
||||||
|
import { inflate, deflate } from 'pako';
|
||||||
|
|
||||||
let selectedVersion: string;
|
let selectedVersion: string;
|
||||||
|
|
||||||
@ -308,6 +309,44 @@ const serviceworker = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const base64Gzip = {
|
||||||
|
decode: function (base64: string) {
|
||||||
|
// Decode Base64 to binary string
|
||||||
|
const binaryString = atob(base64);
|
||||||
|
|
||||||
|
// Convert binary string to Uint8Array
|
||||||
|
const len = binaryString.length;
|
||||||
|
const bytes = new Uint8Array(len);
|
||||||
|
for (let i = 0; i < len; i++) {
|
||||||
|
bytes[i] = binaryString.charCodeAt(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use pako to decompress the Uint8Array
|
||||||
|
const decompressed = inflate(bytes, { to: 'string' });
|
||||||
|
|
||||||
|
return decompressed;
|
||||||
|
},
|
||||||
|
encode: function (inputString: string) {
|
||||||
|
// Convert the input string to a Uint8Array
|
||||||
|
const encoder = new TextEncoder();
|
||||||
|
const inputBytes = encoder.encode(inputString);
|
||||||
|
|
||||||
|
// Use pako to compress the Uint8Array
|
||||||
|
const compressedBytes = deflate(inputBytes);
|
||||||
|
|
||||||
|
// Convert the compressed Uint8Array to a binary string
|
||||||
|
let binaryString = '';
|
||||||
|
for (const byte of compressedBytes) {
|
||||||
|
binaryString += String.fromCharCode(byte);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Encode the binary string to Base64
|
||||||
|
const base64String = btoa(binaryString);
|
||||||
|
|
||||||
|
return base64String;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
theme.load();
|
theme.load();
|
||||||
|
|
||||||
if (detect.mobile()) {
|
if (detect.mobile()) {
|
||||||
@ -527,5 +566,5 @@ if (window.location.pathname === '/settings/') {
|
|||||||
|
|
||||||
if (window.location.hostname === null) {
|
if (window.location.hostname === null) {
|
||||||
// Stop the minifier from removing these functions
|
// Stop the minifier from removing these functions
|
||||||
console.debug([navigate, query, versionSelector, game, mods]);
|
console.debug([navigate, query, versionSelector, game, mods, base64Gzip]);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user