diff --git a/modules/db-read/database-public-loki.js b/modules/db-read/database-public-loki.js index d58a17f..947b989 100644 --- a/modules/db-read/database-public-loki.js +++ b/modules/db-read/database-public-loki.js @@ -233,11 +233,11 @@ exports.setup = function (mstream, program) { const playlists = []; const results = playlistCollection.find({ 'user': { '$eq': username } }); - const store = []; + const store = {}; for (let row of results) { - if (store.indexOf(row.name) === -1) { + if (!store[row.name]) { playlists.push({ name: row.name }); - store.push(row.name); + store[row.name] = true; } } return playlists; diff --git a/mstream.js b/mstream.js index 01cc777..2c8e5d0 100755 --- a/mstream.js +++ b/mstream.js @@ -101,7 +101,7 @@ exports.serveit = function (program) { program.users['mstream-user']['lastfm-password'] = program['lastfm-password'] } - // Fill iin user vpaths + // Fill in user vpaths for (var key in program.folders) { program.users['mstream-user'].vpaths.push(key); } diff --git a/public/js/mstream.js b/public/js/mstream.js index 7f33323..7bb2f5f 100755 --- a/public/js/mstream.js +++ b/public/js/mstream.js @@ -1,3 +1,20 @@ +var entityMap = { + '&': '&', + '<': '<', + '>': '>', + '"': '"', + "'": ''', + '/': '/', + '`': '`', + '=': '=' +}; + +function escapeHtml (string) { + return String(string).replace(/[&<>"'`=\/]/g, function (s) { + return entityMap[s]; + }); +} + $(document).ready(function () { // Responsive active content $(document).on('click', '.activate-panel-1', function(event) { @@ -308,7 +325,7 @@ $(document).ready(function () { var currentBrowsingList = []; //////////////////////////////// Administrative stuff - // when you click an mp3, add it to the now playling playlist + // when you click an mp3, add it to now playing $("#filelist").on('click', 'div.filez', function () { MSTREAMAPI.addSongWizard($(this).data("file_location"), {}, true); }); @@ -504,7 +521,7 @@ $(document).ready(function () { if (this.type === 'directory') { filelist.push('