From f37b2b7691d8c7da830331e9aa4290a709c8666c Mon Sep 17 00:00:00 2001 From: Kristy Fournier Date: Thu, 29 Jan 2026 17:09:00 -0500 Subject: [PATCH] Added client side access to dupe prevention Still some bugs but ill work through them --- Client/index.html | 2 ++ Client/scripts.js | 12 ++++++++---- Server/webbyBits.py | 4 +++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Client/index.html b/Client/index.html index 428fb2d..a45c6b1 100644 --- a/Client/index.html +++ b/Client/index.html @@ -101,6 +101,8 @@ changes visibility with JS-->


+
+
diff --git a/Client/scripts.js b/Client/scripts.js index 7b612d5..dbf3382 100644 --- a/Client/scripts.js +++ b/Client/scripts.js @@ -100,9 +100,11 @@ async function controlButton(buttonType) { if (buttonType == "pp") { // Play-Pause button getFromServer({control: "play-pause"}, "controls") } else if (buttonType == "sk") { // Skip button - getFromServer({control: "skip"}, "controls") - if (document.getElementById("playlist-mode").style.display == "block") { - generateVisualPlaylist("skip-button"); + let returnCode = getFromServer({control: "skip"}, "controls"); + if(returnCode["ok"]) { + if (document.getElementById("playlist-mode").style.display == "block") { + generateVisualPlaylist("skip-button"); + } } } else if (buttonType == "pl") { // Playlist button document.getElementById("songlist").innerHTML = ""; @@ -284,6 +286,7 @@ async function checkSettings(skipServer=false) { document.getElementById("playpausesettingcheckbox").checked = currentAdminPerms["PP"]; document.getElementById("partymodesettingcheckbox").checked = currentAdminPerms["PM"]; document.getElementById("volumechangesettingcheckbox").checked = currentAdminPerms["VOL"]; + document.getElementById("duplicateallowesettingcheckbox").checked = currentAdminPerms["DUP"]; } async function generateVisualPlaylist(conditions="") { @@ -430,8 +433,9 @@ async function submitPerms(e) { tempData["AS"] = document.getElementById("addsongsettingcheckbox").checked; tempData["PM"] = document.getElementById("partymodesettingcheckbox").checked; tempData["VOL"] = document.getElementById("volumechangesettingcheckbox").checked; + tempData["DUP"] = document.getElementById("duplicateallowesettingcheckbox").checked; let returncode = await getFromServer({"setting":"perms","admin":tempData},"settings"); - if (returncode == ERR_NO_ADMIN || returncode == null) { + if (!(returncode["ok"])) { // if you aren't allowed to check the box then toggle it again // its not perfect if you spam click, but it gets the point across to the user let clickedBox = e.srcElement; diff --git a/Server/webbyBits.py b/Server/webbyBits.py index cbab57f..ea876d8 100644 --- a/Server/webbyBits.py +++ b/Server/webbyBits.py @@ -163,6 +163,7 @@ def settingsControl(): elif recieveData["setting"] == "perms": if ADMIN_PASS == recieveData["password"]: controlPerms = recieveData["admin"] + print(recieveData["admin"]) return ERR_200 else: return ERR_NO_ADMIN @@ -224,7 +225,8 @@ def songadd(): else: # the password is incorrect (technically a password not existing falls into the above case because controlPerms is never changed) return ERR_NO_ADMIN - except KeyError: + except KeyError as e: + print(e) return ERR_MISSING_ARGS @app.route("/playlist", methods=["POST"])