From 3a2492160e91520c0b4467af6bc2dba68e080664 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Thu, 30 Mar 2023 09:45:14 -0400 Subject: [PATCH] Bust clientside caches --- assets/js/autocomplete.js | 6 +++++- assets/js/booru.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/assets/js/autocomplete.js b/assets/js/autocomplete.js index 92e2e5f4..40d85dfb 100644 --- a/assets/js/autocomplete.js +++ b/assets/js/autocomplete.js @@ -171,8 +171,12 @@ function listenAutocomplete() { function fetchLocalAutocomplete(event) { if (!localFetched && event.target.dataset && 'ac' in event.target.dataset) { + const now = new Date(); + const cacheKey = `${now.getUTCFullYear()}-${now.getUTCMonth()}-${now.getUTCDate()}`; + localFetched = true; - fetch('/autocomplete/compiled?vsn=2', { credentials: 'omit', cache: 'force-cache' }) + + fetch(`/autocomplete/compiled?vsn=2&key=${cacheKey}`, { credentials: 'omit', cache: 'force-cache' }) .then(handleError) .then(resp => resp.arrayBuffer()) .then(buf => localAc = new LocalAutocompleter(buf)); diff --git a/assets/js/booru.js b/assets/js/booru.js index 3197f353..fd623d11 100644 --- a/assets/js/booru.js +++ b/assets/js/booru.js @@ -106,7 +106,7 @@ function loadBooruData() { function BooruOnRails() { this.apiEndpoint = '/api/v2/'; this.hiddenTag = '/images/tagblocked.svg'; - this.tagsVersion = 5; + this.tagsVersion = 6; } window.booru = new BooruOnRails();