mirror of
https://github.com/zumbiepig/MineXLauncher.git
synced 2025-06-08 09:24:48 +00:00
,
This commit is contained in:
parent
ad807eea2f
commit
db06d153bc
9
index.ts
9
index.ts
@ -57,7 +57,14 @@ app.use(async (err, req, res, next) => {
|
|||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
app.listen(PORT, async () => {
|
app
|
||||||
|
.listen(PORT, async () => {
|
||||||
debugLogger('Server started.');
|
debugLogger('Server started.');
|
||||||
console.log(chalk.green(`Server is running on port ${PORT}`));
|
console.log(chalk.green(`Server is running on port ${PORT}`));
|
||||||
|
})
|
||||||
|
.on('error', (error) => {
|
||||||
|
if (error.code === 'EADDRINUSE') {
|
||||||
|
console.error(chalk.red('EADDRINUSE') + chalk.gray(': ') + chalk.bold(`Failed to start server. Is port ${PORT} in use?`));
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
<div class="cover-image">
|
<div class="cover-image">
|
||||||
<img src="/resources/images/covers/clients.webp" />
|
<img src="/resources/images/covers/clients.webp" />
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="installations">
|
<div class="installations">
|
||||||
<div class="custom-select-wrapper">
|
<div class="custom-select-wrapper">
|
||||||
<div id="custom-select" class="custom-select" onclick="versionSelector.toggle()">
|
<div id="custom-select" class="custom-select" onclick="versionSelector.toggle()">
|
||||||
@ -91,7 +92,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="bottom-bar">
|
<div class="bottom-bar">
|
||||||
<div class="bottom-bar-links">
|
<div class="bottom-bar-links">
|
||||||
<a href="https://discord.gg/YKgfuFvKhA" class="bottom-bar-left link" target="_blank">Join the MineXLauncher Discord</a>
|
<a href="https://discord.gg/YKgfuFvKhA" class="bottom-bar-left link" target="_blank">Join the MineXLauncher Discord</a>
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
<div class="cover-image">
|
<div class="cover-image">
|
||||||
<img src="/resources/images/covers/minecraft.webp" />
|
<img src="/resources/images/covers/minecraft.webp" />
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="installations">
|
<div class="installations">
|
||||||
<div class="custom-select-wrapper">
|
<div class="custom-select-wrapper">
|
||||||
<div id="custom-select" class="custom-select" onclick="versionSelector.toggle()">
|
<div id="custom-select" class="custom-select" onclick="versionSelector.toggle()">
|
||||||
@ -111,7 +112,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="bottom-bar">
|
<div class="bottom-bar">
|
||||||
<div class="bottom-bar-links">
|
<div class="bottom-bar-links">
|
||||||
<a href="https://discord.gg/YKgfuFvKhA" class="bottom-bar-left link" target="_blank">Join the MineXLauncher Discord</a>
|
<a href="https://discord.gg/YKgfuFvKhA" class="bottom-bar-left link" target="_blank">Join the MineXLauncher Discord</a>
|
||||||
|
@ -291,7 +291,7 @@ const mods = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const serviceworker = {
|
const sw = {
|
||||||
register: function (url: string) {
|
register: function (url: string) {
|
||||||
if ('serviceWorker' in navigator) {
|
if ('serviceWorker' in navigator) {
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
@ -369,12 +369,14 @@ if (window.location.pathname === '/') {
|
|||||||
if (iframe.contentWindow) iframe.contentWindow.installPwaEvent = event;
|
if (iframe.contentWindow) iframe.contentWindow.installPwaEvent = event;
|
||||||
});
|
});
|
||||||
|
|
||||||
/* if (storage.local.get('offlineCache')) {
|
/* document.addEventListener('load', () => {
|
||||||
serviceworker.register('/sw-full.js');
|
if (storage.local.get('offlineCache')) {
|
||||||
|
sw.register('/sw-full.js');
|
||||||
} else {
|
} else {
|
||||||
serviceworker.register('/sw.js');
|
sw.register('/sw.js');
|
||||||
} */
|
}
|
||||||
serviceworker.register('/sw.js');
|
}); */
|
||||||
|
document.addEventListener('load', () => sw.register('/sw.js'));
|
||||||
} else {
|
} else {
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
const profileName = document.getElementById('profile-name');
|
const profileName = document.getElementById('profile-name');
|
||||||
@ -450,12 +452,12 @@ if (window.location.pathname === '/settings/') {
|
|||||||
/* offlineCheckbox.addEventListener('change', () => {
|
/* offlineCheckbox.addEventListener('change', () => {
|
||||||
storage.local.set('offlineCache', offlineCheckbox.checked);
|
storage.local.set('offlineCache', offlineCheckbox.checked);
|
||||||
if (offlineCheckbox.checked) {
|
if (offlineCheckbox.checked) {
|
||||||
serviceworker.register('/sw-full.js');
|
sw.register('/sw-full.js');
|
||||||
alert(
|
alert(
|
||||||
'Offline cache is now downloading.\nThe download size is about 1GB, so it may take a while.\n\nPlease do not leave this page while the download is in progress.\nYou will be notified when the download is complete.'
|
'Offline cache is now downloading.\nThe download size is about 1GB, so it may take a while.\n\nPlease do not leave this page while the download is in progress.\nYou will be notified when the download is complete.'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
serviceworker.register('/sw.js');
|
sw.register('/sw.js');
|
||||||
alert('Offline cache has been deleted.');
|
alert('Offline cache has been deleted.');
|
||||||
}
|
}
|
||||||
}); */
|
}); */
|
||||||
@ -508,14 +510,14 @@ if (window.location.pathname === '/settings/') {
|
|||||||
storage.local.set('lastVersion', (await (await fetch('/resources/data.json')).json()).updates[0].version);
|
storage.local.set('lastVersion', (await (await fetch('/resources/data.json')).json()).updates[0].version);
|
||||||
|
|
||||||
/* if (offlineCheckbox.checked) {
|
/* if (offlineCheckbox.checked) {
|
||||||
serviceworker.register('/sw-full.js');
|
sw.register('/sw-full.js');
|
||||||
alert(
|
alert(
|
||||||
'Offline cache is now downloading.\nThe download size is about 1GB, so it may take a while.\n\nPlease do not leave this page while the download is in progress.\nYou will be notified when the download is complete.'
|
'Offline cache is now downloading.\nThe download size is about 1GB, so it may take a while.\n\nPlease do not leave this page while the download is in progress.\nYou will be notified when the download is complete.'
|
||||||
);
|
);
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
try installPwaEvent.prompt();
|
try installPwaEvent.prompt();
|
||||||
catch (error) console.error('Failed to prompt PWA install:', error)
|
catch (error) console.error('Failed to prompt PWA install:', error)
|
||||||
} else serviceworker.register('/sw.js'); */
|
} else sw.register('/sw.js'); */
|
||||||
|
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
window.top.location.href = '/';
|
window.top.location.href = '/';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user