« get me outta code hell

upd8: --refresh-online-{thumbs,file-sizes} - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-01-23 15:48:49 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-01-23 15:48:49 -0400
commitb83551a8d10fbbfedb710712cce5adff413fac30 (patch)
tree97c1ee5c46b1a032e3f44e011792a9acee49bffa /src
parent9a643c6942ebef5efc20d723fe4e2cd9357bb1d8 (diff)
upd8: --refresh-online-{thumbs,file-sizes}
Diffstat (limited to 'src')
-rwxr-xr-xsrc/upd8.js30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/upd8.js b/src/upd8.js
index 19c7f229..045bf139 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -397,11 +397,21 @@ async function main() {
       type: 'flag',
     },
 
+    'refresh-online-thumbs': {
+      help: `Downloads a fresh copy of the online file size cache, so changes there are immediately reflected`,
+      type: 'flag',
+    },
+
     'skip-file-sizes': {
       help: `Skips preloading file sizes for images and additional files, which will be left blank in the build`,
       type: 'flag',
     },
 
+    'refresh-online-file-sizes': {
+      help: `Downloads a fresh copy of the online file size cache, so changes there are immediately reflected`,
+      type: 'flag',
+    },
+
     'skip-media-validation': {
       help: `Skips checking and reporting missing and misplaced media files, which isn't necessary if you aren't adding or removing data or updating directories`,
       type: 'flag',
@@ -2030,10 +2040,12 @@ async function main() {
     let readError = null;
     let writeError = null;
 
-    try {
-      onlineThumbsCache = JSON.parse(await readFile(cacheFile));
-    } catch (caughtError) {
-      readError = caughtError;
+    if (!cliOptions['refresh-online-thumbs']) {
+      try {
+        onlineThumbsCache = JSON.parse(await readFile(cacheFile));
+      } catch (caughtError) {
+        readError = caughtError;
+      }
     }
 
     if (onlineThumbsCache) obliterateLocalCopy: {
@@ -2610,10 +2622,12 @@ async function main() {
     let readError = null;
     let writeError = null;
 
-    try {
-      onlineFileSizeCache = JSON.parse(await readFile(cacheFile));
-    } catch (caughtError) {
-      readError = caughtError;
+    if (!cliOptions['refresh-online-file-sizes']) {
+      try {
+        onlineFileSizeCache = JSON.parse(await readFile(cacheFile));
+      } catch (caughtError) {
+        readError = caughtError;
+      }
     }
 
     if (onlineFileSizeCache) obliterateLocalCopy: {