Removing r test_mode from redux-persist, use localStorage directly and URL vars to switch

This commit is contained in:
James Barnsley
2020-11-04 21:22:44 +13:00
parent 111efe6130
commit 1395ed7662
7 changed files with 267 additions and 198 deletions

View File

@ -106,7 +106,7 @@
// Release details
// These are automatically injected to built HTML
var build = "1604338837";
var build = "1604478005";
var version = "3.53.1";
// Construct the script tag
@ -119,17 +119,14 @@
// Check for test mode. This is toggled under Settings > Debug > Test mode or can
// be manually triggered with the URL var "?test_mode=1"
try {
var ui = JSON.parse(localStorage.getItem('ui') );
window.test_mode = (
typeof(ui) !== 'undefined'
&& ui
&& typeof(ui.test_mode) !== 'undefined'
&& ui.test_mode
) || window.location.href.indexOf('test_mode=1') > -1;
} catch(error){
console.error(error);
if (window.location.href.indexOf('test_mode=1') > -1) {
window.test_mode = true;
localStorage.setItem('test_mode', true);
} else if (window.location.href.indexOf('test_mode=0') > -1) {
window.test_mode = false;
localStorage.removeItem('test_mode');
} else {
window.test_mode = localStorage.getItem('test_mode');
}
// Test mode, use un-minified code