From decd2f40f150902e51f915f4047c70a0ebdf30d0 Mon Sep 17 00:00:00 2001 From: IrosTheBeggar Date: Tue, 28 Sep 2021 00:32:36 -0400 Subject: [PATCH] store user settings --- webapp/assets/js/mstream.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/webapp/assets/js/mstream.js b/webapp/assets/js/mstream.js index 314da07..1c25c88 100644 --- a/webapp/assets/js/mstream.js +++ b/webapp/assets/js/mstream.js @@ -1294,10 +1294,13 @@ function onAutoDJFolderChange(el) { } else { MSTREAMPLAYER.ignoreVPaths[el.value] = true; } + + localStorage.setItem('ignoreVPaths', JSON.stringify(MSTREAMPLAYER.ignoreVPaths)); } function updateAutoDJRatings(el) { MSTREAMPLAYER.minRating = el.value; + localStorage.setItem('minRating', JSON.stringify([MSTREAMPLAYER.minRating])); } /////////////////////// Buttons @@ -1445,6 +1448,18 @@ function testIt() { // Setup the file browser loadFileExplorer(); callOnStart(); + + // load user settings + try { + const ivp = JSON.parse(localStorage.getItem('ignoreVPaths')); + if (Array.isArray(ivp)) { throw 'bad!'; } + MSTREAMPLAYER.ignoreVPaths = ivp; + } catch (e) {} + + try { + // forced to an array to assure we're not stuffing nul values in here + MSTREAMPLAYER.minRating = JSON.parse(localStorage.getItem('minRating'))[0]; + } catch (e) {} }); }