Now sending next song when asked to correctly, and to only the askee

This commit is contained in:
Kasper Rynning-Tønnesen
2018-06-23 13:30:00 +02:00
parent 8139f786ec
commit 5af7fe2d37
4 changed files with 15 additions and 11 deletions

View File

@@ -79,15 +79,15 @@ module.exports = function() {
});
socket.on('next_song', function(obj) {
if(obj == undefined || !obj.hasOwnProperty("channel") || !obj.hasOwnProperty("pass")) return;
if(obj == undefined || !obj.hasOwnProperty("channel")) return;
db.collection(obj.channel + "_settings").find(function(e, docs) {
if(docs.length == 0) return;
var pass = "";
if(obj.pass) {
if(obj.hasOwnProperty("pass")) {
pass = crypto.createHash('sha256').update(Functions.decrypt_string(obj.pass)).digest("base64");
}
if((docs.length > 0 && (docs[0].userpass == undefined || docs[0].userpass == "" || docs[0].userpass == pass))) {
List.getNextSong(obj.channel);
List.getNextSong(obj.channel, socket);
}
});
});