Added client side access to dupe prevention
Still some bugs but ill work through them
This commit is contained in:
parent
62caee7fd8
commit
f37b2b7691
3 changed files with 13 additions and 5 deletions
|
|
@ -101,6 +101,8 @@ changes visibility with JS-->
|
|||
<input type="checkbox" title="playpausecheck" id="playpausesettingcheckbox"><label for="playpausesettingcheckbox">Play/pause</label><br>
|
||||
<input type="checkbox" title="partymodecheck" id="partymodesettingcheckbox"><label for="partymodesettingcheckbox">Toggle Party Mode</label><br>
|
||||
<input type="checkbox" title="volumechangecheck" id="volumechangesettingcheckbox"><label for="volumechangesettingcheckbox">Change volume</label><br>
|
||||
<input type="checkbox" title="duplicateallowcheck" id="duplicateallowesettingcheckbox"><label for="duplicateallowsettingcheck">Allow Duplicates</label><br>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue