1
0
mirror of https://github.com/zumbiepig/MineXLauncher.git synced 2025-06-08 09:24:48 +00:00

yes i fixed it

This commit is contained in:
zumbiepig 2024-08-31 07:39:46 -07:00
parent 68909ee789
commit c465125c13
No known key found for this signature in database
GPG Key ID: 17C891BE28B953DE
2 changed files with 18 additions and 16 deletions

View File

@ -33,6 +33,7 @@ const srcFilesArr = getFiles(join(import.meta.dir, 'src'));
await build({ await build({
entrypoints: srcFilesArr, entrypoints: srcFilesArr,
outdir: './public/', outdir: './public/',
target: 'browser',
root: './src/', root: './src/',
minify: { minify: {
syntax: true, syntax: true,
@ -48,9 +49,11 @@ console.log(chalk.cyan('Generating assets list...\n'));
const publicDir = join(import.meta.dir, 'public'); const publicDir = join(import.meta.dir, 'public');
writeFileSync( writeFileSync(
join(publicDir, 'assets.json'), join(publicDir, 'assets.json'),
JSON.stringify(getFiles(publicDir)) JSON.stringify(
.replace(new RegExp(`^${publicDir}`), '') getFiles(publicDir).map((asset) => {
.replace(/\/index\.html$/, '/') return asset.replace(new RegExp(`^${publicDir}`), '').replace(/\/index\.html$/, '/');
})
)
); );
console.log(chalk.green('Build complete!\n')); console.log(chalk.green('Build complete!\n'));

View File

@ -91,8 +91,6 @@ const game = {
}, },
}; };
// @ts-expect-error
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const navigate = { const navigate = {
home: { home: {
game: function () { game: function () {
@ -156,8 +154,6 @@ const navigate = {
}, },
}; };
// @ts-expect-error
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const cookie = { const cookie = {
set: function (key: string, value: string, days: number) { set: function (key: string, value: string, days: number) {
let maxAge; let maxAge;
@ -250,8 +246,6 @@ const storage = {
}, },
}; };
// @ts-expect-error
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const query = { const query = {
get: function (name: string) { get: function (name: string) {
return new URLSearchParams(window.top?.location.search).get(name); return new URLSearchParams(window.top?.location.search).get(name);
@ -353,12 +347,11 @@ if (window.location.pathname === '/') {
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
const lastVersion = storage.local.get('lastVersion'); const lastVersion = storage.local.get('lastVersion');
if (lastVersion !== null && gt(launcherVersion, lastVersion)) { // @ts-expect-error
alert(`MineXLauncher has been updated to v${launcherVersion}! if (lastVersion !== null && gt(coerce(launcherVersion, { includePrerelease: true }), coerce(lastVersion, { includePrerelease: true }))) {
const releaseNotes = ['You can now install the launcher as a PWA web app'].map((item) => ` - ${item}`).join('\n');
Changes in v${launcherVersion}: alert(`MineXLauncher has been updated to v${launcherVersion}!\n\nChanges in v${launcherVersion}:\n${releaseNotes}`);
- You can now install the launcher as a PWA web app`); storage.local.set('lastVersion', launcherVersion);
storage.local.set('lastVersion', coerce(launcherVersion, { includePrerelease: true }));
} }
}); });
} }
@ -455,7 +448,7 @@ if (window.location.pathname === '/welcome/') {
storage.local.set('theme', themeSelect.value); storage.local.set('theme', themeSelect.value);
// storage.local.set('offlineCache', offlineCheckbox.checked); // storage.local.set('offlineCache', offlineCheckbox.checked);
storage.local.set('showAds', true); storage.local.set('showAds', true);
storage.local.set('lastVersion', coerce(launcherVersion, { includePrerelease: true })); storage.local.set('lastVersion', launcherVersion);
/* if (offlineCheckbox.checked) { /* if (offlineCheckbox.checked) {
serviceworker.register('/sw-full.js'); serviceworker.register('/sw-full.js');
@ -478,3 +471,9 @@ if (window.location.pathname === '/welcome/') {
}); });
}); });
} }
if (window.location.hostname === null) {
navigate.home.game();
cookie.get('');
query.get('');
}