From 9efbe59361e844a979db939df7c576a33d47138a Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 20 Apr 2020 14:25:43 -0400 Subject: [PATCH] force a page reload for patch version changes --- www/common/cryptpad-common.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 5ddf0f059..25b1a320f 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -1704,23 +1704,21 @@ define([ // Check for CryptPad updates var urlArgs = newUrlArgs || (Config.requireConf ? Config.requireConf.urlArgs : null); if (!urlArgs) { return; } - - console.log(newUrlArgs, urlArgs, currentVersion); - - if (newUrlArgs !== currentVersion) { return true; } - var arr = /ver=([0-9.]+)(-[0-9]*)?/.exec(urlArgs); var ver = arr[1]; if (!ver) { return; } var verArr = ver.split('.'); - verArr[2] = 0; + //verArr[2] = 0; if (verArr.length !== 3) { return; } var stored = currentVersion || '0.0.0'; var storedArr = stored.split('.'); - storedArr[2] = 0; + //storedArr[2] = 0; + var shouldUpdate = JSON.stringify(verArr) !== JSON.stringify(storedArr); +/* var shouldUpdate = parseInt(verArr[0]) !== parseInt(storedArr[0]) || (parseInt(verArr[0]) === parseInt(storedArr[0]) && parseInt(verArr[1]) !== parseInt(storedArr[1])); +*/ if (!shouldUpdate) { return; } currentVersion = ver; localStorage[CRYPTPAD_VERSION] = ver;