mirror of
https://github.com/zumbiepig/MineXLauncher.git
synced 2025-06-08 09:24:48 +00:00
update json paths
This commit is contained in:
parent
1e955211f0
commit
2b440fadbf
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,7 +1,7 @@
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
desktop.ini
|
desktop.ini
|
||||||
|
|
||||||
public/assets.json
|
public/resources/data/assets.json
|
||||||
public/resources/scripts/
|
public/resources/scripts/
|
||||||
public/sw.js
|
public/sw.js
|
||||||
public/sw-full.js
|
public/sw-full.js
|
||||||
|
4
build.ts
4
build.ts
@ -35,7 +35,7 @@ if (tscOutput) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log(chalk.cyan('Removing old build artifacts...\n'));
|
console.log(chalk.cyan('Removing old build artifacts...\n'));
|
||||||
await $`rm -rf ./public/resources/scripts/ ./public/assets.json ./public/sw.js ./public/sw-full.js`.quiet();
|
await $`rm -rf ./public/resources/scripts/ ./public/resources/data/assets.json ./public/sw.js ./public/sw-full.js`.quiet();
|
||||||
|
|
||||||
console.log(chalk.cyan('Bundling TypeScript and modules...\n'));
|
console.log(chalk.cyan('Bundling TypeScript and modules...\n'));
|
||||||
const srcFilesArr = getFiles(join(import.meta.dir, 'src'));
|
const srcFilesArr = getFiles(join(import.meta.dir, 'src'));
|
||||||
@ -57,7 +57,7 @@ await $`bunx javascript-obfuscator ./public/resources/scripts/ --output ./public
|
|||||||
console.log(chalk.cyan('Generating assets list...\n'));
|
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, 'resources/data/assets.json'),
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
getFiles(publicDir).map((asset) => {
|
getFiles(publicDir).map((asset) => {
|
||||||
return asset.replace(new RegExp(`^${publicDir}`), '').replace(/\/index\.html$/, '/');
|
return asset.replace(new RegExp(`^${publicDir}`), '').replace(/\/index\.html$/, '/');
|
||||||
|
@ -19,7 +19,7 @@ function getFiles(baseDir: string, dir?: string, filesArr?: string[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log(chalk.cyan('Removing old build artifacts...\n'));
|
console.log(chalk.cyan('Removing old build artifacts...\n'));
|
||||||
await $`rm -rf ./public/resources/scripts/ ./public/assets.json ./public/sw.js ./public/sw-full.js`.quiet();
|
await $`rm -rf ./public/resources/scripts/ ./public/resources/data/assets.json ./public/sw.js ./public/sw-full.js`.quiet();
|
||||||
|
|
||||||
console.log(chalk.cyan('Bundling TypeScript and modules...\n'));
|
console.log(chalk.cyan('Bundling TypeScript and modules...\n'));
|
||||||
const srcFilesArr = getFiles(join(import.meta.dir, 'src'));
|
const srcFilesArr = getFiles(join(import.meta.dir, 'src'));
|
||||||
@ -38,7 +38,7 @@ await build({
|
|||||||
console.log(chalk.cyan('Generating assets list...\n'));
|
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, 'resources/data/assets.json'),
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
getFiles(publicDir).map((asset) => {
|
getFiles(publicDir).map((asset) => {
|
||||||
return asset.replace(new RegExp(`^${publicDir}`), '').replace(/\/index\.html$/, '/');
|
return asset.replace(new RegExp(`^${publicDir}`), '').replace(/\/index\.html$/, '/');
|
||||||
|
@ -376,7 +376,7 @@ if (window.location.pathname === '/') {
|
|||||||
const titleBarText = document.getElementById('title-bar-text');
|
const titleBarText = document.getElementById('title-bar-text');
|
||||||
|
|
||||||
const lastVersion = storage.local.get('lastVersion');
|
const lastVersion = storage.local.get('lastVersion');
|
||||||
const updateData = (await (await fetch('/resources/data.json')).json()).updates;
|
const updateData = (await (await fetch('/resources/data/main.json')).json()).updates;
|
||||||
const currentVersion = updateData[0].version;
|
const currentVersion = updateData[0].version;
|
||||||
const changelog = updateData[0].changelog.map((change: string) => ` - ${change}`).join('\n');
|
const changelog = updateData[0].changelog.map((change: string) => ` - ${change}`).join('\n');
|
||||||
|
|
||||||
@ -417,7 +417,7 @@ if (window.location.pathname === '/settings/') {
|
|||||||
const themeSelect = document.getElementById('theme-select') as HTMLSelectElement;
|
const themeSelect = document.getElementById('theme-select') as HTMLSelectElement;
|
||||||
// const offlineCheckbox = document.getElementById('offline-checkbox') as HTMLInputElement;
|
// const offlineCheckbox = document.getElementById('offline-checkbox') as HTMLInputElement;
|
||||||
// const adsCheckbox = document.getElementById('ads-checkbox') as HTMLInputElement;
|
// const adsCheckbox = document.getElementById('ads-checkbox') as HTMLInputElement;
|
||||||
const themeData: { id: string; name: string }[] = (await (await fetch('/resources/data.json')).json()).themes;
|
const themeData: { id: string; name: string }[] = (await (await fetch('/resources/data/main.json')).json()).themes;
|
||||||
|
|
||||||
themeData.forEach((theme: { id: string; name: string }) => {
|
themeData.forEach((theme: { id: string; name: string }) => {
|
||||||
const option = document.createElement('option');
|
const option = document.createElement('option');
|
||||||
@ -467,7 +467,7 @@ if (window.location.pathname === '/settings/') {
|
|||||||
const usernameInput = document.getElementById('username-input') as HTMLInputElement;
|
const usernameInput = document.getElementById('username-input') as HTMLInputElement;
|
||||||
const themeSelect = document.getElementById('theme-select') as HTMLSelectElement;
|
const themeSelect = document.getElementById('theme-select') as HTMLSelectElement;
|
||||||
// const offlineCheckbox = document.getElementById('offline-checkbox') as HTMLInputElement;
|
// const offlineCheckbox = document.getElementById('offline-checkbox') as HTMLInputElement;
|
||||||
const themeData: { id: string; name: string }[] = (await (await fetch('/resources/data.json')).json()).themes;
|
const themeData: { id: string; name: string }[] = (await (await fetch('/resources/data/main.json')).json()).themes;
|
||||||
|
|
||||||
themeData.forEach((theme: { id: string; name: string }) => {
|
themeData.forEach((theme: { id: string; name: string }) => {
|
||||||
const option = document.createElement('option');
|
const option = document.createElement('option');
|
||||||
@ -500,7 +500,7 @@ if (window.location.pathname === '/settings/') {
|
|||||||
// 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('mods', []);
|
storage.local.set('mods', []);
|
||||||
storage.local.set('lastVersion', (await (await fetch('/resources/data.json')).json()).updates[0].version);
|
storage.local.set('lastVersion', (await (await fetch('/resources/data/main.json')).json()).updates[0].version);
|
||||||
|
|
||||||
/* if (offlineCheckbox.checked) {
|
/* if (offlineCheckbox.checked) {
|
||||||
sw.register('/sw-full.js');
|
sw.register('/sw-full.js');
|
||||||
@ -520,7 +520,7 @@ if (window.location.pathname === '/settings/') {
|
|||||||
} else if (window.location.pathname === '/mods/mods/' || window.location.pathname === '/mods/resourcepacks/') {
|
} else if (window.location.pathname === '/mods/mods/' || window.location.pathname === '/mods/resourcepacks/') {
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
const addonType: 'mods' | 'resourcepacks' = window.location.pathname === '/mods/mods/' ? 'mods' : 'resourcepacks';
|
const addonType: 'mods' | 'resourcepacks' = window.location.pathname === '/mods/mods/' ? 'mods' : 'resourcepacks';
|
||||||
const addonData: { id: string; name: string; description: string; author: string; authorLink: string; source: string }[] = (await (await fetch('/resources/data.json')).json()).addons;
|
const addonData: { id: string; name: string; description: string; author: string; authorLink: string; source: string }[] = (await (await fetch('/resources/data/main.json')).json()).addons;
|
||||||
const modList = document.querySelector('.mod-list');
|
const modList = document.querySelector('.mod-list');
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
addonData[addonType].forEach((addon) => {
|
addonData[addonType].forEach((addon) => {
|
||||||
@ -551,7 +551,7 @@ if (window.location.pathname === '/settings/') {
|
|||||||
} else if (window.location.pathname === '/updates/') {
|
} else if (window.location.pathname === '/updates/') {
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
const updatesContainer = document.getElementById('updates-container');
|
const updatesContainer = document.getElementById('updates-container');
|
||||||
const updateData: { version: string; changelog: string[] }[] = (await (await fetch('/resources/data.json')).json()).updates;
|
const updateData: { version: string; changelog: string[] }[] = (await (await fetch('/resources/data/main.json')).json()).updates;
|
||||||
updateData.forEach((update) => {
|
updateData.forEach((update) => {
|
||||||
const versionHeader = document.createElement('strong');
|
const versionHeader = document.createElement('strong');
|
||||||
versionHeader.textContent = `MineXLauncher ${update.version}`;
|
versionHeader.textContent = `MineXLauncher ${update.version}`;
|
||||||
|
@ -5,7 +5,7 @@ const cacheName = `minexlauncher-full-v${cacheVersion}`;
|
|||||||
self.addEventListener('install', (event) => {
|
self.addEventListener('install', (event) => {
|
||||||
event.waitUntil(
|
event.waitUntil(
|
||||||
caches.open(cacheName).then(async (cache) => {
|
caches.open(cacheName).then(async (cache) => {
|
||||||
const response = await fetch('/assets.json');
|
const response = await fetch('/resources/data/assets.json');
|
||||||
const cacheAssets = await response.json();
|
const cacheAssets = await response.json();
|
||||||
const totalAssets = cacheAssets.length;
|
const totalAssets = cacheAssets.length;
|
||||||
let cachedAssets = 0;
|
let cachedAssets = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user