Bust clientside caches

This commit is contained in:
byte[] 2023-03-30 09:45:14 -04:00
parent c2dd9e84a3
commit 3a2492160e
2 changed files with 6 additions and 2 deletions

View file

@ -171,8 +171,12 @@ function listenAutocomplete() {
function fetchLocalAutocomplete(event) { function fetchLocalAutocomplete(event) {
if (!localFetched && event.target.dataset && 'ac' in event.target.dataset) { if (!localFetched && event.target.dataset && 'ac' in event.target.dataset) {
const now = new Date();
const cacheKey = `${now.getUTCFullYear()}-${now.getUTCMonth()}-${now.getUTCDate()}`;
localFetched = true; 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(handleError)
.then(resp => resp.arrayBuffer()) .then(resp => resp.arrayBuffer())
.then(buf => localAc = new LocalAutocompleter(buf)); .then(buf => localAc = new LocalAutocompleter(buf));

View file

@ -106,7 +106,7 @@ function loadBooruData() {
function BooruOnRails() { function BooruOnRails() {
this.apiEndpoint = '/api/v2/'; this.apiEndpoint = '/api/v2/';
this.hiddenTag = '/images/tagblocked.svg'; this.hiddenTag = '/images/tagblocked.svg';
this.tagsVersion = 5; this.tagsVersion = 6;
} }
window.booru = new BooruOnRails(); window.booru = new BooruOnRails();