From 7bb8a908b9bed484ba4adf36f34278a49d8c9390 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 30 Jun 2020 02:22:19 +0200 Subject: [PATCH] Add a hack to have some sort of cache management as well for .ms files, to avoid stupid issue where people need to force the browser cache refresh after upgrades --- src/js/yunohost/helpers.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/js/yunohost/helpers.js b/src/js/yunohost/helpers.js index ba1d4ff1..fc6260f3 100644 --- a/src/js/yunohost/helpers.js +++ b/src/js/yunohost/helpers.js @@ -1,4 +1,10 @@ (function() { + + // This is to fetch the "RANDOMID" after script.min.js?version= in + // index.html + // We later use the same ID as a hacky cache mechanism for the .ms files + var ynh_assets_version = document.getElementsByTagName('script')[0].src.split("=")[1]; + // Get application context var app = Sammy.apps['#main']; var store = app.store; @@ -319,7 +325,7 @@ $('#modal').modal('hide'); // Render content - var rendered = this.render('views/'+ view +'.ms', data); + var rendered = this.render('views/' + view + '.ms?version=' + ynh_assets_version, data); // Update content helper var leSwap = function() {