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="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="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="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>
|
</div>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
|
|
|
||||||
|
|
@ -100,10 +100,12 @@ async function controlButton(buttonType) {
|
||||||
if (buttonType == "pp") { // Play-Pause button
|
if (buttonType == "pp") { // Play-Pause button
|
||||||
getFromServer({control: "play-pause"}, "controls")
|
getFromServer({control: "play-pause"}, "controls")
|
||||||
} else if (buttonType == "sk") { // Skip button
|
} else if (buttonType == "sk") { // Skip button
|
||||||
getFromServer({control: "skip"}, "controls")
|
let returnCode = getFromServer({control: "skip"}, "controls");
|
||||||
|
if(returnCode["ok"]) {
|
||||||
if (document.getElementById("playlist-mode").style.display == "block") {
|
if (document.getElementById("playlist-mode").style.display == "block") {
|
||||||
generateVisualPlaylist("skip-button");
|
generateVisualPlaylist("skip-button");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (buttonType == "pl") { // Playlist button
|
} else if (buttonType == "pl") { // Playlist button
|
||||||
document.getElementById("songlist").innerHTML = "";
|
document.getElementById("songlist").innerHTML = "";
|
||||||
document.getElementById("playlist").innerHTML = "<h1 id=\"playlist-alert\"></h1>";
|
document.getElementById("playlist").innerHTML = "<h1 id=\"playlist-alert\"></h1>";
|
||||||
|
|
@ -284,6 +286,7 @@ async function checkSettings(skipServer=false) {
|
||||||
document.getElementById("playpausesettingcheckbox").checked = currentAdminPerms["PP"];
|
document.getElementById("playpausesettingcheckbox").checked = currentAdminPerms["PP"];
|
||||||
document.getElementById("partymodesettingcheckbox").checked = currentAdminPerms["PM"];
|
document.getElementById("partymodesettingcheckbox").checked = currentAdminPerms["PM"];
|
||||||
document.getElementById("volumechangesettingcheckbox").checked = currentAdminPerms["VOL"];
|
document.getElementById("volumechangesettingcheckbox").checked = currentAdminPerms["VOL"];
|
||||||
|
document.getElementById("duplicateallowesettingcheckbox").checked = currentAdminPerms["DUP"];
|
||||||
}
|
}
|
||||||
|
|
||||||
async function generateVisualPlaylist(conditions="") {
|
async function generateVisualPlaylist(conditions="") {
|
||||||
|
|
@ -430,8 +433,9 @@ async function submitPerms(e) {
|
||||||
tempData["AS"] = document.getElementById("addsongsettingcheckbox").checked;
|
tempData["AS"] = document.getElementById("addsongsettingcheckbox").checked;
|
||||||
tempData["PM"] = document.getElementById("partymodesettingcheckbox").checked;
|
tempData["PM"] = document.getElementById("partymodesettingcheckbox").checked;
|
||||||
tempData["VOL"] = document.getElementById("volumechangesettingcheckbox").checked;
|
tempData["VOL"] = document.getElementById("volumechangesettingcheckbox").checked;
|
||||||
|
tempData["DUP"] = document.getElementById("duplicateallowesettingcheckbox").checked;
|
||||||
let returncode = await getFromServer({"setting":"perms","admin":tempData},"settings");
|
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
|
// 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
|
// its not perfect if you spam click, but it gets the point across to the user
|
||||||
let clickedBox = e.srcElement;
|
let clickedBox = e.srcElement;
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,7 @@ def settingsControl():
|
||||||
elif recieveData["setting"] == "perms":
|
elif recieveData["setting"] == "perms":
|
||||||
if ADMIN_PASS == recieveData["password"]:
|
if ADMIN_PASS == recieveData["password"]:
|
||||||
controlPerms = recieveData["admin"]
|
controlPerms = recieveData["admin"]
|
||||||
|
print(recieveData["admin"])
|
||||||
return ERR_200
|
return ERR_200
|
||||||
else:
|
else:
|
||||||
return ERR_NO_ADMIN
|
return ERR_NO_ADMIN
|
||||||
|
|
@ -224,7 +225,8 @@ def songadd():
|
||||||
else:
|
else:
|
||||||
# the password is incorrect (technically a password not existing falls into the above case because controlPerms is never changed)
|
# the password is incorrect (technically a password not existing falls into the above case because controlPerms is never changed)
|
||||||
return ERR_NO_ADMIN
|
return ERR_NO_ADMIN
|
||||||
except KeyError:
|
except KeyError as e:
|
||||||
|
print(e)
|
||||||
return ERR_MISSING_ARGS
|
return ERR_MISSING_ARGS
|
||||||
|
|
||||||
@app.route("/playlist", methods=["POST"])
|
@app.route("/playlist", methods=["POST"])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue