mirror of
https://github.com/KevinMidboe/zoff.git
synced 2026-02-12 20:39:31 +00:00
Delete all songs button added. DANGER
This commit is contained in:
@@ -1538,7 +1538,7 @@ nav ul li:hover, nav ul li.active {
|
|||||||
background-color: rgba(0,0,0,0.1);
|
background-color: rgba(0,0,0,0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.change_user_pass:hover {
|
.change_user_pass:hover, .delete-all:hover {
|
||||||
background-color: initial;
|
background-color: initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
server/public/assets/dist/embed.min.js
vendored
2
server/public/assets/dist/embed.min.js
vendored
File diff suppressed because one or more lines are too long
2
server/public/assets/dist/main.min.js
vendored
2
server/public/assets/dist/main.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -38,6 +38,9 @@ var Admin = {
|
|||||||
$('#chan_thumbnail').tooltip("remove");
|
$('#chan_thumbnail').tooltip("remove");
|
||||||
w_p = true;
|
w_p = true;
|
||||||
break;
|
break;
|
||||||
|
case "deleted_songs":
|
||||||
|
msg="All songs in the channel has been deleted!";
|
||||||
|
break;
|
||||||
case "shuffled":
|
case "shuffled":
|
||||||
msg=Helper.rnd(["♫ You stir me right round, baby. ♫","♫ Stir, stir, stir my boat ♫","I vigorously stirred your playlist!", "I hope you like your list stirred, not shaken.", "I shuffled your playlist with the cosmic background radiation as a seed. Enjoy.", "100% randomized, for your listening pleasure!", "I hope you enjoy your fresh playlist!"]);
|
msg=Helper.rnd(["♫ You stir me right round, baby. ♫","♫ Stir, stir, stir my boat ♫","I vigorously stirred your playlist!", "I hope you like your list stirred, not shaken.", "I shuffled your playlist with the cosmic background radiation as a seed. Enjoy.", "100% randomized, for your listening pleasure!", "I hope you enjoy your fresh playlist!"]);
|
||||||
break;
|
break;
|
||||||
@@ -123,6 +126,7 @@ var Admin = {
|
|||||||
$("#password").val("");
|
$("#password").val("");
|
||||||
$("#password").attr("placeholder", "Change admin password");
|
$("#password").attr("placeholder", "Change admin password");
|
||||||
$(".user-password-li").removeClass("hide");
|
$(".user-password-li").removeClass("hide");
|
||||||
|
$(".delete-all").removeClass("hide");
|
||||||
if($(".password_protected").prop("checked")) {
|
if($(".password_protected").prop("checked")) {
|
||||||
$(".change_user_pass").removeClass("hide");
|
$(".change_user_pass").removeClass("hide");
|
||||||
}
|
}
|
||||||
@@ -206,6 +210,10 @@ var Admin = {
|
|||||||
$(".user-password-li").addClass("hide")
|
$(".user-password-li").addClass("hide")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!$(".delete-all").hasClass("hide")) {
|
||||||
|
$(".delete-all").addClass("hide");
|
||||||
|
}
|
||||||
|
|
||||||
if($(".password_protected").prop("checked")) {
|
if($(".password_protected").prop("checked")) {
|
||||||
$(".change_user_pass").removeClass("hide");
|
$(".change_user_pass").removeClass("hide");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1105,6 +1105,11 @@ $(document).on("click", ".close-user-password", function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on("click", ".delete-all-songs", function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
socket.emit("delete_all", {channel: chan.toLowerCase(), adminpass: adminpass == "" ? "" : Crypt.crypt_pass(adminpass), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()))});
|
||||||
|
});
|
||||||
|
|
||||||
$(document).on("click", ".not-exported-container .not-exported-element #extra-export-container-text .extra-add-text", function(){
|
$(document).on("click", ".not-exported-container .not-exported-element #extra-export-container-text .extra-add-text", function(){
|
||||||
this.select();
|
this.select();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -32,10 +32,13 @@ var Player = {
|
|||||||
if(!obj.np){
|
if(!obj.np){
|
||||||
|
|
||||||
document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!";
|
document.getElementById('song-title').innerHTML = "Empty channel. Add some songs!";
|
||||||
|
document.title = "Zoff - the shared YouTube based radio";
|
||||||
//$("#player_overlay").height($("#player").height());
|
//$("#player_overlay").height($("#player").height());
|
||||||
|
|
||||||
if(!window.MSStream && !chromecastAvailable) {
|
if(!window.MSStream && !chromecastAvailable) {
|
||||||
$("#player_overlay").toggleClass("hide");
|
if($("#player_overlay").hasClass("hide")) {
|
||||||
|
$("#player_overlay").removeClass("hide");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
if(!chromecastAvailable) {
|
if(!chromecastAvailable) {
|
||||||
|
|||||||
@@ -91,7 +91,6 @@
|
|||||||
<input name="removeplay" type="checkbox" class="conf" /><span class="lever"></span>
|
<input name="removeplay" type="checkbox" class="conf" /><span class="lever"></span>
|
||||||
<span class="right-span">Remove</span>
|
<span class="right-span">Remove</span>
|
||||||
</label></div></li>
|
</label></div></li>
|
||||||
|
|
||||||
<li class="user-password-li hide"><span class="switch-text">
|
<li class="user-password-li hide"><span class="switch-text">
|
||||||
Channel password
|
Channel password
|
||||||
</span>
|
</span>
|
||||||
@@ -103,6 +102,9 @@
|
|||||||
<li class="change_user_pass hide">
|
<li class="change_user_pass hide">
|
||||||
<a href="#!" class="change_user_pass_btn btn waves-effect blue">Change password</a>
|
<a href="#!" class="change_user_pass_btn btn waves-effect blue">Change password</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="delete-all hide">
|
||||||
|
<a href="#" class="delete-all-songs btn red">Delete all songs</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -657,6 +657,44 @@ io.on('connection', function(socket){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on('delete_all', function(msg) {
|
||||||
|
if(typeof(msg) == 'object' && msg.hasOwnProperty('channel') && msg.hasOwnProperty('adminpass') && msg.hasOwnProperty('pass')) {
|
||||||
|
var hash = hash_pass(decrypt_string(socketid, msg.adminpass));
|
||||||
|
var hash_userpass = decrypt_string(socketid, msg.pass);
|
||||||
|
|
||||||
|
if(coll !== undefined) {
|
||||||
|
try {
|
||||||
|
coll = msg.channel;
|
||||||
|
if(coll.length == 0) return;
|
||||||
|
coll = emojiStrip(coll).toLowerCase();
|
||||||
|
//coll = decodeURIComponent(coll);
|
||||||
|
coll = coll.replace("_", "");
|
||||||
|
coll = encodeURIComponent(coll).replace(/\W/g, '');
|
||||||
|
coll = filter.clean(coll);
|
||||||
|
} catch(e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
db.collection(coll).find({views: {$exists: true}}, function(err, conf) {
|
||||||
|
if(conf.length == 1 && conf) {
|
||||||
|
conf = conf[0];
|
||||||
|
if(conf.adminpass == hash && conf.adminpass != "" && ((conf.userpass != "" || (conf.userpass == hash_userpass)))) {
|
||||||
|
db.collection(coll).remove({views: {$exists: false}}, {multi: true}, function(err, succ) {
|
||||||
|
send_list(coll, false, true, true, true);
|
||||||
|
socket.emit("toast", "deleted_songs");
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
socket.emit("toast", "listhaspass");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
socket.emit("update_required");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
socket.on('vote', function(msg)
|
socket.on('vote', function(msg)
|
||||||
{
|
{
|
||||||
if(typeof(msg) === 'object' && msg !== undefined && msg !== null)
|
if(typeof(msg) === 'object' && msg !== undefined && msg !== null)
|
||||||
@@ -1533,8 +1571,12 @@ function send_play(coll, socket)
|
|||||||
socket.emit("np", toSend);
|
socket.emit("np", toSend);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch(e){
|
} catch(e){
|
||||||
socket.emit("np", {});
|
if(socket) {
|
||||||
|
socket.emit("np", {});
|
||||||
|
} else {
|
||||||
|
io.to(coll).emit("np", {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user