mirror of
https://github.com/zumbiepig/MineXLauncher.git
synced 2025-06-26 10:05:10 +00:00
update to 1.6.0-beta.1
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import { gt, coerce } from 'semver';
|
||||
import { SemVer, gt } from 'semver';
|
||||
|
||||
let selectedVersion: string | undefined;
|
||||
const launcherVersion = '1.5';
|
||||
|
||||
// Update `cacheVersion` in sw.js too
|
||||
const launcherVersion: SemVer = new SemVer('1.6.0-beta.1');
|
||||
const releaseNotes = ['You can now install mods directly from the mods list'];
|
||||
|
||||
const theme = {
|
||||
load: function (themeToLoad?: string) {
|
||||
@@ -298,7 +301,7 @@ const mods = {
|
||||
mods.splice(modIndex, 1);
|
||||
storage.local.set('mods', mods);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const serviceworker = {
|
||||
@@ -381,10 +384,8 @@ if (window.location.pathname === '/') {
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const lastVersion = storage.local.get('lastVersion');
|
||||
// @ts-expect-error
|
||||
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');
|
||||
alert(`MineXLauncher has been updated to v${launcherVersion}!\n\nChanges in v${launcherVersion}:\n${releaseNotes}`);
|
||||
if (lastVersion !== null && gt(launcherVersion, lastVersion)) {
|
||||
alert(`MineXLauncher has been updated to v${launcherVersion}!\n\nChanges in v${launcherVersion}:\n${releaseNotes.map((item) => ` - ${item}`).join('\n')}`);
|
||||
storage.local.set('lastVersion', launcherVersion);
|
||||
}
|
||||
});
|
||||
@@ -446,9 +447,7 @@ if (window.location.pathname === '/settings/') {
|
||||
window.location.reload();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (window.location.pathname === '/welcome/') {
|
||||
} else if (window.location.pathname === '/welcome/') {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const setupForm = document.getElementById('setup-form') as HTMLFormElement;
|
||||
const usernameInput = document.getElementById('username-input') as HTMLInputElement;
|
||||
@@ -505,6 +504,51 @@ if (window.location.pathname === '/welcome/') {
|
||||
}
|
||||
});
|
||||
});
|
||||
} else if (window.location.pathname === '/mods/mods/' || window.location.pathname === '/mods/resourcepacks/') {
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
let modType: 'mods' | 'resourcepacks' = 'mods';
|
||||
let modExt: 'js' | 'zip' = 'js';
|
||||
switch (window.location.pathname) {
|
||||
case '/mods/mods/':
|
||||
modType = 'mods';
|
||||
modExt = 'js';
|
||||
break;
|
||||
case '/mods/resourcepacks/':
|
||||
modType = 'resourcepacks';
|
||||
modExt = 'zip';
|
||||
break;
|
||||
}
|
||||
|
||||
const mods = await (await fetch('/resources/data/mods.json')).json();
|
||||
mods[modType].forEach((mod: { id: string; name: string; description: string; author: string; authorLink: string; source: string }) => {
|
||||
const modItem = document.createElement('div');
|
||||
modItem.classList.add('mod-item');
|
||||
modItem.innerHTML = `<div class="mod-icon"><img loading="lazy" src="/resources/mods/icons/${mod.id}.webp" /></div><div class="mod-details"><h3 class="mod-name">${mod.name}</h3><p class="mod-author">By <a href="${mod.authorLink}" target="_blank">${mod.author}</a></p><p class="mod-description">${mod.description}</p><div class="mod-links"><a href="${mod.source}" class="mod-link" target="_blank">Source</a><a href="/resources/mods/downloads/${mod.id}.${modExt}" class="mod-link" download>Download</a></div></div>`;
|
||||
|
||||
const modList = document.querySelector('.mod-list');
|
||||
modList?.appendChild(modItem);
|
||||
});
|
||||
});
|
||||
} else if (window.location.pathname === '/updates/') {
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const updatesContainer = document.getElementById('updates-container');
|
||||
const updates = await (await fetch('/resources/data/updates.json')).json();
|
||||
|
||||
updates.forEach((update: { version: string; changelog: string[] }) => {
|
||||
const versionHeader = document.createElement('strong');
|
||||
versionHeader.textContent = `MineXLauncher ${update.version}`;
|
||||
updatesContainer?.appendChild(versionHeader);
|
||||
|
||||
const changelog = document.createElement('ul');
|
||||
update.changelog.forEach((change) => {
|
||||
const changelogItem = document.createElement('li');
|
||||
changelogItem.textContent = change;
|
||||
changelog.appendChild(changelogItem);
|
||||
});
|
||||
|
||||
updatesContainer?.appendChild(changelog);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (window.location.hostname === null) {
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const response = await fetch('/resources/mods/data.json');
|
||||
const data = await response.json();
|
||||
const modListElement = document.querySelector('.mod-list');
|
||||
|
||||
// @ts-expect-error
|
||||
data.mods.forEach(({ id, name, description, author, authorLink, source }) => {
|
||||
const div = document.createElement('div');
|
||||
div.classList.add('mod-item');
|
||||
div.innerHTML = `<div class="mod-icon"><img loading="lazy" src="/resources/mods/icons/${id}.webp" /></div><div class="mod-details"><h3 class="mod-name">${name}</h3><p class="mod-author">By <a href="${authorLink}" target="_blank">${author}</a></p><p class="mod-description">${description}</p><div class="mod-links"><a href="${source}" class="mod-link" target="_blank">Source</a><a href="/resources/mods/downloads/${id}.js" class="mod-link" download>Download</a></div></div>`;
|
||||
modListElement?.appendChild(div);
|
||||
});
|
||||
});
|
||||
@@ -1,13 +0,0 @@
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const response = await fetch('/resources/mods/data.json');
|
||||
const data = await response.json();
|
||||
const modListElement = document.querySelector('.mod-list');
|
||||
|
||||
// @ts-expect-error
|
||||
data.resourcepacks.forEach(({ id, name, description, author, authorLink, source }) => {
|
||||
const div = document.createElement('div');
|
||||
div.classList.add('mod-item');
|
||||
div.innerHTML = `<div class="mod-icon"><img loading="lazy" src="/resources/mods/icons/${id}.webp" /></div><div class="mod-details"><h3 class="mod-name">${name}</h3><p class="mod-author">By <a href="${authorLink}" target="_blank">${author}</a></p><p class="mod-description">${description}</p><div class="mod-links"><a href="${source}" class="mod-link" target="_blank">Source</a><a href="/resources/mods/downloads/${id}.zip" class="mod-link" download>Download</a></div></div>`;
|
||||
modListElement?.appendChild(div);
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
// @ts-nocheck
|
||||
const cacheVersion = '1.5';
|
||||
const cacheVersion = '1.6.0';
|
||||
const cacheName = `minexlauncher-full-v${cacheVersion}`;
|
||||
|
||||
self.addEventListener('install', (event) => {
|
||||
|
||||
Reference in New Issue
Block a user