From 97fa54c2d6131af7c1a231993df6a667c39e9827 Mon Sep 17 00:00:00 2001 From: Simon Sievert Date: Thu, 27 Jul 2023 12:04:24 +0200 Subject: [PATCH] fastload: fix caching broken since e2ba3ca64 (fastload - Replace E.CRC32 with Storage.hash, 2023-07-24) Storage.hash() expects a regex (or apparently the name as a string) to match files that should be hashed, but was called with the contents of the file --- apps/fastload/ChangeLog | 1 + apps/fastload/boot.js | 7 ++++--- apps/fastload/metadata.json | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/fastload/ChangeLog b/apps/fastload/ChangeLog index 053799a9f..6581e5188 100644 --- a/apps/fastload/ChangeLog +++ b/apps/fastload/ChangeLog @@ -3,3 +3,4 @@ 0.03: Allow hiding the fastloading info screen 0.04: (WIP) Allow use of app history when going back (`load()` or `Bangle.load()` calls without specified app). 0.05: Check for changes in setting.js and force real reload if needed +0.06: Fix caching whether an app is fastloadable diff --git a/apps/fastload/boot.js b/apps/fastload/boot.js index 4ac8b97e9..57bc8ea94 100644 --- a/apps/fastload/boot.js +++ b/apps/fastload/boot.js @@ -30,12 +30,13 @@ let appFastloadPossible = function(n){ // no widgets, no problem if (!global.WIDGETS) return true; - let app = s.read(n); - if (cache[n] && s.hash(app) == cache[n].hash) + let hash = s.hash(n); + if (cache[n] && hash == cache[n].hash) return cache[n].fast; + let app = s.read(n); cache[n] = {}; cache[n].fast = app.includes("Bangle.loadWidgets"); - cache[n].hash = s.hash(app); + cache[n].hash = hash; s.writeJSON("fastload.cache", cache); return cache[n].fast; }; diff --git a/apps/fastload/metadata.json b/apps/fastload/metadata.json index abd5b3ed5..8edd1f95b 100644 --- a/apps/fastload/metadata.json +++ b/apps/fastload/metadata.json @@ -1,7 +1,7 @@ { "id": "fastload", "name": "Fastload Utils", "shortName" : "Fastload Utils", - "version": "0.05", + "version": "0.06", "icon": "icon.png", "description": "Enable experimental fastloading for more apps", "type":"bootloader",