mirror of
https://github.com/zumbiepig/MineXLauncher.git
synced 2025-06-08 09:24:48 +00:00
.
This commit is contained in:
parent
12d80a39ae
commit
d2492a3768
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,6 +1,12 @@
|
||||
.DS_Store
|
||||
# Build artifacts
|
||||
/public/assets.json
|
||||
/public/resources/scripts/
|
||||
/public/cacheAssets.json
|
||||
/public/sw.js
|
||||
/public/sw-full.js
|
||||
|
||||
# System files
|
||||
.desktop.ini
|
||||
.DS_Store
|
||||
|
||||
# Logs
|
||||
logs
|
||||
|
@ -17,5 +17,5 @@ function getFiles(dir, files_) {
|
||||
return files_;
|
||||
}
|
||||
|
||||
const cacheAssets = getFiles(directoryPath);
|
||||
writeFileSync(join(import.meta.dirname, '/public/cacheAssets.json'), JSON.stringify(cacheAssets, null, 2));
|
||||
const assets = getFiles(directoryPath);
|
||||
writeFileSync(join(import.meta.dirname, '/public/assets.json'), JSON.stringify(assets, null, 2));
|
@ -5,11 +5,11 @@
|
||||
"main": "./server.js",
|
||||
"scripts": {
|
||||
"start": "node ./server.js",
|
||||
"build": "npm run build:clean && npm run build:compile && npm run build:obfuscate && npm run build:generateCacheAssetsList",
|
||||
"build:clean": "rimraf ./public/resources/scripts ./public/cacheAssets.json",
|
||||
"build": "npm run build:clean && npm run build:compile && npm run build:obfuscate && npm run build:generateAssetsList",
|
||||
"build:clean": "rimraf ./public/resources/scripts ./public/assets.json",
|
||||
"build:compile": "tsc",
|
||||
"build:obfuscate": "javascript-obfuscator ./public/resources/scripts --output ./public/resources/scripts --options-preset high-obfuscation",
|
||||
"build:generateCacheAssetsList": "node ./generateCacheAssetsList.js",
|
||||
"build:generateAssetsList": "node ./generateAssetsList.js",
|
||||
"lint": "eslint ./src",
|
||||
"lint:fix": "eslint --fix ./src"
|
||||
},
|
||||
|
@ -1,10 +1,11 @@
|
||||
// @ts-nocheck
|
||||
const cacheVersion = '1.5';
|
||||
const cacheName = `minexlauncher-full-v${cacheVersion}`;
|
||||
|
||||
self.addEventListener('install', (event) => {
|
||||
event.waitUntil(
|
||||
caches.open(cacheName).then(async (cache) => {
|
||||
const response = await fetch('/cacheAssets.json');
|
||||
const response = await fetch('/assets.json');
|
||||
const cacheAssets = await response.json();
|
||||
const totalAssets = cacheAssets.length;
|
||||
let cachedAssets = 0;
|
||||
@ -28,6 +29,8 @@ self.addEventListener('activate', (event) => {
|
||||
keyList.map((key) => {
|
||||
if (key !== cacheName) {
|
||||
return caches.delete(key);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
);
|
@ -1,3 +1,4 @@
|
||||
// @ts-nocheck
|
||||
const cacheVersion = '1.5';
|
||||
const cacheName = `minexlauncher-v${cacheVersion}`;
|
||||
const offlineUrl = '/offline.html';
|
||||
@ -49,6 +50,8 @@ self.addEventListener('activate', (event) => {
|
||||
keyList.map((key) => {
|
||||
if (key !== cacheName) {
|
||||
return caches.delete(key);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
);
|
Loading…
x
Reference in New Issue
Block a user