mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-12-08 04:28:49 +00:00
Merge pull request #416 from zoff-music/feature/disable-chat
Added settings for disabling chat in a channel
This commit is contained in:
@@ -58,19 +58,6 @@ function getAndSendLogs(channel, all, socket, pass, query) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkIfUserIsBanned(channel, socket, guid, callback) {
|
|
||||||
var connection_id = Functions.hash_pass(socket.handshake.headers["user-agent"] + socket.handshake.address + socket.handshake.headers["accept-language"]);
|
|
||||||
db.collection(channel + "_banned_chat").find({connection_id: connection_id}, function(err, docs) {
|
|
||||||
if(docs.length == 0) callback();
|
|
||||||
else {
|
|
||||||
db.collection("user_names").update({guid, guid}, {$addToSet:{channels: channel}}, function(){
|
|
||||||
socket.emit('chat', {from: "System", msg: ": You can't chat in this channel, you are banned. The reason is: " + docs[0].reason, icon: "https://zoff.me/assets/images/favicon-32x32.png"});
|
|
||||||
return;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function chat(msg, guid, offline, socket) {
|
function chat(msg, guid, offline, socket) {
|
||||||
if(typeof(msg) !== 'object' || !msg.hasOwnProperty('data') ||
|
if(typeof(msg) !== 'object' || !msg.hasOwnProperty('data') ||
|
||||||
!msg.hasOwnProperty('channel') || typeof(msg.data) != "string" || typeof(msg.channel) != "string") {
|
!msg.hasOwnProperty('channel') || typeof(msg.data) != "string" || typeof(msg.channel) != "string") {
|
||||||
@@ -103,7 +90,10 @@ function chat(msg, guid, offline, socket) {
|
|||||||
msg.pass = crypto.createHash('sha256').update(Functions.decrypt_string(msg.pass)).digest("base64");
|
msg.pass = crypto.createHash('sha256').update(Functions.decrypt_string(msg.pass)).digest("base64");
|
||||||
}
|
}
|
||||||
db.collection(coll + "_settings").find(function(err, conf){
|
db.collection(coll + "_settings").find(function(err, conf){
|
||||||
if(conf.length > 0 && (conf[0].userpass == undefined || conf[0].userpass == "" || (msg.hasOwnProperty('pass') && conf[0].userpass == msg.pass))) {
|
if(conf.length > 0 && !conf[0].toggleChat) {
|
||||||
|
socket.emit('chat', {from: "System", msg: ": Chat for this channel has been disabled.", icon: "https://zoff.me/assets/images/favicon-32x32.png"});
|
||||||
|
return;
|
||||||
|
} else if(conf.length > 0 && (conf[0].userpass == undefined || conf[0].userpass == "" || (msg.hasOwnProperty('pass') && conf[0].userpass == msg.pass))) {
|
||||||
var data = msg.data;
|
var data = msg.data;
|
||||||
|
|
||||||
Functions.check_inlist(coll, guid, socket, offline, function() {
|
Functions.check_inlist(coll, guid, socket, offline, function() {
|
||||||
@@ -239,138 +229,167 @@ function all_chat(msg, guid, offline, socket) {
|
|||||||
}, "place 2");
|
}, "place 2");
|
||||||
}
|
}
|
||||||
|
|
||||||
function namechange(data, guid, socket, tried, callback) {
|
function checkIfChatEnabled(channel, socket, callback) {
|
||||||
/*if(!data.hasOwnProperty("channel") ||
|
if(channel == "" || channel == undefined) callback();
|
||||||
typeof(data.channel) != "string") return;*/
|
else {
|
||||||
checkIfUserIsBanned(data.channel, socket, guid, function() {
|
db.collection(channel + "_settings").find(function(err, docs){
|
||||||
var pw = "";
|
if(docs.length > 0 && !docs[0].toggleChat) {
|
||||||
var new_password;
|
socket.emit('chat', {from: "System", msg: ": Chat for this channel has been disabled.", icon: "https://zoff.me/assets/images/favicon-32x32.png"});
|
||||||
var first = false;
|
|
||||||
Functions.getSessionChatPass(Functions.getSession(socket), function(name, pass) {
|
|
||||||
var fetched = false;
|
|
||||||
if(data.hasOwnProperty("first") && data.first) {
|
|
||||||
pw = pass;
|
|
||||||
name = name;
|
|
||||||
data.name = name;
|
|
||||||
data.password = pass;
|
|
||||||
new_password = false;
|
|
||||||
if(name == "" || pass == "") {
|
|
||||||
if(typeof(callback) == "function") callback();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
fetched = true;
|
|
||||||
password = pw;
|
|
||||||
} else {
|
} else {
|
||||||
var name = data.name;
|
callback();
|
||||||
if(data.hasOwnProperty("first")) {
|
}
|
||||||
first = data.first;
|
});
|
||||||
}
|
}
|
||||||
if(data.hasOwnProperty("password")) {
|
}
|
||||||
pw = data.password;
|
|
||||||
|
function checkIfUserIsBanned(channel, socket, guid, callback, callback_error) {
|
||||||
|
var connection_id = Functions.hash_pass(socket.handshake.headers["user-agent"] + socket.handshake.address + socket.handshake.headers["accept-language"]);
|
||||||
|
db.collection(channel + "_banned_chat").find({connection_id: connection_id}, function(err, docs) {
|
||||||
|
if(docs.length == 0) callback();
|
||||||
|
else {
|
||||||
|
db.collection("user_names").findAndModify({query: {guid, guid}, update: {$addToSet:{channels: channel}}}, function(e, d){
|
||||||
|
socket.emit('chat', {from: "System", msg: ": You can't chat in this channel, you are banned. The reason is: " + docs[0].reason, icon: "https://zoff.me/assets/images/favicon-32x32.png"});
|
||||||
|
if(typeof(callback_error) == "function") callback_error();
|
||||||
|
else return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function namechange(data, guid, socket, tried, callback) {
|
||||||
|
checkIfChatEnabled(data.channel, socket, function() {
|
||||||
|
checkIfUserIsBanned(data.channel, socket, guid, function() {
|
||||||
|
var pw = "";
|
||||||
|
var new_password;
|
||||||
|
var first = false;
|
||||||
|
Functions.getSessionChatPass(Functions.getSession(socket), function(name, pass) {
|
||||||
|
var fetched = false;
|
||||||
|
if(data.hasOwnProperty("first") && data.first) {
|
||||||
|
pw = pass;
|
||||||
|
name = name;
|
||||||
|
data.name = name;
|
||||||
|
data.password = pass;
|
||||||
new_password = false;
|
new_password = false;
|
||||||
} else if(data.hasOwnProperty("new_password") && data.hasOwnProperty("old_password")) {
|
if(name == "" || pass == "") {
|
||||||
pw = data.old_password;
|
|
||||||
new_password = Functions.decrypt_string(data.new_password);
|
|
||||||
}
|
|
||||||
password = Functions.decrypt_string(pw);
|
|
||||||
password = Functions.hash_pass(password);
|
|
||||||
doubled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(name == "") {
|
|
||||||
if(typeof(callback) == "function") callback();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
db.collection("registered_users").find({"_id": name.toLowerCase()}, function(err, docs) {
|
|
||||||
var accepted_password = false;
|
|
||||||
var icon = false;
|
|
||||||
if(docs.length == 0) {
|
|
||||||
if(new_password) {
|
|
||||||
if(typeof(callback) == "function") callback();
|
if(typeof(callback) == "function") callback();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
accepted_password = true;
|
fetched = true;
|
||||||
Functions.setSessionChatPass(Functions.getSession(socket), name.toLowerCase(), data.password, function() {
|
password = pw;
|
||||||
db.collection("registered_users").update({"_id": name.toLowerCase()}, {$set: {password: password}}, {upsert: true}, function() {
|
} else {
|
||||||
});
|
var name = data.name;
|
||||||
});
|
if(data.hasOwnProperty("first")) {
|
||||||
} else if(docs[0].password == password) {
|
first = data.first;
|
||||||
if(docs[0].icon) {
|
|
||||||
icon = docs[0].icon;
|
|
||||||
}
|
}
|
||||||
accepted_password = true;
|
if(data.hasOwnProperty("password")) {
|
||||||
if(new_password) {
|
pw = data.password;
|
||||||
Functions.setSessionChatPass(Functions.getSession(socket), name.toLowerCase(), data.new_password, function() {
|
new_password = false;
|
||||||
|
} else if(data.hasOwnProperty("new_password") && data.hasOwnProperty("old_password")) {
|
||||||
|
pw = data.old_password;
|
||||||
|
new_password = Functions.decrypt_string(data.new_password);
|
||||||
|
}
|
||||||
|
password = Functions.decrypt_string(pw);
|
||||||
|
password = Functions.hash_pass(password);
|
||||||
|
doubled = true;
|
||||||
|
}
|
||||||
|
|
||||||
db.collection("registered_users").update({"_id": name.toLowerCase(), password: password}, {$set: {password: Functions.hash_pass(new_password)}}, function() {
|
if(name == "") {
|
||||||
|
if(typeof(callback) == "function") callback();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
db.collection("registered_users").find({"_id": name.toLowerCase()}, function(err, docs) {
|
||||||
|
var accepted_password = false;
|
||||||
|
var icon = false;
|
||||||
|
if(docs.length == 0) {
|
||||||
|
if(new_password) {
|
||||||
|
if(typeof(callback) == "function") callback();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
accepted_password = true;
|
||||||
|
Functions.setSessionChatPass(Functions.getSession(socket), name.toLowerCase(), data.password, function() {
|
||||||
|
db.collection("registered_users").update({"_id": name.toLowerCase()}, {$set: {password: password}}, {upsert: true}, function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else if(docs[0].password == password) {
|
||||||
Functions.setSessionChatPass(Functions.getSession(socket), name.toLowerCase(), fetched ? data.password : Functions.hash_pass(Functions.decrypt_string(data.password)), function() {
|
if(docs[0].icon) {
|
||||||
});
|
icon = docs[0].icon;
|
||||||
}
|
}
|
||||||
}
|
accepted_password = true;
|
||||||
if(accepted_password) {
|
if(new_password) {
|
||||||
|
Functions.setSessionChatPass(Functions.getSession(socket), name.toLowerCase(), data.new_password, function() {
|
||||||
|
|
||||||
|
db.collection("registered_users").update({"_id": name.toLowerCase(), password: password}, {$set: {password: Functions.hash_pass(new_password)}}, function() {
|
||||||
|
|
||||||
db.collection("user_names").find({"guid": guid}, function(err, names) {
|
|
||||||
if(names.length > 0 || (docs.length != 0 && docs[0].password == password)) {
|
|
||||||
var no_name = false;
|
|
||||||
if(names.length == 0) no_name = true;
|
|
||||||
if(!no_name) {
|
|
||||||
var old_name = names[0].name;
|
|
||||||
db.collection("user_names").update({"_id": "all_names"}, {$pull: {names: old_name}}, function() {});
|
|
||||||
}
|
|
||||||
var updateElement = {$set: {name: name, icon: icon}};
|
|
||||||
if(data.hasOwnProperty("channel") && data.channel != "") {
|
|
||||||
updateElement["$addToSet"] = {channels: data.channel};
|
|
||||||
}
|
|
||||||
db.collection("user_names").update({"guid": guid}, updateElement, {upsert: true}, function(err, docs) {
|
|
||||||
db.collection("user_names").update({"_id": "all_names"}, {$addToSet: {names: name}}, function(err, docs) {
|
|
||||||
//socket.emit('name', {type: "name", accepted: true});
|
|
||||||
if(old_name != name && !first && !no_name) {
|
|
||||||
if(data.hasOwnProperty("channel") && typeof(data.channel) == "string") {
|
|
||||||
io.to(data.channel).emit('chat', {from: old_name, msg: " changed name to " + name});
|
|
||||||
io.sockets.emit('chat.all', {from: old_name , msg: " changed name to " + name, channel: data.channel});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(callback != undefined && typeof(callback) == "function") callback();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if(tried < 3 || tried == undefined) {
|
Functions.setSessionChatPass(Functions.getSession(socket), name.toLowerCase(), fetched ? data.password : Functions.hash_pass(Functions.decrypt_string(data.password)), function() {
|
||||||
if(tried == undefined) {
|
});
|
||||||
tried = 1;
|
|
||||||
}
|
|
||||||
namechange(data, guid, socket, tried + 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
} else {
|
if(accepted_password) {
|
||||||
Functions.removeSessionChatPass(Functions.getSession(socket), function() {
|
|
||||||
socket.emit('name', {type: "name", accepted: false});
|
db.collection("user_names").find({"guid": guid}, function(err, names) {
|
||||||
});
|
if(names.length > 0 || (docs.length != 0 && docs[0].password == password)) {
|
||||||
}
|
var no_name = false;
|
||||||
|
if(names.length == 0) no_name = true;
|
||||||
|
if(!no_name) {
|
||||||
|
var old_name = names[0].name;
|
||||||
|
db.collection("user_names").update({"_id": "all_names"}, {$pull: {names: old_name}}, function() {});
|
||||||
|
}
|
||||||
|
var updateElement = {$set: {name: name, icon: icon}};
|
||||||
|
if(data.hasOwnProperty("channel") && data.channel != "") {
|
||||||
|
updateElement["$addToSet"] = {channels: data.channel};
|
||||||
|
}
|
||||||
|
db.collection("user_names").update({"guid": guid}, updateElement, {upsert: true}, function(err, docs) {
|
||||||
|
db.collection("user_names").update({"_id": "all_names"}, {$addToSet: {names: name}}, function(err, docs) {
|
||||||
|
//socket.emit('name', {type: "name", accepted: true});
|
||||||
|
if(old_name != name && !first && !no_name) {
|
||||||
|
if(data.hasOwnProperty("channel") && typeof(data.channel) == "string") {
|
||||||
|
io.to(data.channel).emit('chat', {from: old_name, msg: " changed name to " + name});
|
||||||
|
io.sockets.emit('chat.all', {from: old_name , msg: " changed name to " + name, channel: data.channel});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(callback != undefined && typeof(callback) == "function") callback();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if(tried < 3 || tried == undefined) {
|
||||||
|
if(tried == undefined) {
|
||||||
|
tried = 1;
|
||||||
|
}
|
||||||
|
namechange(data, guid, socket, tried + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
Functions.removeSessionChatPass(Functions.getSession(socket), function() {
|
||||||
|
socket.emit('name', {type: "name", accepted: false});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}, callback);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function removename(guid, coll, socket) {
|
function removename(guid, coll, socket) {
|
||||||
//coll = coll.replace(/ /g,'');
|
//coll = coll.replace(/ /g,'');
|
||||||
db.collection("user_names").find({"guid": guid}, function(err, docs) {
|
checkIfChatEnabled(coll, socket, function() {
|
||||||
if(docs.length == 1) {
|
db.collection("user_names").find({"guid": guid}, function(err, docs) {
|
||||||
var old_name = docs[0].name;
|
if(docs.length == 1) {
|
||||||
Functions.removeSessionChatPass(Functions.getSession(socket), function() {
|
var old_name = docs[0].name;
|
||||||
db.collection("user_names").update({"_id": "all_names"}, {$pull: {names: old_name}}, function(err, updated) {
|
Functions.removeSessionChatPass(Functions.getSession(socket), function() {
|
||||||
db.collection("user_names").remove({"guid": guid}, function(err, removed) {
|
db.collection("user_names").update({"_id": "all_names"}, {$pull: {names: old_name}}, function(err, updated) {
|
||||||
get_name(guid, {announce: true, old_name: old_name, channel: coll, socket: socket});
|
db.collection("user_names").remove({"guid": guid}, function(err, removed) {
|
||||||
|
get_name(guid, {announce: true, old_name: old_name, channel: coll, socket: socket});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -317,10 +317,11 @@ function setChromecastHost(id, other_id, list, callback) {
|
|||||||
|
|
||||||
function setSessionUserPass(id, userpass, list, callback) {
|
function setSessionUserPass(id, userpass, list, callback) {
|
||||||
try {
|
try {
|
||||||
if(id == "empty" || id == undefined) {
|
if(id == "empty" || id == undefined || userpass == undefined) {
|
||||||
callback();
|
callback();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
connected_db.collection(id).update({_id: list}, {$set: {userpass: userpass}}, {upsert: true}, function(e, d){
|
connected_db.collection(id).update({_id: list}, {$set: {userpass: userpass}}, {upsert: true}, function(e, d){
|
||||||
callback();
|
callback();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ function addFromOtherList(arr, guid, offline, socket) {
|
|||||||
} else {
|
} else {
|
||||||
otheruser = crypto.createHash('sha256').update(Functions.decrypt_string(otheruser)).digest("base64");
|
otheruser = crypto.createHash('sha256').update(Functions.decrypt_string(otheruser)).digest("base64");
|
||||||
}
|
}
|
||||||
|
|
||||||
db.collection(channel).find({now_playing: true}, function(e, np) {
|
db.collection(channel).find({now_playing: true}, function(e, np) {
|
||||||
|
|
||||||
var project_object = {
|
var project_object = {
|
||||||
|
|||||||
@@ -179,8 +179,8 @@ function conf_function(params, coll, guid, offline, socket) {
|
|||||||
var adminpass = params.adminpass;
|
var adminpass = params.adminpass;
|
||||||
var skipping = params.skipping;
|
var skipping = params.skipping;
|
||||||
var shuffling = params.shuffling;
|
var shuffling = params.shuffling;
|
||||||
var userpass = Functions.decrypt_string(params.userpass);
|
|
||||||
|
|
||||||
|
var userpass = Functions.decrypt_string(params.userpass);
|
||||||
|
|
||||||
if((!params.userpass_changed && frontpage) || (params.userpass_changed && userpass == "")) {
|
if((!params.userpass_changed && frontpage) || (params.userpass_changed && userpass == "")) {
|
||||||
userpass = "";
|
userpass = "";
|
||||||
@@ -218,6 +218,9 @@ function conf_function(params, coll, guid, offline, socket) {
|
|||||||
adminpass:hash,
|
adminpass:hash,
|
||||||
desc: description,
|
desc: description,
|
||||||
};
|
};
|
||||||
|
if(params.hasOwnProperty("toggleChat") && docs[0].adminpass != "" && docs[0].adminpass != undefined && docs[0].adminpass == hash) {
|
||||||
|
obj.toggleChat = params.toggleChat;
|
||||||
|
}
|
||||||
if(params.userpass_changed) {
|
if(params.userpass_changed) {
|
||||||
obj["userpass"] = userpass;
|
obj["userpass"] = userpass;
|
||||||
} else if (frontpage) {
|
} else if (frontpage) {
|
||||||
@@ -226,7 +229,7 @@ function conf_function(params, coll, guid, offline, socket) {
|
|||||||
db.collection(coll + "_settings").update({ id: "config" }, {
|
db.collection(coll + "_settings").update({ id: "config" }, {
|
||||||
$set:obj
|
$set:obj
|
||||||
}, function(err, docs){
|
}, function(err, docs){
|
||||||
Functions.setSessionUserPass(Functions.getSession(socket), crypto.createHash('sha256').update(Functions.decrypt_string(params.userpass)).digest('base64'), coll, function() {
|
Functions.setSessionUserPass(Functions.getSession(socket), obj["userpass"], coll, function() {
|
||||||
db.collection(coll + "_settings").find(function(err, docs){
|
db.collection(coll + "_settings").find(function(err, docs){
|
||||||
if(docs[0].adminpass !== "") docs[0].adminpass = true;
|
if(docs[0].adminpass !== "") docs[0].adminpass = true;
|
||||||
if(docs[0].hasOwnProperty("userpass") && docs[0].userpass != "") docs[0].userpass = true;
|
if(docs[0].hasOwnProperty("userpass") && docs[0].userpass != "") docs[0].userpass = true;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ var Admin = {
|
|||||||
}
|
}
|
||||||
Helper.removeClass(".delete-context-menu", "context-menu-disabled");
|
Helper.removeClass(".delete-context-menu", "context-menu-disabled");
|
||||||
names = ["vote","addsongs","longsongs","frontpage", "allvideos",
|
names = ["vote","addsongs","longsongs","frontpage", "allvideos",
|
||||||
"removeplay", "skip", "shuffle", "userpass"];
|
"removeplay", "skip", "shuffle", "userpass", "toggleChat"];
|
||||||
//Crypt.set_pass(chan.toLowerCase(), Crypt.tmp_pass);
|
//Crypt.set_pass(chan.toLowerCase(), Crypt.tmp_pass);
|
||||||
|
|
||||||
for (var i = 0; i < names.length; i++) {
|
for (var i = 0; i < names.length; i++) {
|
||||||
@@ -42,6 +42,7 @@ var Admin = {
|
|||||||
document.getElementById("password").value = "";
|
document.getElementById("password").value = "";
|
||||||
document.getElementById("password").setAttribute("placeholder", "Change admin password");
|
document.getElementById("password").setAttribute("placeholder", "Change admin password");
|
||||||
Helper.removeClass(".user-password-li", "hide");
|
Helper.removeClass(".user-password-li", "hide");
|
||||||
|
Helper.removeClass(".chat-toggle-li", "hide");
|
||||||
Helper.removeClass(".delete-all", "hide");
|
Helper.removeClass(".delete-all", "hide");
|
||||||
if(document.getElementsByClassName("password_protected")[0].checked) {
|
if(document.getElementsByClassName("password_protected")[0].checked) {
|
||||||
Helper.removeClass(".change_user_pass", "hide");
|
Helper.removeClass(".change_user_pass", "hide");
|
||||||
@@ -105,7 +106,7 @@ var Admin = {
|
|||||||
w_p = true;
|
w_p = true;
|
||||||
adminpass = "";
|
adminpass = "";
|
||||||
names = ["vote","addsongs","longsongs","frontpage", "allvideos",
|
names = ["vote","addsongs","longsongs","frontpage", "allvideos",
|
||||||
"removeplay", "skip", "shuffle"];
|
"removeplay", "skip", "shuffle", "toggleChat"];
|
||||||
document.getElementById("password").value = "";
|
document.getElementById("password").value = "";
|
||||||
Helper.css("#thumbnail_form", "display", "none");
|
Helper.css("#thumbnail_form", "display", "none");
|
||||||
Helper.css("#description_form", "display", "none");
|
Helper.css("#description_form", "display", "none");
|
||||||
@@ -123,6 +124,7 @@ var Admin = {
|
|||||||
|
|
||||||
|
|
||||||
Helper.addClass(".user-password-li", "hide");
|
Helper.addClass(".user-password-li", "hide");
|
||||||
|
Helper.addClass(".chat-toggle-li", "hide");
|
||||||
Helper.addClass(".delete-all", "hide");
|
Helper.addClass(".delete-all", "hide");
|
||||||
|
|
||||||
if(document.getElementsByClassName("password_protected")[0].checked) {
|
if(document.getElementsByClassName("password_protected")[0].checked) {
|
||||||
@@ -146,9 +148,9 @@ var Admin = {
|
|||||||
music = conf_array.allvideos;
|
music = conf_array.allvideos;
|
||||||
longsongs = conf_array.longsongs;
|
longsongs = conf_array.longsongs;
|
||||||
names = ["vote","addsongs","longsongs","frontpage", "allvideos",
|
names = ["vote","addsongs","longsongs","frontpage", "allvideos",
|
||||||
"removeplay", "skip", "shuffle", "userpass"];
|
"removeplay", "skip", "shuffle", "userpass", "toggleChat"];
|
||||||
|
if(!conf.hasOwnProperty("toggleChat")) conf.toggleChat = true;
|
||||||
|
toggleChat = conf.toggleChat;
|
||||||
hasadmin = conf_array.adminpass != "";
|
hasadmin = conf_array.adminpass != "";
|
||||||
var show_disabled = true;
|
var show_disabled = true;
|
||||||
if(hasadmin && Admin.logged_in || !hasadmin) {
|
if(hasadmin && Admin.logged_in || !hasadmin) {
|
||||||
@@ -197,6 +199,8 @@ var Admin = {
|
|||||||
removeplay = form.removeplay.checked;
|
removeplay = form.removeplay.checked;
|
||||||
skipping = form.skip.checked;
|
skipping = form.skip.checked;
|
||||||
shuffling = form.shuffle.checked;
|
shuffling = form.shuffle.checked;
|
||||||
|
toggleChat = form.toggleChat.checked;
|
||||||
|
|
||||||
var pass_send = userpass_changed && !form.userpass.checked ? "" : userpass;
|
var pass_send = userpass_changed && !form.userpass.checked ? "" : userpass;
|
||||||
configs = {
|
configs = {
|
||||||
channel: chan.toLowerCase(),
|
channel: chan.toLowerCase(),
|
||||||
@@ -209,6 +213,7 @@ var Admin = {
|
|||||||
adminpass: adminpass == "" ? "" : Crypt.crypt_pass(adminpass),
|
adminpass: adminpass == "" ? "" : Crypt.crypt_pass(adminpass),
|
||||||
skipping: skipping,
|
skipping: skipping,
|
||||||
shuffling: shuffling,
|
shuffling: shuffling,
|
||||||
|
toggleChat: toggleChat,
|
||||||
userpass: Crypt.crypt_pass(pass_send),
|
userpass: Crypt.crypt_pass(pass_send),
|
||||||
userpass_changed: userpass_changed
|
userpass_changed: userpass_changed
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ var Chat = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
channelchat: function(data, time_sent, disable_blink) {
|
channelchat: function(data, time_sent, disable_blink) {
|
||||||
if(data.msg.substring(0,1) == ":" && !chat_active && !disable_blink) {
|
if(data.msg.substring(0,1) == ":" && !chat_active && !disable_blink && data.from.toLowerCase() != "system") {
|
||||||
document.querySelector("#favicon").setAttribute("href", "/assets/images/highlogo.png");
|
document.querySelector("#favicon").setAttribute("href", "/assets/images/highlogo.png");
|
||||||
unseen = true;
|
unseen = true;
|
||||||
chat_unseen = true;
|
chat_unseen = true;
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ var frontpage = 1;
|
|||||||
var adminpass = "";
|
var adminpass = "";
|
||||||
var showDiscovery = false;
|
var showDiscovery = false;
|
||||||
var player_ready = false;
|
var player_ready = false;
|
||||||
|
var toggleChat = true;
|
||||||
var viewers = 1;
|
var viewers = 1;
|
||||||
var temp_user_pass = "";
|
var temp_user_pass = "";
|
||||||
var zoff_api_token = "DwpnKVkaMH2HdcpJT2YPy783SY33byF5/32rbs0+xdU=";
|
var zoff_api_token = "DwpnKVkaMH2HdcpJT2YPy783SY33byF5/32rbs0+xdU=";
|
||||||
|
|||||||
@@ -3,148 +3,7 @@
|
|||||||
<i class="material-icons auto-margin">close</i>
|
<i class="material-icons auto-margin">close</i>
|
||||||
</div>
|
</div>
|
||||||
<ul class="collapsible collapsible-accordion settings-collapsible">
|
<ul class="collapsible collapsible-accordion settings-collapsible">
|
||||||
<li class="no-padding">
|
{{> channel/settings}}
|
||||||
<div class="col s9 collapsible-header bold waves-effect admin-settings">
|
|
||||||
Channel Settings
|
|
||||||
<i class="material-icons">tune</i>
|
|
||||||
</div>
|
|
||||||
<div class="collapsible-body">
|
|
||||||
<ul>
|
|
||||||
<form action="#" id="adminForm" onsubmit="return false;">
|
|
||||||
|
|
||||||
<li class="white-bg">
|
|
||||||
<div class="input-field field-settings">
|
|
||||||
<i id="admin-lock" class="material-icons">lock</i>
|
|
||||||
<input placeholder="Enter admin password" id="password" type="password" class="validate" />
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<span class="switch-text">
|
|
||||||
Add songs
|
|
||||||
</span>
|
|
||||||
<div class="switch">
|
|
||||||
<label>
|
|
||||||
<span class="left-span">Anyone</span>
|
|
||||||
<input name="addsongs" type="checkbox" class="conf" /><span class="lever"></span>
|
|
||||||
<span class="right-span">Admin</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<span class="switch-text">
|
|
||||||
Vote
|
|
||||||
</span>
|
|
||||||
<div class="switch">
|
|
||||||
<label>
|
|
||||||
<span class="left-span">Anyone</span>
|
|
||||||
<input name="vote" type="checkbox" class="conf" /><span class="lever"></span>
|
|
||||||
<span class="right-span">Admin</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<span class="switch-text">
|
|
||||||
Shuffle
|
|
||||||
</span>
|
|
||||||
<div class="switch">
|
|
||||||
<label>
|
|
||||||
<span class="left-span">Anyone</span>
|
|
||||||
<input name="shuffle" type="checkbox" class="conf" /><span class="lever"></span>
|
|
||||||
<span class="right-span">Admin</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<span class="switch-text">
|
|
||||||
Skip
|
|
||||||
</span>
|
|
||||||
<div class="switch">
|
|
||||||
<label>
|
|
||||||
<span class="left-span">Anyone</span>
|
|
||||||
<input name="skip" type="checkbox" class="conf" /><span class="lever"></span>
|
|
||||||
<span class="right-span">Admin</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<span class="switch-text">
|
|
||||||
Song length
|
|
||||||
</span>
|
|
||||||
<div class="switch">
|
|
||||||
<label>
|
|
||||||
<span class="left-span">Any</span>
|
|
||||||
<input name="longsongs" type="checkbox" class="conf" /><span class="lever"></span>
|
|
||||||
<span class="right-span">Short</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<span class="switch-text">
|
|
||||||
Type
|
|
||||||
</span>
|
|
||||||
<div class="switch">
|
|
||||||
<label>
|
|
||||||
<span class="left-span">Any</span>
|
|
||||||
<input name="allvideos" type="checkbox" class="conf" /><span class="lever"></span>
|
|
||||||
<span class="right-span">Song</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<span class="switch-text">
|
|
||||||
Frontpage
|
|
||||||
</span>
|
|
||||||
<div class="switch">
|
|
||||||
<label>
|
|
||||||
<span class="left-span">Hide</span>
|
|
||||||
<input name="frontpage" type="checkbox" class="conf" /><span class="lever"></span>
|
|
||||||
<span class="right-span">Display</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
<span class="switch-text">
|
|
||||||
After play
|
|
||||||
</span>
|
|
||||||
<div class="switch">
|
|
||||||
<label>
|
|
||||||
<span class="left-span">Keep</span>
|
|
||||||
<input name="removeplay" type="checkbox" class="conf" /><span class="lever"></span>
|
|
||||||
<span class="right-span">Remove</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class="user-password-li hide">
|
|
||||||
<span class="switch-text">
|
|
||||||
Channel password
|
|
||||||
</span>
|
|
||||||
<div class="switch">
|
|
||||||
<label>
|
|
||||||
<span class="left-span">No</span>
|
|
||||||
<input name="userpass" type="checkbox" class="conf password_protected" /><span class="lever"></span>
|
|
||||||
<span class="right-span">Yes</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<li class="change_user_pass hide">
|
|
||||||
<a href="#!" class="change_user_pass_btn btn waves-effect blue">Change password</a>
|
|
||||||
</li>
|
|
||||||
<li class="delete-all hide">
|
|
||||||
<a href="#" class="delete-all-songs btn red">Delete all songs</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<li class="no-padding">
|
<li class="no-padding">
|
||||||
<div class="collapsible-header bold waves-effect">Channel Info
|
<div class="collapsible-header bold waves-effect">Channel Info
|
||||||
<i class="material-icons">info_outline</i>
|
<i class="material-icons">info_outline</i>
|
||||||
|
|||||||
151
server/public/partials/channel/settings.handlebars
Normal file
151
server/public/partials/channel/settings.handlebars
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
<li class="no-padding">
|
||||||
|
<div class="col s9 collapsible-header bold waves-effect admin-settings">
|
||||||
|
Channel Settings
|
||||||
|
<i class="material-icons">tune</i>
|
||||||
|
</div>
|
||||||
|
<div class="collapsible-body">
|
||||||
|
<ul>
|
||||||
|
<form action="#" id="adminForm" onsubmit="return false;">
|
||||||
|
|
||||||
|
<li class="white-bg">
|
||||||
|
<div class="input-field field-settings">
|
||||||
|
<i id="admin-lock" class="material-icons">lock</i>
|
||||||
|
<input placeholder="Enter admin password" id="password" type="password" class="validate" />
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<span class="switch-text">
|
||||||
|
Add songs
|
||||||
|
</span>
|
||||||
|
<div class="switch">
|
||||||
|
<label>
|
||||||
|
<span class="left-span">Anyone</span>
|
||||||
|
<input name="addsongs" type="checkbox" class="conf" /><span class="lever"></span>
|
||||||
|
<span class="right-span">Admin</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<span class="switch-text">
|
||||||
|
Vote
|
||||||
|
</span>
|
||||||
|
<div class="switch">
|
||||||
|
<label>
|
||||||
|
<span class="left-span">Anyone</span>
|
||||||
|
<input name="vote" type="checkbox" class="conf" /><span class="lever"></span>
|
||||||
|
<span class="right-span">Admin</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<span class="switch-text">
|
||||||
|
Shuffle
|
||||||
|
</span>
|
||||||
|
<div class="switch">
|
||||||
|
<label>
|
||||||
|
<span class="left-span">Anyone</span>
|
||||||
|
<input name="shuffle" type="checkbox" class="conf" /><span class="lever"></span>
|
||||||
|
<span class="right-span">Admin</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<span class="switch-text">
|
||||||
|
Skip
|
||||||
|
</span>
|
||||||
|
<div class="switch">
|
||||||
|
<label>
|
||||||
|
<span class="left-span">Anyone</span>
|
||||||
|
<input name="skip" type="checkbox" class="conf" /><span class="lever"></span>
|
||||||
|
<span class="right-span">Admin</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<span class="switch-text">
|
||||||
|
Song length
|
||||||
|
</span>
|
||||||
|
<div class="switch">
|
||||||
|
<label>
|
||||||
|
<span class="left-span">Any</span>
|
||||||
|
<input name="longsongs" type="checkbox" class="conf" /><span class="lever"></span>
|
||||||
|
<span class="right-span">Short</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<span class="switch-text">
|
||||||
|
Type
|
||||||
|
</span>
|
||||||
|
<div class="switch">
|
||||||
|
<label>
|
||||||
|
<span class="left-span">Any</span>
|
||||||
|
<input name="allvideos" type="checkbox" class="conf" /><span class="lever"></span>
|
||||||
|
<span class="right-span">Song</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<span class="switch-text">
|
||||||
|
Frontpage
|
||||||
|
</span>
|
||||||
|
<div class="switch">
|
||||||
|
<label>
|
||||||
|
<span class="left-span">Hide</span>
|
||||||
|
<input name="frontpage" type="checkbox" class="conf" /><span class="lever"></span>
|
||||||
|
<span class="right-span">Display</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<span class="switch-text">
|
||||||
|
After play
|
||||||
|
</span>
|
||||||
|
<div class="switch">
|
||||||
|
<label>
|
||||||
|
<span class="left-span">Keep</span>
|
||||||
|
<input name="removeplay" type="checkbox" class="conf" /><span class="lever"></span>
|
||||||
|
<span class="right-span">Remove</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="chat-toggle-li hide">
|
||||||
|
<span class="switch-text">
|
||||||
|
Chat
|
||||||
|
</span>
|
||||||
|
<div class="switch">
|
||||||
|
<label>
|
||||||
|
<span class="left-span">Disabled</span>
|
||||||
|
<input name="toggleChat" type="checkbox" class="conf" /><span class="lever"></span>
|
||||||
|
<span class="right-span">Enabled</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="user-password-li hide">
|
||||||
|
<span class="switch-text">
|
||||||
|
Channel password
|
||||||
|
</span>
|
||||||
|
<div class="switch">
|
||||||
|
<label>
|
||||||
|
<span class="left-span">No</span>
|
||||||
|
<input name="userpass" type="checkbox" class="conf password_protected" /><span class="lever"></span>
|
||||||
|
<span class="right-span">Yes</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<li class="change_user_pass hide">
|
||||||
|
<a href="#!" class="change_user_pass_btn btn waves-effect blue">Change password</a>
|
||||||
|
</li>
|
||||||
|
<li class="delete-all hide">
|
||||||
|
<a href="#" class="delete-all-songs btn red">Delete all songs</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
Reference in New Issue
Block a user