update nw
This commit is contained in:
@@ -7,6 +7,10 @@
|
|||||||
"main": "http://localhost:7000",
|
"main": "http://localhost:7000",
|
||||||
"node-remote": "http://localhost:7000",
|
"node-remote": "http://localhost:7000",
|
||||||
"user-agent": "Mozilla/5.0 (%osinfo) AppleWebKit/%webkit_ver (KHTML, like Gecko, Chrome, Safari) NWjs/%nwver",
|
"user-agent": "Mozilla/5.0 (%osinfo) AppleWebKit/%webkit_ver (KHTML, like Gecko, Chrome, Safari) NWjs/%nwver",
|
||||||
|
"chromium-args": "--user-data-dir=./nw_cache/ --disk-cache-size=0 --media-cache-size=0",
|
||||||
|
"webkit": {
|
||||||
|
"page-cache":false
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "nw .",
|
"start": "nw .",
|
||||||
"build:nw:win:x64": "build --tasks win-x64 --mirror https://npmmirror.com/mirrors/nwjs/ .",
|
"build:nw:win:x64": "build --tasks win-x64 --mirror https://npmmirror.com/mirrors/nwjs/ .",
|
||||||
|
|||||||
@@ -1,17 +1,22 @@
|
|||||||
const fs = require('fs').promises
|
const fs = require('fs')
|
||||||
const StaticServer = require('./static-server.js');
|
const StaticServer = require('./static-server.js');
|
||||||
const SSLStaticServer = require('./static-sslserver.js');
|
const SSLStaticServer = require('./static-sslserver.js');
|
||||||
|
|
||||||
|
function sleep(ms) {
|
||||||
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async function deleteDirectory(dirPath) {
|
async function deleteDirectory(dirPath) {
|
||||||
try {
|
try {
|
||||||
await fs.rm(dirPath, { recursive: true, force: true });
|
fs.unlinkSync(dirPath);
|
||||||
console.log('Directory deleted successfully.');
|
console.log('Directory deleted successfully.');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error deleting directory:', err);
|
console.error('Error deleting directory:', err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteDirectory('./nw_cache');
|
|
||||||
|
|
||||||
const init = () => {
|
const init = () => {
|
||||||
StaticServer.run('7000');
|
StaticServer.run('7000');
|
||||||
@@ -19,7 +24,10 @@ const init = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!module.parent) {
|
if (!module.parent) {
|
||||||
init();
|
deleteDirectory('./nw_cache/Default/Preferences');
|
||||||
|
sleep(200);
|
||||||
|
init();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
module.exports = init;
|
module.exports = init;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user