aboutsummaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2023-06-08 18:29:14 -0400
committertdro <tdro@noreply.example.com>2023-06-08 18:29:14 -0400
commit044bd7909fe7601a63398bd4b4038608ba3c90e5 (patch)
treed0fb8062e0779812dcfe515993f68db086f73f29 /static
parentfb3eedd51abb47b5421928b27d6deae16a5ed263 (diff)
downloadcanory-044bd7909fe7601a63398bd4b4038608ba3c90e5.tar.gz
canory-044bd7909fe7601a63398bd4b4038608ba3c90e5.tar.bz2
canory-044bd7909fe7601a63398bd4b4038608ba3c90e5.zip
static/js/update: Handle no cache
Diffstat (limited to 'static')
-rw-r--r--static/js/update.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/static/js/update.ts b/static/js/update.ts
index 2b96751..d7fda45 100644
--- a/static/js/update.ts
+++ b/static/js/update.ts
@@ -17,11 +17,11 @@
const url = self.location.href.split("#")[0].split("?")[0];
check(url, "HEAD", function (request) {
const local = document.querySelector('meta[name="last-modified"]').content;
- const remote = request.getResponseHeader("last-modified") || local;
+ const remote = request.getResponseHeader("last-modified") || '';
const modified = Date.parse(document.lastModified) !== Date.parse(remote);
- const drift = Date.parse(remote) - Date.parse(local);
+ const drift = Date.parse(remote || local) - Date.parse(local);
- if (modified) {
+ if (remote && modified) {
const indicator = document.querySelector("a[data-update]");
check(url, "GET");
indicator.href = url;