From 78b74504cc6a366262e24a120f976248f7557dc8 Mon Sep 17 00:00:00 2001 From: Cris Stringfellow <22254235+crislin2046@users.noreply.github.com> Date: Thu, 1 Aug 2024 01:07:13 +0800 Subject: [PATCH] Weird bug Nice good OK --- .gitignore | 2 ++ src/app.js | 10 ++++++---- src/archivist.js | 1 + src/common.js | 2 +- src/libraryServer.js | 1 + 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index b1e0135..91ba660 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +22120-arc + .*.swp # Bundling and packaging diff --git a/src/app.js b/src/app.js index 064e160..9a95172 100644 --- a/src/app.js +++ b/src/app.js @@ -71,6 +71,7 @@ async function start() { const browsers = [{chromeOpen}, {vivaldiOpen}, {braveOpen}, {edgeOpen}]; if ( browserOpen ) { + let shutOne = false; for( const status of browsers ) { const keyName = Object.keys(status)[0]; if ( !status[keyName] || !status[keyName].length ) continue; @@ -85,16 +86,17 @@ async function start() { const answer = await question(`Would you like to shutdown ${openBrowserCode} browser now (y/N) ? `); if ( answer?.match(/^y/i) ) { await killBrowser(openBrowserCode); + shutOne = true; } else { console.log(`OK, not shutting it!\n`); - if ( browserOpen ) { - process.exit(0); - } } } else { await killBrowser(openBrowserCode); } } + if ( !shutOne ) { + process.exit(0); + } } console.log(`Removing 22120's existing temporary browser cache if it exists...`); @@ -118,7 +120,7 @@ async function start() { DEBUG.verboseSlow && console.info('Chrome launch error:', e); process.exit(1); } - console.log(`Chrome started.`); + console.log(`Browser started.`); console.log(`Waiting 1 second...`); await sleep(1000); diff --git a/src/archivist.js b/src/archivist.js index 2e59684..b258d7d 100644 --- a/src/archivist.js +++ b/src/archivist.js @@ -410,6 +410,7 @@ } function neverCache(url) { + if ( ! url ) return true; try { url = new URL(url); return url?.href == "about:blank" || url?.href?.startsWith('chrome') || NEVER_CACHE.has(url.origin); diff --git a/src/common.js b/src/common.js index 19abc9b..f831577 100644 --- a/src/common.js +++ b/src/common.js @@ -16,7 +16,7 @@ export const DEBUG = { export const SHOW_FETCH = false; if ( DEBUG.debug ) { - console.log({APP_ROOT}); + console.log({__ROOT}); } // server related diff --git a/src/libraryServer.js b/src/libraryServer.js index dcd3d6b..ec12ff0 100644 --- a/src/libraryServer.js +++ b/src/libraryServer.js @@ -1,3 +1,4 @@ +import sea from 'node:sea'; import http from 'http'; import https from 'https'; import fs from 'fs';