diff --git a/Client/index.html b/Client/index.html
index c0a018b..7172540 100644
--- a/Client/index.html
+++ b/Client/index.html
@@ -102,6 +102,11 @@ changes visibility with JS-->
+
Wipe the playlist, except the currently playing song*
+ +PartyJukebox is under an AGPLV3 liscense. You can access the source code here.
diff --git a/Client/scripts.js b/Client/scripts.js index ba710ba..6034398 100644 --- a/Client/scripts.js +++ b/Client/scripts.js @@ -411,6 +411,16 @@ async function submitPerms(e) { } } +async function clearPlaylist() { + let returncode = await getFromServer({control:"clear"},"controls"); + if(returncode == ERR_NO_ADMIN || returncode == null) { + // alertText("Admin Restricted ") + // there's an admin restrict alert built into getFromServer + } else { + alertText("Playlist Cleared!"); + } +} + let optionslist = [] //sets all de stuff for buttons @@ -427,7 +437,8 @@ document.getElementById("volumerange").onchange = async function() { // FIX THIS let returnValue = await getFromServer({setting:"volume",level:this.value}, "settings") if (returnValue == ERR_NO_ADMIN) { - alertText("Error: Admin restricted action"); + // alertText("Error: Admin restricted action"); + // there's an admin restrict alert built into getFromServer } else if (returnValue["volumePassed"] !=0) { // i forgot about this, i had to do this because it confused the crap out of me one time // vlc doesn't let you change the volume of nothing, which makes sense if you think about it @@ -441,6 +452,8 @@ document.getElementById("volumerange").onchange = async function() { } } + + //bit of a cheat code for clearing the alerts when they don't clear normally document.getElementById("title").addEventListener('click',function(){document.getElementById("alert").innerHTML = ""}) document.getElementById("settings-button").addEventListener('click',function(){controlButton("st")}); @@ -455,6 +468,8 @@ document.getElementById("alerttimetextbox").addEventListener('keydown', function document.getElementById("adminpasswordbox").addEventListener('keydown',function(e){adminPassEnter(e)}); document.getElementById("admincheckholder").addEventListener('click',function(e){submitPerms(e)}); document.getElementById("partymode-button").addEventListener('click',function(){controlButton("pm")}) +document.getElementById("darkmode-button").addEventListener('click',function(){toggleDark()}) +document.getElementById("clear-button").addEventListener('click',function(){clearPlaylist()}) //sets the fact that clicking a song needs to return its id to the function to find it document.getElementById("songlist").addEventListener('keydown', function(e){checkWhatSongWasClicked(e)}); document.getElementById("songlist").addEventListener('click', function(e){checkWhatSongWasClicked(e)}); @@ -462,7 +477,6 @@ document.getElementById("songlist").addEventListener('click', function(e){checkW //makes the controls look mostly normal on all screens, best solution i could find, idk man let tempWidth = document.getElementById('controls').clientWidth; document.getElementById("controls").style.marginLeft = "-"+String(parseInt(tempWidth/2))+"px"; -document.getElementById("darkmode-button").addEventListener('click',function(){toggleDark()}) //for my use case (my immediate family), they dont know how to set an ip //using this allows the creator of the link for, a qr code for example, to set the ip before distributing the code, and it would all work smoothly diff --git a/Server/webbyBits.py b/Server/webbyBits.py index 236f903..d3f1faf 100644 --- a/Server/webbyBits.py +++ b/Server/webbyBits.py @@ -117,6 +117,13 @@ def playerControls(): return "200" else: return ERR_NO_ADMIN + elif recieveData["control"] == "clear": + if ADMIN_PASS == recieveData['password']: # this is only ever allowed with the adminpassword + with playlistLock: + playlist.clear() + return "200" + else: + return ERR_NO_ADMIN else: return "400" else: