mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Fixed issue with channels having spaces
This commit is contained in:
@@ -10,6 +10,7 @@ function get_history(channel, all, socket) {
|
|||||||
channel: channel,
|
channel: channel,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
channel = channel.replace(/ /g,'');
|
||||||
var pass = "";
|
var pass = "";
|
||||||
if(!query.all) {
|
if(!query.all) {
|
||||||
Functions.getSessionAdminUser(Functions.getSession(socket), channel, function(userpass) {
|
Functions.getSessionAdminUser(Functions.getSession(socket), channel, function(userpass) {
|
||||||
@@ -28,6 +29,7 @@ function get_history(channel, all, socket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAndSendLogs(channel, all, socket, pass, query) {
|
function getAndSendLogs(channel, all, socket, pass, query) {
|
||||||
|
channel = channel.replace(/ /g,'');
|
||||||
db.collection("chat_logs").find(query, {
|
db.collection("chat_logs").find(query, {
|
||||||
from: 1,
|
from: 1,
|
||||||
createdAt: 1,
|
createdAt: 1,
|
||||||
@@ -62,7 +64,7 @@ function chat(msg, guid, offline, socket) {
|
|||||||
socket.emit('update_required', result);
|
socket.emit('update_required', result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var coll = msg.channel.toLowerCase();
|
var coll = msg.channel.toLowerCase().replace(/ /g,'');
|
||||||
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass) {
|
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass) {
|
||||||
msg.pass = userpass;
|
msg.pass = userpass;
|
||||||
db.collection(coll + "_settings").find(function(err, docs){
|
db.collection(coll + "_settings").find(function(err, docs){
|
||||||
@@ -110,7 +112,7 @@ function all_chat(msg, guid, offline, socket) {
|
|||||||
socket.emit('update_required', result);
|
socket.emit('update_required', result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var coll = msg.channel.toLowerCase();
|
var coll = msg.channel.toLowerCase().replace(/ /g,'');
|
||||||
var data = msg.data;
|
var data = msg.data;
|
||||||
|
|
||||||
Functions.check_inlist(coll, guid, socket, offline);
|
Functions.check_inlist(coll, guid, socket, offline);
|
||||||
@@ -201,7 +203,7 @@ function namechange(data, guid, socket, tried) {
|
|||||||
//socket.emit('name', {type: "name", accepted: true});
|
//socket.emit('name', {type: "name", accepted: true});
|
||||||
if(old_name != name && !first) {
|
if(old_name != name && !first) {
|
||||||
if(data.hasOwnProperty("channel") && typeof(data.channel) == "string") {
|
if(data.hasOwnProperty("channel") && typeof(data.channel) == "string") {
|
||||||
io.to(data.channel).emit('chat', {from: old_name, msg: " changed name to " + name});
|
io.to(data.channel.replace(/ /g,'')).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});
|
io.sockets.emit('chat.all', {from: old_name , msg: " changed name to " + name, channel: data.channel});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -226,6 +228,7 @@ function namechange(data, guid, socket, tried) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function removename(guid, coll, socket) {
|
function removename(guid, coll, socket) {
|
||||||
|
coll = coll.replace(/ /g,'');
|
||||||
db.collection("user_names").find({"guid": guid}, function(err, docs) {
|
db.collection("user_names").find({"guid": guid}, function(err, docs) {
|
||||||
if(docs.length == 1) {
|
if(docs.length == 1) {
|
||||||
var old_name = docs[0].name;
|
var old_name = docs[0].name;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ function frontpage_lists(msg, socket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function update_frontpage(coll, id, title, callback) {
|
function update_frontpage(coll, id, title, callback) {
|
||||||
|
coll = coll.replace(/ /g,'');
|
||||||
db.collection("frontpage_lists").update({_id: coll}, {$set: {
|
db.collection("frontpage_lists").update({_id: coll}, {$set: {
|
||||||
id: id,
|
id: id,
|
||||||
title: title,
|
title: title,
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ function get_short_id(socket) {
|
|||||||
|
|
||||||
function check_inlist(coll, guid, socket, offline)
|
function check_inlist(coll, guid, socket, offline)
|
||||||
{
|
{
|
||||||
|
coll = coll.replace(/ /g,'');
|
||||||
if(!offline && coll != undefined){
|
if(!offline && coll != undefined){
|
||||||
db.collection("connected_users").update({"_id": coll}, {$addToSet:{users: guid}}, {upsert: true}, function(err, updated) {
|
db.collection("connected_users").update({"_id": coll}, {$addToSet:{users: guid}}, {upsert: true}, function(err, updated) {
|
||||||
if(updated.nModified > 0 || updated.upserted != undefined) {
|
if(updated.nModified > 0 || updated.upserted != undefined) {
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ module.exports = function() {
|
|||||||
|
|
||||||
socket.on('self_ping', function(msg) {
|
socket.on('self_ping', function(msg) {
|
||||||
var channel = msg.channel;
|
var channel = msg.channel;
|
||||||
|
channel = channel.replace(/ /g,'');
|
||||||
if(offline) {
|
if(offline) {
|
||||||
db.collection("connected_users").update({"_id": "offline_users"}, {$addToSet: {users: guid}}, {upsert: true}, function(err, docs){});
|
db.collection("connected_users").update({"_id": "offline_users"}, {$addToSet: {users: guid}}, {upsert: true}, function(err, docs){});
|
||||||
} else {
|
} else {
|
||||||
@@ -68,7 +69,7 @@ module.exports = function() {
|
|||||||
guid = msg.guid;
|
guid = msg.guid;
|
||||||
socketid = msg.socket_id;
|
socketid = msg.socket_id;
|
||||||
socket.zoff_id = socketid;
|
socket.zoff_id = socketid;
|
||||||
coll = msg.channel.toLowerCase();
|
coll = msg.channel.toLowerCase().replace(/ /g,'');
|
||||||
in_list = true;
|
in_list = true;
|
||||||
chromecast_object = true;
|
chromecast_object = true;
|
||||||
socket.join(coll);
|
socket.join(coll);
|
||||||
@@ -86,7 +87,7 @@ module.exports = function() {
|
|||||||
|
|
||||||
socket.on("error_video", function(msg) {
|
socket.on("error_video", function(msg) {
|
||||||
try {
|
try {
|
||||||
var _list = msg.channel;
|
var _list = msg.channel.replace(/ /g,'');
|
||||||
if(_list.length == 0) return;
|
if(_list.length == 0) return;
|
||||||
coll = emojiStrip(_list).toLowerCase();
|
coll = emojiStrip(_list).toLowerCase();
|
||||||
coll = coll.replace("_", "");
|
coll = coll.replace("_", "");
|
||||||
@@ -113,11 +114,11 @@ module.exports = function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on('suggest_thumbnail', function(msg){
|
socket.on('suggest_thumbnail', function(msg){
|
||||||
Suggestions.thumbnail(msg, coll, guid, offline, socket);
|
Suggestions.thumbnail(msg, coll.replace(/ /g,''), guid, offline, socket);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('suggest_description', function(msg){
|
socket.on('suggest_description', function(msg){
|
||||||
Suggestions.description(msg, coll, guid, offline, socket);
|
Suggestions.description(msg, coll.replace(/ /g,''), guid, offline, socket);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("namechange", function(msg) {
|
socket.on("namechange", function(msg) {
|
||||||
@@ -155,7 +156,7 @@ module.exports = function() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var status = msg.status;
|
var status = msg.status;
|
||||||
var channel = msg.channel;
|
var channel = msg.channel.replace(/ /g,'');
|
||||||
if(status){
|
if(status){
|
||||||
in_list = false;
|
in_list = false;
|
||||||
offline = true;
|
offline = true;
|
||||||
@@ -215,7 +216,7 @@ module.exports = function() {
|
|||||||
socket.emit('update_required', result);
|
socket.emit('update_required', result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Chat.get_history(msg.channel, msg.all, socket);
|
Chat.get_history(msg.channel.replace(/ /g,''), msg.all, socket);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('chat', function (msg) {
|
socket.on('chat', function (msg) {
|
||||||
@@ -246,7 +247,7 @@ module.exports = function() {
|
|||||||
socket.on('list', function(msg)
|
socket.on('list', function(msg)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
var _list = msg.channel;
|
var _list = msg.channel.replace(/ /g,'');
|
||||||
if(_list.length == 0) return;
|
if(_list.length == 0) return;
|
||||||
coll = emojiStrip(_list).toLowerCase();
|
coll = emojiStrip(_list).toLowerCase();
|
||||||
coll = coll.replace("_", "");
|
coll = coll.replace("_", "");
|
||||||
@@ -267,7 +268,7 @@ module.exports = function() {
|
|||||||
{
|
{
|
||||||
if(coll === undefined) {
|
if(coll === undefined) {
|
||||||
try {
|
try {
|
||||||
coll = obj.channel.toLowerCase();
|
coll = obj.channel.toLowerCase().replace(/ /g,'');
|
||||||
if(coll.length == 0) return;
|
if(coll.length == 0) return;
|
||||||
coll = emojiStrip(coll).toLowerCase();
|
coll = emojiStrip(coll).toLowerCase();
|
||||||
coll = coll.replace("_", "");
|
coll = coll.replace("_", "");
|
||||||
@@ -284,7 +285,7 @@ module.exports = function() {
|
|||||||
{
|
{
|
||||||
if(coll !== undefined) {
|
if(coll !== undefined) {
|
||||||
try {
|
try {
|
||||||
coll = arr.list;
|
coll = arr.list.replace(/ /g,'');
|
||||||
if(coll.length == 0) return;
|
if(coll.length == 0) return;
|
||||||
coll = emojiStrip(coll).toLowerCase();
|
coll = emojiStrip(coll).toLowerCase();
|
||||||
coll = coll.replace("_", "");
|
coll = coll.replace("_", "");
|
||||||
@@ -300,7 +301,7 @@ module.exports = function() {
|
|||||||
socket.on('delete_all', function(msg) {
|
socket.on('delete_all', function(msg) {
|
||||||
if(coll !== undefined) {
|
if(coll !== undefined) {
|
||||||
try {
|
try {
|
||||||
coll = msg.channel.toLowerCase();
|
coll = msg.channel.toLowerCase().replace(/ /g,'');
|
||||||
if(coll.length == 0) return;
|
if(coll.length == 0) return;
|
||||||
coll = emojiStrip(coll).toLowerCase();
|
coll = emojiStrip(coll).toLowerCase();
|
||||||
coll = coll.replace("_", "");
|
coll = coll.replace("_", "");
|
||||||
@@ -318,7 +319,7 @@ module.exports = function() {
|
|||||||
{
|
{
|
||||||
if(coll !== undefined) {
|
if(coll !== undefined) {
|
||||||
try {
|
try {
|
||||||
coll = msg.channel.toLowerCase();
|
coll = msg.channel.toLowerCase().replace(/ /g,'');
|
||||||
if(coll.length == 0) return;
|
if(coll.length == 0) return;
|
||||||
coll = emojiStrip(coll).toLowerCase();
|
coll = emojiStrip(coll).toLowerCase();
|
||||||
coll = coll.replace("_", "");
|
coll = coll.replace("_", "");
|
||||||
@@ -333,24 +334,24 @@ module.exports = function() {
|
|||||||
|
|
||||||
socket.on('password', function(inp)
|
socket.on('password', function(inp)
|
||||||
{
|
{
|
||||||
ListSettings.password(inp, coll, guid, offline, socket);
|
ListSettings.password(inp, coll.replace(/ /g,''), guid, offline, socket);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('skip', function(list)
|
socket.on('skip', function(list)
|
||||||
{
|
{
|
||||||
List.skip(list, guid, coll, offline, socket);
|
List.skip(list, guid, coll.replace(/ /g,''), offline, socket);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('conf', function(params)
|
socket.on('conf', function(params)
|
||||||
{
|
{
|
||||||
ListSettings.conf_function(params, coll, guid, offline, socket);
|
ListSettings.conf_function(params, coll.replace(/ /g,''), guid, offline, socket);
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on('shuffle', function(msg)
|
socket.on('shuffle', function(msg)
|
||||||
{
|
{
|
||||||
if(coll !== undefined) {
|
if(coll !== undefined) {
|
||||||
try {
|
try {
|
||||||
coll = msg.channel.toLowerCase();
|
coll = msg.channel.toLowerCase().replace(/ /g,'');
|
||||||
if(coll.length == 0) return;
|
if(coll.length == 0) return;
|
||||||
coll = emojiStrip(coll).toLowerCase();
|
coll = emojiStrip(coll).toLowerCase();
|
||||||
coll = coll.replace("_", "");
|
coll = coll.replace("_", "");
|
||||||
@@ -367,7 +368,7 @@ module.exports = function() {
|
|||||||
{
|
{
|
||||||
if(coll === undefined && obj !== undefined && obj.channel !== undefined){
|
if(coll === undefined && obj !== undefined && obj.channel !== undefined){
|
||||||
try {
|
try {
|
||||||
coll = obj.channel.toLowerCase();
|
coll = obj.channel.toLowerCase().replace(/ /g,'');
|
||||||
if(coll.length == 0) return;
|
if(coll.length == 0) return;
|
||||||
coll = emojiStrip(coll).toLowerCase();
|
coll = emojiStrip(coll).toLowerCase();
|
||||||
coll = coll.replace("_", "");
|
coll = coll.replace("_", "");
|
||||||
@@ -393,7 +394,7 @@ module.exports = function() {
|
|||||||
|
|
||||||
socket.on("left_channel", function(msg) {
|
socket.on("left_channel", function(msg) {
|
||||||
if(msg.hasOwnProperty("channel") && msg.channel != "" && typeof(msg.channel) == "string") {
|
if(msg.hasOwnProperty("channel") && msg.channel != "" && typeof(msg.channel) == "string") {
|
||||||
coll = msg.channel;
|
coll = msg.channel.replace(/ /g,'');
|
||||||
List.left_channel(coll, guid, short_id, in_list, socket, false);
|
List.left_channel(coll, guid, short_id, in_list, socket, false);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -418,7 +419,7 @@ module.exports = function() {
|
|||||||
if(!obj.hasOwnProperty("channel") || typeof(obj.channel) != "string")
|
if(!obj.hasOwnProperty("channel") || typeof(obj.channel) != "string")
|
||||||
if(coll !== undefined) {
|
if(coll !== undefined) {
|
||||||
try {
|
try {
|
||||||
coll = obj.channel.toLowerCase();
|
coll = obj.channel.toLowerCase().replace(/ /g,'');
|
||||||
if(coll.length == 0) return;
|
if(coll.length == 0) return;
|
||||||
coll = emojiStrip(coll).toLowerCase();
|
coll = emojiStrip(coll).toLowerCase();
|
||||||
coll = coll.replace("_", "");
|
coll = coll.replace("_", "");
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ function list(msg, guid, coll, offline, socket) {
|
|||||||
socket.emit('update_required', result);
|
socket.emit('update_required', result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
coll = msg.channel.toLowerCase();
|
coll = msg.channel.toLowerCase().replace(/ /g,'');
|
||||||
var pass = crypto.createHash('sha256').update(Functions.decrypt_string(socketid, msg.pass)).digest("base64");
|
var pass = crypto.createHash('sha256').update(Functions.decrypt_string(socketid, msg.pass)).digest("base64");
|
||||||
db.collection('frontpage_lists').find({"_id": coll}, function(err, frontpage_lists){
|
db.collection('frontpage_lists').find({"_id": coll}, function(err, frontpage_lists){
|
||||||
if(frontpage_lists.length == 1)
|
if(frontpage_lists.length == 1)
|
||||||
@@ -108,7 +108,7 @@ function skip(list, guid, coll, offline, socket) {
|
|||||||
if(coll == undefined && list.hasOwnProperty('channel')) coll = list.channel.toLowerCase();
|
if(coll == undefined && list.hasOwnProperty('channel')) coll = list.channel.toLowerCase();
|
||||||
if(coll !== undefined) {
|
if(coll !== undefined) {
|
||||||
try {
|
try {
|
||||||
coll = list.channel.toLowerCase();
|
coll = list.channel.toLowerCase().replace(/ /g,'');
|
||||||
if(coll.length == 0) return;
|
if(coll.length == 0) return;
|
||||||
coll = emojiStrip(coll).toLowerCase();
|
coll = emojiStrip(coll).toLowerCase();
|
||||||
coll = coll.replace("_", "");
|
coll = coll.replace("_", "");
|
||||||
@@ -225,6 +225,7 @@ function skip(list, guid, coll, offline, socket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function change_song(coll, error, id, callback, socket) {
|
function change_song(coll, error, id, callback, socket) {
|
||||||
|
coll = coll.replace(/ /g,'');
|
||||||
db.collection(coll + "_settings").find(function(err, docs){
|
db.collection(coll + "_settings").find(function(err, docs){
|
||||||
var startTime = docs[0].startTime;
|
var startTime = docs[0].startTime;
|
||||||
if(docs !== null && docs.length !== 0)
|
if(docs !== null && docs.length !== 0)
|
||||||
@@ -321,8 +322,8 @@ function change_song(coll, error, id, callback, socket) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function change_song_post(coll, next_song, callback, socket)
|
function change_song_post(coll, next_song, callback, socket) {
|
||||||
{
|
coll = coll.replace(/ /g,'');
|
||||||
db.collection(coll).aggregate([{
|
db.collection(coll).aggregate([{
|
||||||
$match:{
|
$match:{
|
||||||
now_playing:false,
|
now_playing:false,
|
||||||
@@ -381,6 +382,7 @@ function change_song_post(coll, next_song, callback, socket)
|
|||||||
|
|
||||||
function send_list(coll, socket, send, list_send, configs, shuffled)
|
function send_list(coll, socket, send, list_send, configs, shuffled)
|
||||||
{
|
{
|
||||||
|
coll = coll.replace(/ /g,'');
|
||||||
db.collection(coll + "_settings").find({id: "config"}, function(err, _conf){
|
db.collection(coll + "_settings").find({id: "config"}, function(err, _conf){
|
||||||
var conf = _conf;
|
var conf = _conf;
|
||||||
if(conf.length == 0) {
|
if(conf.length == 0) {
|
||||||
@@ -535,6 +537,7 @@ function end(obj, coll, guid, offline, socket) {
|
|||||||
socket.emit("update_required", result);
|
socket.emit("update_required", result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
coll = coll.replace(/ /g,'');
|
||||||
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass) {
|
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass) {
|
||||||
obj.pass = userpass;
|
obj.pass = userpass;
|
||||||
|
|
||||||
@@ -578,8 +581,8 @@ function end(obj, coll, guid, offline, socket) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function send_play(coll, socket, broadcast)
|
function send_play(coll, socket, broadcast) {
|
||||||
{
|
coll = coll.replace(/ /g,'');
|
||||||
db.collection(coll).find({now_playing:true}, function(err, np){
|
db.collection(coll).find({now_playing:true}, function(err, np){
|
||||||
db.collection(coll + "_settings").find(function(err, conf){
|
db.collection(coll + "_settings").find(function(err, conf){
|
||||||
if(err !== null) console.log(err);
|
if(err !== null) console.log(err);
|
||||||
@@ -624,6 +627,7 @@ function send_play(coll, socket, broadcast)
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sendColor(coll, socket, id) {
|
function sendColor(coll, socket, id) {
|
||||||
|
coll = coll.replace(/ /g,'');
|
||||||
var url = 'https://img.youtube.com/vi/'+id+'/mqdefault.jpg';
|
var url = 'https://img.youtube.com/vi/'+id+'/mqdefault.jpg';
|
||||||
Jimp.read(url).then(function (image) {
|
Jimp.read(url).then(function (image) {
|
||||||
|
|
||||||
@@ -637,6 +641,7 @@ function sendColor(coll, socket, id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getNextSong(coll, callback) {
|
function getNextSong(coll, callback) {
|
||||||
|
coll = coll.replace(/ /g,'');
|
||||||
db.collection(coll).aggregate([{
|
db.collection(coll).aggregate([{
|
||||||
$match:{
|
$match:{
|
||||||
views:{
|
views:{
|
||||||
@@ -663,9 +668,9 @@ function getNextSong(coll, callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function left_channel(coll, guid, short_id, in_list, socket, change)
|
function left_channel(coll, guid, short_id, in_list, socket, change) {
|
||||||
{
|
|
||||||
if(!coll) return;
|
if(!coll) return;
|
||||||
|
coll = coll.replace(/ /g,'');
|
||||||
db.collection("connected_users").update({"_id": coll}, {$pull: {users: guid}}, function(err, updated) {
|
db.collection("connected_users").update({"_id": coll}, {$pull: {users: guid}}, function(err, updated) {
|
||||||
if(updated.nModified > 0) {
|
if(updated.nModified > 0) {
|
||||||
db.collection("connected_users").find({"_id": coll}, function(err, new_doc){
|
db.collection("connected_users").find({"_id": coll}, function(err, new_doc){
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ function add_function(arr, coll, guid, offline, socket) {
|
|||||||
socket.emit('update_required', result);
|
socket.emit('update_required', result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
coll = coll.replace(/ /g,'');
|
||||||
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass) {
|
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass) {
|
||||||
arr.adminpass = adminpass;
|
arr.adminpass = adminpass;
|
||||||
arr.userpass = userpass;
|
arr.userpass = userpass;
|
||||||
@@ -277,7 +278,7 @@ function voteUndecided(msg, coll, guid, offline, socket) {
|
|||||||
socket.emit('update_required', result);
|
socket.emit('update_required', result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
coll = msg.channel.toLowerCase();;
|
coll = msg.channel.toLowerCase().replace(/ /g,'');
|
||||||
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass) {
|
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass) {
|
||||||
msg.adminpass = adminpass;
|
msg.adminpass = adminpass;
|
||||||
msg.pass = userpass;
|
msg.pass = userpass;
|
||||||
@@ -337,7 +338,7 @@ function shuffle(msg, coll, guid, offline, socket) {
|
|||||||
socket.emit('update_required', result);
|
socket.emit('update_required', result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
coll = msg.channel.toLowerCase();
|
coll = msg.channel.toLowerCase().replace(/ /g,'');
|
||||||
|
|
||||||
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass) {
|
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass) {
|
||||||
msg.adminpass = adminpass;
|
msg.adminpass = adminpass;
|
||||||
@@ -405,7 +406,7 @@ function shuffle(msg, coll, guid, offline, socket) {
|
|||||||
function del(params, socket, socketid) {
|
function del(params, socket, socketid) {
|
||||||
if(params.id){
|
if(params.id){
|
||||||
var coll = emojiStrip(params.channel).toLowerCase();
|
var coll = emojiStrip(params.channel).toLowerCase();
|
||||||
coll = coll.replace("_", "");
|
coll = coll.replace("_", "").replace(/ /g,'');
|
||||||
coll = encodeURIComponent(coll).replace(/\W/g, '');
|
coll = encodeURIComponent(coll).replace(/\W/g, '');
|
||||||
coll = filter.clean(coll);
|
coll = filter.clean(coll);
|
||||||
db.collection(coll + "_settings").find(function(err, docs){
|
db.collection(coll + "_settings").find(function(err, docs){
|
||||||
@@ -451,6 +452,7 @@ function delete_all(msg, coll, guid, offline, socket) {
|
|||||||
socket.emit('update_required', result);
|
socket.emit('update_required', result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
coll = coll.replace(/ /g,'');
|
||||||
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass, gotten) {
|
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass, gotten) {
|
||||||
msg.adminpass = adminpass;
|
msg.adminpass = adminpass;
|
||||||
msg.pass = userpass;
|
msg.pass = userpass;
|
||||||
@@ -484,6 +486,7 @@ function delete_all(msg, coll, guid, offline, socket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function vote(coll, id, guid, socket, full_list, last) {
|
function vote(coll, id, guid, socket, full_list, last) {
|
||||||
|
coll = coll.replace(/ /g,'');
|
||||||
db.collection(coll).find({id:id, now_playing: false, type:"video"}, function(err, docs){
|
db.collection(coll).find({id:id, now_playing: false, type:"video"}, function(err, docs){
|
||||||
if(docs !== null && docs.length > 0 && !Functions.contains(docs[0].guids, guid))
|
if(docs !== null && docs.length > 0 && !Functions.contains(docs[0].guids, guid))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ function password(inp, coll, guid, offline, socket) {
|
|||||||
} catch(e) {
|
} catch(e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
coll = coll.replace(/ /g,'');
|
||||||
uncrypted = pw;
|
uncrypted = pw;
|
||||||
pw = Functions.hash_pass(Functions.decrypt_string(socket.zoff_id, pw), true);
|
pw = Functions.hash_pass(Functions.decrypt_string(socket.zoff_id, pw), true);
|
||||||
Functions.check_inlist(coll, guid, socket, offline);
|
Functions.check_inlist(coll, guid, socket, offline);
|
||||||
@@ -84,7 +84,7 @@ function conf_function(params, coll, guid, offline, socket) {
|
|||||||
{
|
{
|
||||||
if(coll !== undefined) {
|
if(coll !== undefined) {
|
||||||
try {
|
try {
|
||||||
coll = params.channel;
|
coll = params.channel.replace(/ /g,'');
|
||||||
if(coll.length == 0) return;
|
if(coll.length == 0) return;
|
||||||
coll = emojiStrip(coll).toLowerCase();
|
coll = emojiStrip(coll).toLowerCase();
|
||||||
coll = coll.replace("_", "");
|
coll = coll.replace("_", "");
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ var path = require('path');
|
|||||||
|
|
||||||
function requested_change(type, string, channel) {
|
function requested_change(type, string, channel) {
|
||||||
try {
|
try {
|
||||||
|
channel = channel.replace(/ /g,'');
|
||||||
var nodemailer = require('nodemailer');
|
var nodemailer = require('nodemailer');
|
||||||
var mailconfig = require(path.join(__dirname, '../config/mailconfig.js'));
|
var mailconfig = require(path.join(__dirname, '../config/mailconfig.js'));
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function get_correct_info(song_generated, channel, broadcast, callback) {
|
function get_correct_info(song_generated, channel, broadcast, callback) {
|
||||||
|
channel = channel.replace(/ /g,'');
|
||||||
request({
|
request({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: "https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+key+"&id=" + song_generated.id,
|
url: "https://www.googleapis.com/youtube/v3/videos?part=contentDetails,snippet,id&key="+key+"&id=" + song_generated.id,
|
||||||
@@ -84,7 +85,7 @@ function check_error_video(msg, channel) {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
channel = channel.replace(/ /g,'');
|
||||||
request({
|
request({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: "https://www.googleapis.com/youtube/v3/videos?part=id&key="+key+"&id=" + msg.id,
|
url: "https://www.googleapis.com/youtube/v3/videos?part=id&key="+key+"&id=" + msg.id,
|
||||||
@@ -102,6 +103,7 @@ function check_error_video(msg, channel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function findSimilar(msg, channel, broadcast, callback) {
|
function findSimilar(msg, channel, broadcast, callback) {
|
||||||
|
channel = channel.replace(/ /g,'');
|
||||||
var yt_url = "https://www.googleapis.com/youtube/v3/search?key="+key+"&videoEmbeddable=true&part=id&type=video&order=viewCount&safeSearch=none&maxResults=5&q=" + encodeURIComponent(msg.title);
|
var yt_url = "https://www.googleapis.com/youtube/v3/search?key="+key+"&videoEmbeddable=true&part=id&type=video&order=viewCount&safeSearch=none&maxResults=5&q=" + encodeURIComponent(msg.title);
|
||||||
request({
|
request({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ function thumbnail(msg, coll, guid, offline, socket) {
|
|||||||
socket.emit("update_required", result);
|
socket.emit("update_required", result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
coll = coll.replace(/ /g,'');
|
||||||
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass) {
|
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass) {
|
||||||
msg.userpass = userpass;
|
msg.userpass = userpass;
|
||||||
msg.adminpass = adminpass;
|
msg.adminpass = adminpass;
|
||||||
@@ -73,7 +74,7 @@ function description(msg, coll, guid, offline, socket) {
|
|||||||
socket.emit("update_required", result);
|
socket.emit("update_required", result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
coll = coll.replace(/ /g,'');
|
||||||
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass, gotten) {
|
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass, gotten) {
|
||||||
msg.userpass = userpass;
|
msg.userpass = userpass;
|
||||||
msg.adminpass = adminpass;
|
msg.adminpass = adminpass;
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
<meta property="og:description" content="Zoff admin panel">
|
<meta property="og:description" content="Zoff admin panel">
|
||||||
<meta property="og:type" content="website">
|
<meta property="og:type" content="website">
|
||||||
<link rel="icon" id="favicon" type="image/png" href="https://zoff.me/assets/images/favicon.png">
|
<link rel="icon" id="favicon" type="image/png" href="https://zoff.me/assets/images/favicon.png">
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
|
||||||
<script
|
<script
|
||||||
src="https://code.jquery.com/jquery-2.2.4.min.js"
|
src="https://code.jquery.com/jquery-2.2.4.min.js"
|
||||||
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
|
integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
|
||||||
@@ -26,6 +25,7 @@
|
|||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" type="text/css" href="https://zoff.me/assets/css/style.css" title="Default" />
|
<link rel="stylesheet" type="text/css" href="https://zoff.me/assets/css/style.css" title="Default" />
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.4/socket.io.slim.js"></script>
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.4/socket.io.slim.js"></script>
|
||||||
<script type="text/javascript" src="/assets/admin/{{{where_get}}}/js/main.js"></script>
|
<script type="text/javascript" src="/assets/admin/{{{where_get}}}/js/main.js"></script>
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
Reference in New Issue
Block a user