diff --git a/index.ts b/index.ts index b511628..c13b916 100644 --- a/index.ts +++ b/index.ts @@ -57,7 +57,14 @@ app.use(async (err, req, res, next) => { next(); }); -app.listen(PORT, async () => { - debugLogger('Server started.'); - console.log(chalk.green(`Server is running on port ${PORT}`)); -}); +app + .listen(PORT, async () => { + debugLogger('Server started.'); + 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); + } + }); diff --git a/public/home/clients/index.html b/public/home/clients/index.html index 3a1405b..5960c2f 100644 --- a/public/home/clients/index.html +++ b/public/home/clients/index.html @@ -59,36 +59,36 @@
-
-
-
- Select a client +
+
+
+
+ Select a client +
+
+
+ + EaglerForge
-
-
- - EaglerForge -
-
- - Resent Client -
-
- - Shadow Client -
-
- - Astra Client -
-
- - Starlike Client -
+
+ + Resent Client +
+
+ + Shadow Client +
+
+ + Astra Client +
+
+ + Starlike Client
-
+
diff --git a/public/home/game/index.html b/public/home/game/index.html index 43f9532..3c05956 100644 --- a/public/home/game/index.html +++ b/public/home/game/index.html @@ -59,56 +59,56 @@
-
-
-
- Select a version +
+
+
+
+ Select a version +
+
+
+ + 1.9.4
-
-
- - 1.9.4 -
-
- - 1.8.8 -
-
- - 1.5.2 -
-
- - 1.2.5 -
-
- - Beta 1.7.3 -
-
- - Beta 1.3 -
-
- - Alpha 1.2.6 -
-
- - Infdev -
-
- - Indev -
-
- - Classic -
+
+ + 1.8.8 +
+
+ + 1.5.2 +
+
+ + 1.2.5 +
+
+ + Beta 1.7.3 +
+
+ + Beta 1.3 +
+
+ + Alpha 1.2.6 +
+
+ + Infdev +
+
+ + Indev +
+
+ + Classic
-
+
diff --git a/src/resources/scripts/main.ts b/src/resources/scripts/main.ts index 5de1245..01f5fc2 100644 --- a/src/resources/scripts/main.ts +++ b/src/resources/scripts/main.ts @@ -291,7 +291,7 @@ const mods = { }, }; -const serviceworker = { +const sw = { register: function (url: string) { if ('serviceWorker' in navigator) { window.addEventListener('load', () => { @@ -369,12 +369,14 @@ if (window.location.pathname === '/') { if (iframe.contentWindow) iframe.contentWindow.installPwaEvent = event; }); - /* if (storage.local.get('offlineCache')) { - serviceworker.register('/sw-full.js'); - } else { - serviceworker.register('/sw.js'); - } */ - serviceworker.register('/sw.js'); + /* document.addEventListener('load', () => { + if (storage.local.get('offlineCache')) { + sw.register('/sw-full.js'); + } else { + sw.register('/sw.js'); + } + }); */ + document.addEventListener('load', () => sw.register('/sw.js')); } else { document.addEventListener('DOMContentLoaded', async () => { const profileName = document.getElementById('profile-name'); @@ -450,12 +452,12 @@ if (window.location.pathname === '/settings/') { /* offlineCheckbox.addEventListener('change', () => { storage.local.set('offlineCache', offlineCheckbox.checked); if (offlineCheckbox.checked) { - serviceworker.register('/sw-full.js'); + sw.register('/sw-full.js'); 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.' ); } else { - serviceworker.register('/sw.js'); + sw.register('/sw.js'); 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); /* if (offlineCheckbox.checked) { - serviceworker.register('/sw-full.js'); + sw.register('/sw-full.js'); 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.' ); // @ts-expect-error try installPwaEvent.prompt(); catch (error) console.error('Failed to prompt PWA install:', error) - } else serviceworker.register('/sw.js'); */ + } else sw.register('/sw.js'); */ // @ts-expect-error window.top.location.href = '/';