Add even more cleanup

This commit is contained in:
Alf Hammerseth
2019-11-16 17:19:14 +01:00
parent 120553eac4
commit 54b745ec68
11 changed files with 129 additions and 287 deletions

View File

@@ -1,10 +1,9 @@
var gulp = require("gulp"),
uglify = require("gulp-uglify"),
//sourcemaps = require('gulp-sourcemaps'),
concat = require("gulp-concat"),
cleanCSS = require("gulp-clean-css");
gulp.task("css", function() {
gulp.task("css", function () {
return gulp
.src([
"server/public/assets/css/style.css",
@@ -13,18 +12,22 @@ gulp.task("css", function() {
"server/public/assets/css/mobile.css"
])
.pipe(concat("style.css"))
.pipe(cleanCSS({ compatibility: "ie8" }))
.pipe(cleanCSS({
compatibility: "ie8"
}))
.pipe(gulp.dest("server/public/assets/dist"));
});
gulp.task("css-embed", function() {
gulp.task("css-embed", function () {
return gulp
.src("server/public/assets/css/embed.css")
.pipe(cleanCSS({ compatibility: "ie8" }))
.pipe(cleanCSS({
compatibility: "ie8"
}))
.pipe(gulp.dest("server/public/assets/dist"));
});
gulp.task("js", function() {
gulp.task("js", function () {
return (
gulp
.src([
@@ -36,7 +39,6 @@ gulp.task("js", function() {
"!server/public/assets/js/remotecontroller.js",
"!server/public/assets/js/callback.js"
])
//.pipe(sourcemaps.init())
.pipe(concat("main.min.js"))
.pipe(
uglify({
@@ -45,12 +47,11 @@ gulp.task("js", function() {
enclose: true
})
)
//.pipe(sourcemaps.write('maps'))
.pipe(gulp.dest("server/public/assets/dist"))
);
});
gulp.task("embed", function() {
gulp.task("embed", function () {
return (
gulp
.src([
@@ -66,7 +67,6 @@ gulp.task("embed", function() {
"!server/public/assets/js/remotecontroller.js",
"server/public/assets/js/hostcontroller.js"
])
//.pipe(sourcemaps.init())
.pipe(concat("embed.min.js"))
.pipe(
uglify({
@@ -75,19 +75,17 @@ gulp.task("embed", function() {
enclose: true
})
)
//.pipe(sourcemaps.write('maps'))
.pipe(gulp.dest("server/public/assets/dist"))
);
});
gulp.task("token", function() {
gulp.task("token", function () {
return (
gulp
.src([
"server/public/assets/js/token*",
"server/public/assets/js/helpers.js"
])
//.pipe(sourcemaps.init())
.pipe(concat("token.min.js"))
.pipe(
uglify({
@@ -96,12 +94,11 @@ gulp.task("token", function() {
enclose: true
})
)
//.pipe(sourcemaps.write('maps'))
.pipe(gulp.dest("server/public/assets/dist"))
);
});
gulp.task("callback", function() {
gulp.task("callback", function () {
return (
gulp
.src([
@@ -109,7 +106,6 @@ gulp.task("callback", function() {
"server/config/api_key.js",
"server/public/assets/js/callback.js"
])
//.pipe(sourcemaps.init())
.pipe(concat("callback.min.js"))
.pipe(
uglify({
@@ -118,7 +114,6 @@ gulp.task("callback", function() {
enclose: true
})
)
//.pipe(sourcemaps.write('maps'))
.pipe(gulp.dest("server/public/assets/dist"))
);
});
@@ -136,7 +131,7 @@ gulp.task("build", done => {
done();
});
gulp.task("remotecontroller", function() {
gulp.task("remotecontroller", function () {
return (
gulp
.src([
@@ -145,7 +140,6 @@ gulp.task("remotecontroller", function() {
"server/public/assets/js/remotecontroller.js",
"server/public/assets/js/helpers.js"
])
////.pipe(sourcemaps.init())
.pipe(concat("remote.min.js"))
.pipe(
uglify({
@@ -154,12 +148,11 @@ gulp.task("remotecontroller", function() {
enclose: true
})
)
//.pipe(sourcemaps.write('maps'))
.pipe(gulp.dest("server/public/assets/dist"))
);
});
gulp.task("default", function() {
gulp.task("default", function () {
gulp.watch(["server/VERSION.js", "server/public/assets/js/*.js"], ["js"]);
gulp.watch(["server/public/assets/css/*.css"], ["css"]);
gulp.watch(["server/public/assets/css/*.css"], ["css-embed"]);
@@ -176,7 +169,6 @@ gulp.task("default", function() {
],
["callback"]
);
//gulp.watch('server/public/assets/js/*.js', ['nochan']);
gulp.watch(
["server/VERSION.js", "server/public/assets/js/remotecontroller.js"],
["remotecontroller"]

View File

@@ -14,7 +14,6 @@ function get_history(channel, all, socket) {
channel: channel
};
}
//channel = channel.replace(/ /g,'');
var pass = "";
if (!query.all) {
Functions.getSessionAdminUser(
@@ -49,7 +48,6 @@ function get_history(channel, all, socket) {
}
function getAndSendLogs(channel, all, socket, pass, query) {
//channel = channel.replace(/ /g,'');
db.collection("chat_logs")
.find(query, {
from: 1,
@@ -108,9 +106,8 @@ function chat(msg, guid, offline, socket) {
socket.emit("update_required", result);
return;
}
var coll = msg.channel.toLowerCase(); //.replace(/ /g,'');
var coll = msg.channel.toLowerCase();
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = filter.clean(coll);
checkIfUserIsBanned(coll, socket, guid, function () {
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function (
@@ -379,10 +376,9 @@ function all_chat(msg, guid, offline, socket) {
socket.emit("update_required", result);
return;
}
var coll = msg.channel.toLowerCase(); //.replace(/ /g,'');
var coll = msg.channel.toLowerCase();
var data = msg.data;
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = filter.clean(coll);
Functions.check_inlist(
coll,
guid,
@@ -481,8 +477,7 @@ function checkIfUserIsBanned(channel, socket, guid, callback, callback_error) {
else {
db.collection("user_names").findAndModify({
query: {
guid,
guid
guid: guid
},
update: {
$addToSet: {
@@ -685,7 +680,6 @@ function namechange(data, guid, socket, tried, callback) {
}
},
function (err, docs) {
//socket.emit('name', {type: "name", accepted: true});
if (old_name != name && !first && !no_name) {
if (
data.hasOwnProperty("channel") &&
@@ -741,7 +735,6 @@ function namechange(data, guid, socket, tried, callback) {
}
function removename(guid, coll, socket) {
//coll = coll.replace(/ /g,'');
checkIfChatEnabled(coll, socket, function (enabled) {
if (!enabled) return;
db.collection("user_names").find({

View File

@@ -12,10 +12,6 @@ try {
}
var mongojs = require("mongojs");
var db = mongojs("mongodb://" + mongo_config.host + "/" + mongo_config.config);
var connected_db = mongojs(
"mongodb://" + mongo_config.host + "/user_credentials"
);
var ObjectId = mongojs.ObjectId;
db.collection("chat_logs").createIndex({
createdAt: 1

View File

@@ -128,7 +128,6 @@ function get_frontpage_lists(callback) {
}
function update_frontpage(coll, id, title, thumbnail, source, callback) {
//coll = coll.replace(/ /g,'');
db.collection("frontpage_lists").find({
_id: coll
}, function (e, doc) {

View File

@@ -100,9 +100,7 @@ function remove_name_from_db(guid, channel) {
channels: channel
}
},
function (err, docs) {
//console.log("Pulled user from current channel");
}
function (err, docs) {}
);
}
});
@@ -130,10 +128,6 @@ function isUrl(str) {
function getSession(socket) {
try {
/*var cookieParser = require("cookie-parser");
var cookie = require("cookie");
var parsedCookies = cookie.parse(socket.handshake.headers.cookie);
return parsedCookies["_uI"];*/
if (socket.cookie_id == undefined) throw "Undefined error";
return socket.cookie_id;
} catch (e) {
@@ -143,7 +137,6 @@ function getSession(socket) {
socket.handshake.address +
socket.handshake.headers["accept-language"]
);
//return "empty";
}
}
@@ -186,7 +179,6 @@ function check_inlist(coll, guid, socket, offline, callback, double_check) {
if (typeof callback == "function") callback();
return;
}
//coll = coll.replace(/ /g,'');
if (!offline && coll != undefined) {
db.collection("connected_users").update({
_id: coll
@@ -256,10 +248,6 @@ function check_inlist(coll, guid, socket, offline, callback, double_check) {
});
}
} else if (docs.length == 0) {
//console.log("User doesn't have a name for some reason.");
//console.log("guid", guid);
//console.log("channel", coll);
//console.log("Trying to get a chat-name");
Chat.get_name(guid, {
announce: false,
socket: socket,
@@ -323,7 +311,6 @@ function check_inlist(coll, guid, socket, offline, callback, double_check) {
function (err, docs) {}
);
}
//
if (coll != undefined && coll != "") {
db.collection("connected_users").update({
_id: "total_users"
@@ -649,7 +636,6 @@ function left_channel(coll, guid, short_id, in_list, socket, change, caller) {
}
return;
}
//coll = coll.replace(/ /g,'');
db.collection("connected_users").update({
_id: coll
}, {
@@ -720,7 +706,6 @@ function left_channel(coll, guid, short_id, in_list, socket, change, caller) {
}
},
function (err, updated) {
//if(updated.nModified > 0) {
db.collection("connected_users").update({
_id: "total_users"
}, {
@@ -735,7 +720,6 @@ function left_channel(coll, guid, short_id, in_list, socket, change, caller) {
} else {
remove_from_chat_channel(coll, guid);
}
//}
}
);
}

View File

@@ -1,4 +1,3 @@
var cookieParser = require("cookie-parser");
var cookie = require("cookie");
var Functions = require(pathThumbnails + "/handlers/functions.js");
@@ -10,15 +9,6 @@ var ListSettings = require(pathThumbnails + "/handlers/list_settings.js");
var Frontpage = require(pathThumbnails + "/handlers/frontpage.js");
var Search = require(pathThumbnails + "/handlers/search.js");
var crypto = require("crypto");
var Filter = require("bad-words");
var filter = new Filter({
placeHolder: "x"
});
/*var filter = {
clean: function(str) {
return str;
}
}*/
var db = require(pathThumbnails + "/handlers/db.js");
module.exports = function () {
@@ -26,7 +16,6 @@ module.exports = function () {
try {
var parsedCookies = cookie.parse(socket.handshake.headers.cookie);
socket.cookie_id = parsedCookies["_uI"];
//return socket.guid;
} catch (e) {
socket.cookie_id = "empty";
}
@@ -47,7 +36,6 @@ module.exports = function () {
socket.emit("ok");
});
var ping_timeout;
var socketid = socket.zoff_id;
var coll;
var in_list = false;
@@ -70,7 +58,6 @@ module.exports = function () {
if (msg.hasOwnProperty("channel")) {
msg.channel = Functions.encodeChannelName(msg.channel);
}
//channel = channel.replace(/ /g,'');
if (offline) {
db.collection("connected_users").update({
_id: "offline_users"
@@ -178,9 +165,8 @@ module.exports = function () {
connected_users_channel.length > 0 &&
connected_users_channel[0].users.indexOf(msg.guid) > -1
) {
coll = msg.channel.toLowerCase(); //.replace(/ /g,'');
coll = msg.channel.toLowerCase();
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = filter.clean(coll);
if (coll.indexOf("?") > -1) {
coll = coll.substring(0, coll.indexOf("?"));
}
@@ -190,7 +176,6 @@ module.exports = function () {
msg.channel,
function (results) {}
);
//socket.cookie_id = msg.guid;
guid = msg.guid;
socketid = msg.socket_id;
socket.zoff_id = socketid;
@@ -216,16 +201,13 @@ module.exports = function () {
socket.on("error_video", function (msg) {
try {
msg.channel = Functions.encodeChannelName(msg.channel);
var _list = msg.channel; //.replace(/ /g,'');
var _list = msg.channel;
if (_list.length == 0) return;
if (_list.indexOf("?") > -1) {
_list = _list.substring(0, _list.indexOf("?"));
msg.channel = _list;
}
coll = Functions.removeEmojis(_list).toLowerCase();
//coll = coll.replace(/_/g, "");
//coll = filter.clean(coll);
} catch (e) {
return;
}
@@ -368,14 +350,13 @@ module.exports = function () {
return;
}
var status = msg.status;
var channel = msg.channel; //.replace(/ /g,'');
var channel = msg.channel;
if (status) {
in_list = false;
offline = true;
if (channel != "") coll = channel;
if (coll !== undefined) {
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = filter.clean(coll);
db.collection("connected_users").findAndModify({
query: {
_id: coll
@@ -591,7 +572,6 @@ module.exports = function () {
msg.channel = Functions.encodeChannelName(msg.channel);
}
try {
//var _list = msg.channel.replace(/ /g,'');
var _list = msg.channel;
if (_list.length == 0) return;
if (_list.indexOf("?") > -1) {
@@ -599,9 +579,6 @@ module.exports = function () {
msg.channel = _list;
}
coll = Functions.removeEmojis(_list).toLowerCase();
//coll = coll.replace(/_/g, "");
//
//coll = filter.clean(coll);
} catch (e) {
return;
}
@@ -621,12 +598,9 @@ module.exports = function () {
if (obj.hasOwnProperty("channel")) {
obj.channel = Functions.encodeChannelName(obj.channel);
try {
coll = obj.channel.toLowerCase(); //.replace(/ /g,'');
coll = obj.channel.toLowerCase();
if (coll.length == 0) return;
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = coll.replace(/_/g, "");
//coll = filter.clean(coll);
} catch (e) {
return;
}
@@ -660,12 +634,9 @@ module.exports = function () {
!arr.hasOwnProperty("offsiteAdd"))
) {
try {
coll = arr.list; //.replace(/ /g,'');
coll = arr.list;
if (coll.length == 0) return;
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = coll.replace(/_/g, "");
//coll = filter.clean(coll);
} catch (e) {
return;
}
@@ -684,12 +655,9 @@ module.exports = function () {
if (msg.hasOwnProperty("channel")) {
msg.channel = Functions.encodeChannelName(msg.channel);
}
coll = msg.channel.toLowerCase(); //.replace(/ /g,'');
coll = msg.channel.toLowerCase();
if (coll.length == 0) return;
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = coll.replace(/_/g, "");
//coll = filter.clean(coll);
} catch (e) {
return;
}
@@ -707,12 +675,9 @@ module.exports = function () {
}
if (coll !== undefined) {
try {
coll = msg.channel.toLowerCase(); //.replace(/ /g,'');
coll = msg.channel.toLowerCase();
if (coll.length == 0) return;
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = coll.replace(/_/g, "");
//coll = filter.clean(coll);
} catch (e) {
return;
}
@@ -728,7 +693,6 @@ module.exports = function () {
if (inp.hasOwnProperty("channel")) {
inp.channel = Functions.encodeChannelName(inp.channel);
}
//if(coll != undefined) coll.replace(/ /g,'');
ListSettings.password(inp, coll, guid, offline, socket);
});
@@ -741,7 +705,6 @@ module.exports = function () {
if (list.hasOwnProperty("channel")) {
list.channel = Functions.encodeChannelName(list.channel);
}
//if(coll != undefined) coll.replace(/ /g,'');
List.skip(list, guid, coll, offline, socket);
});
@@ -755,7 +718,6 @@ module.exports = function () {
conf.channel = Functions.encodeChannelName(conf.channel);
coll = conf.channel;
}
//if(coll != undefined) coll.replace(/ /g,'');
ListSettings.conf_function(conf, coll, guid, offline, socket);
});
@@ -768,12 +730,9 @@ module.exports = function () {
msg.channel = Functions.encodeChannelName(msg.channel);
}
try {
coll = msg.channel.toLowerCase(); //.replace(/ /g,'');
coll = msg.channel.toLowerCase();
if (coll.length == 0) return;
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = coll.replace(/_/g, "");
//coll = filter.clean(coll);
} catch (e) {
return;
}
@@ -805,12 +764,9 @@ module.exports = function () {
obj.channel !== undefined
) {
try {
coll = obj.channel.toLowerCase(); //.replace(/ /g,'');
coll = obj.channel.toLowerCase();
if (coll.length == 0) return;
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = coll.replace(/_/g, "");
//coll = filter.clean(coll);
} catch (e) {
return;
}
@@ -864,9 +820,8 @@ module.exports = function () {
msg.channel != "" &&
typeof msg.channel == "string"
) {
coll = msg.channel; //.replace(/ /g,'');
coll = msg.channel;
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = filter.clean(coll);
Functions.left_channel(
coll,
guid,
@@ -932,12 +887,9 @@ module.exports = function () {
}
if (coll !== undefined) {
try {
coll = obj.channel.toLowerCase(); //.replace(/ /g,'');
coll = obj.channel.toLowerCase();
if (coll.length == 0) return;
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = coll.replace(/_/g, "");
//coll = filter.clean(coll);
} catch (e) {
return;
}
@@ -994,18 +946,4 @@ module.exports = function () {
});
});
});
//send_ping();
};
/*
function send_ping() {
db.collection("connected_users").update({users: {$exists: true}}, {$set: {users: []}}, {multi: true}, function(err, docs){
db.collection("connected_users").update({"_id": "total_users"}, {$add: {total_users: 0}}, {multi: true}, function(err, docs){
db.collection("frontpage_lists").update({viewers: {$ne: 0}}, {$set: {"viewers": 0}}, {multi: true}, function(err, docs) {
io.emit("self_ping");
setTimeout(send_ping, 25000);
});
});
});
}*/

View File

@@ -28,7 +28,6 @@ function now_playing(list, fn, socket) {
function join_silent(msg, socket) {
if (typeof msg === "object" && msg !== undefined && msg !== null) {
var channelName = msg.channel;
var tryingPassword = false;
var password = "";
if (msg.password != "") {
tryingPassword = true;
@@ -39,7 +38,7 @@ function join_silent(msg, socket) {
.digest("base64");
}
channelName = channelName.toLowerCase(); //.replace(/ /g,'');
channelName = channelName.toLowerCase();
channelName = Functions.removeEmojis(channelName).toLowerCase();
db.collection(channelName + "_settings").find(function (err, docs) {
if (docs.length == 0) {
@@ -61,7 +60,6 @@ function join_silent(msg, socket) {
}
function list(msg, guid, coll, offline, socket) {
var socketid = socket.zoff_id;
if (typeof msg === "object" && msg !== undefined && msg !== null) {
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function (
userpass,
@@ -244,19 +242,14 @@ function list(msg, guid, coll, offline, socket) {
}
function skip(list, guid, coll, offline, socket, callback) {
var socketid = socket.zoff_id;
if (list !== undefined && list !== null && list !== "") {
if (coll == undefined && list.hasOwnProperty("channel"))
coll = list.channel.toLowerCase();
if (coll !== undefined) {
try {
coll = list.channel.toLowerCase(); //.replace(/ /g,'');
coll = list.channel.toLowerCase();
if (coll.length == 0) return;
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = coll.replace(/_/g, "");
//coll = filter.clean(coll);
} catch (e) {
return;
}
@@ -356,7 +349,6 @@ function skip(list, guid, coll, offline, socket, callback) {
error = true;
}
hash = adminpass;
//db.collection(coll + "_settings").find(function(err, docs){
var strictSkip = false;
var strictSkipNumber = 10;
if (docs[0].strictSkip) strictSkip = docs[0].strictSkip;
@@ -488,7 +480,6 @@ function skip(list, guid, coll, offline, socket, callback) {
}
}
);
//});
} else {
socket.emit("auth_required");
}
@@ -506,9 +497,6 @@ function skip(list, guid, coll, offline, socket, callback) {
}
function change_song(coll, error, id, conf, callback, socket) {
//coll = coll.replace(/ /g,'');
//db.collection(coll + "_settings").find(function(err, docs){
var startTime = conf[0].startTime;
if (conf !== null && conf.length !== 0) {
db.collection(coll).aggregate(
[{
@@ -678,11 +666,9 @@ function change_song(coll, error, id, conf, callback, socket) {
}
);
}
//});
}
function change_song_post(coll, next_song, conf, callback, socket, removed) {
//coll = coll.replace(/ /g,'');
db.collection(coll).aggregate(
[{
$match: {
@@ -743,7 +729,6 @@ function change_song_post(coll, next_song, conf, callback, socket, removed) {
}
},
function (err, returnDocs) {
//db.collection(coll + "_settings").find({id: "config"}, function(err, conf){
if (!callback) {
io.to(coll).emit("channel", {
type: "song_change",
@@ -778,7 +763,6 @@ function change_song_post(coll, next_song, conf, callback, socket, removed) {
docs[0].thumbnail,
docs[0].source
);
//});
}
);
}
@@ -789,7 +773,6 @@ function change_song_post(coll, next_song, conf, callback, socket, removed) {
}
function send_list(coll, socket, send, list_send, configs, shuffled) {
//coll = coll.replace(/ /g,'');
db.collection(coll + "_settings").aggregate(
[{
$match: {
@@ -855,7 +838,7 @@ function send_list(coll, socket, send, list_send, configs, shuffled) {
],
function (
err,
docs //db.collection(coll).find({type: {$ne: "suggested"}}, function(err, docs)
docs
) {
if (docs.length > 0) {
db.collection(coll).find({
@@ -1096,7 +1079,6 @@ function send_list(coll, socket, send, list_send, configs, shuffled) {
}
function end(obj, coll, guid, offline, socket) {
var socketid = socket.zoff_id;
if (typeof obj !== "object") {
return;
}
@@ -1203,7 +1185,6 @@ function end(obj, coll, guid, offline, socket) {
}
function send_play(coll, socket, broadcast) {
//coll = coll.replace(/ /g,'');
db.collection(coll).find({
now_playing: true
}, function (err, np) {
@@ -1226,7 +1207,6 @@ function send_play(coll, socket, broadcast) {
};
if (socket === undefined) {
io.to(coll).emit("np", toSend);
//
getNextSong(coll, undefined);
var url =
"https://img.youtube.com/vi/" + np[0].id + "/mqdefault.jpg";
@@ -1260,12 +1240,8 @@ function send_play(coll, socket, broadcast) {
}
function sendColor(coll, socket, url, ajax, res) {
if (coll != undefined && typeof coll == "string") {
//coll = coll.replace(/ /g,'');
}
if (url.indexOf("://") == -1)
url = "https://img.youtube.com/vi/" + url + "/mqdefault.jpg";
//var url = 'https://img.youtube.com/vi/'+id+'/mqdefault.jpg';
Jimp.read(url)
.then(function (image) {

View File

@@ -7,7 +7,6 @@ var crypto = require("crypto");
var db = require(pathThumbnails + "/handlers/db.js");
function addFromOtherList(arr, guid, offline, socket) {
var socketid = socket.zoff_id;
if (typeof arr == "object") {
if (
!arr.hasOwnProperty("channel") ||
@@ -29,8 +28,8 @@ function addFromOtherList(arr, guid, offline, socket) {
socket.emit("update_required", result);
return;
}
var channel = arr.channel; //.replace(/ /g,'').toLowerCase();
var new_channel = Functions.encodeChannelName(arr.new_channel); //.replace(/ /g, '').toLowerCase();
var channel = arr.channel;
var new_channel = Functions.encodeChannelName(arr.new_channel);
db.collection("frontpage_lists").find({
_id: new_channel
}, function (
@@ -359,7 +358,6 @@ function addFromOtherList(arr, guid, offline, socket) {
}
function addPlaylist(arr, guid, offline, socket) {
var socketid = socket.zoff_id;
if (typeof arr == "object") {
if (
!arr.hasOwnProperty("channel") ||
@@ -380,7 +378,7 @@ function addPlaylist(arr, guid, offline, socket) {
socket.emit("update_required", result);
return;
}
var channel = arr.channel; //.replace(/ /g,'').toLowerCase();
var channel = arr.channel;
if (arr.length == 0 || arr.songs.length == 0) {
socket.emit("toast", "Empty list..");
return;
@@ -683,7 +681,6 @@ function addPlaylist(arr, guid, offline, socket) {
}
function add_function(arr, coll, guid, offline, socket) {
var socketid = socket.zoff_id;
if (
typeof arr === "object" &&
arr !== undefined &&
@@ -1085,9 +1082,8 @@ function voteUndecided(msg, coll, guid, offline, socket) {
socket.emit("update_required", result);
return;
}
coll = msg.channel.toLowerCase(); //.replace(/ /g,'');
coll = msg.channel.toLowerCase();
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = filter.clean(coll);
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function (
userpass,
adminpass
@@ -1163,7 +1159,6 @@ function voteUndecided(msg, coll, guid, offline, socket) {
}
function shuffle(msg, coll, guid, offline, socket) {
var socketid = socket.zoff_id;
if (!msg.hasOwnProperty("channel") || typeof msg.channel != "string") {
var result = {
channel: {
@@ -1182,9 +1177,8 @@ function shuffle(msg, coll, guid, offline, socket) {
socket.emit("update_required", result);
return;
}
coll = msg.channel.toLowerCase(); //.replace(/ /g,'');
coll = msg.channel.toLowerCase();
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = filter.clean(coll);
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function (
userpass,
adminpass
@@ -1263,13 +1257,6 @@ function shuffle(msg, coll, guid, offline, socket) {
socket.emit("auth_required");
}
});
var complete = function (tot, curr) {
if (tot == curr) {
List.send_list(coll, undefined, false, true, false);
List.getNextSong(coll, undefined);
}
};
}
);
});
@@ -1278,9 +1265,6 @@ function shuffle(msg, coll, guid, offline, socket) {
function del(params, socket, socketid) {
if (params.id) {
var coll = Functions.removeEmojis(params.channel).toLowerCase();
//coll = coll.replace(/_/g, "").replace(/ /g,'');
//coll = filter.clean(coll);
db.collection(coll + "_settings").find(function (err, docs) {
if (
docs !== null &&
@@ -1330,7 +1314,6 @@ function del(params, socket, socketid) {
}
function delete_all(msg, coll, guid, offline, socket) {
var socketid = socket.zoff_id;
if (typeof msg == "object") {
if (!msg.hasOwnProperty("channel") || typeof msg.channel != "string") {
var result = {
@@ -1354,9 +1337,7 @@ function delete_all(msg, coll, guid, offline, socket) {
if (coll == undefined) {
coll = msg.channel;
}
//coll = coll.replace(/ /g,'');
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = filter.clean(coll);
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function (
userpass,
adminpass,
@@ -1435,7 +1416,6 @@ function delete_all(msg, coll, guid, offline, socket) {
}
function vote(coll, id, guid, socket) {
//coll = coll.replace(/ /g,'');
db.collection(coll).find({
id: id,
now_playing: false,

View File

@@ -31,13 +31,9 @@ function password(inp, coll, guid, offline, socket) {
coll = inp.channel;
if (coll.length == 0) return;
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = coll.replace(/_/g, "");
//coll = filter.clean(coll);
} catch (e) {
return;
}
//coll = coll.replace(/ /g,'');
uncrypted = pw;
pw = Functions.hash_pass(Functions.decrypt_string(pw), true);
Functions.check_inlist(coll, guid, socket, offline, undefined, "place 8");
@@ -129,12 +125,9 @@ function conf_function(params, coll, guid, offline, socket) {
if (params !== undefined && params !== null && params !== "") {
if (coll !== undefined) {
try {
coll = params.channel; //.replace(/ /g,'');
coll = params.channel;
if (coll.length == 0) return;
coll = Functions.removeEmojis(coll).toLowerCase();
//coll = coll.replace(/_/g, "");
//coll = filter.clean(coll);
} catch (e) {
return;
}

View File

@@ -2,11 +2,9 @@ var path = require("path");
function requested_change(type, string, channel) {
try {
//channel = channel.replace(/ /g,'');
var nodemailer = require("nodemailer");
var mailconfig = require(path.join(__dirname, "../config/mailconfig.js"));
let transporter = nodemailer.createTransport(mailconfig);
var transporter = nodemailer.createTransport(mailconfig);
transporter.verify(function (error, success) {
if (error) {

View File

@@ -23,20 +23,18 @@ function thumbnail(msg, coll, guid, offline, socket) {
thumbnail: {
expected: "string",
got: msg.hasOwnProperty("thumbnail") ?
typeof msg.thumbnail :
undefined
typeof msg.thumbnail : undefined
},
adminpass: {
expected: "string",
got: msg.hasOwnProperty("adminpass") ?
typeof msg.adminpass :
undefined
typeof msg.adminpass : undefined
}
};
socket.emit("update_required", result);
return;
}
//coll = coll.replace(/ /g,'');
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function (
userpass,
adminpass
@@ -125,20 +123,17 @@ function description(msg, coll, guid, offline, socket) {
description: {
expected: "string",
got: msg.hasOwnProperty("description") ?
typeof msg.description :
undefined
typeof msg.description : undefined
},
adminpass: {
expected: "string",
got: msg.hasOwnProperty("adminpass") ?
typeof msg.adminpass :
undefined
typeof msg.adminpass : undefined
}
};
socket.emit("update_required", result);
return;
}
//coll = coll.replace(/ /g,'');
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function (
userpass,
adminpass,
@@ -227,14 +222,12 @@ function rules(msg, coll, guid, offline, socket) {
adminpass: {
expected: "string",
got: msg.hasOwnProperty("adminpass") ?
typeof msg.adminpass :
undefined
typeof msg.adminpass : undefined
}
};
socket.emit("update_required", result);
return;
}
//coll = coll.replace(/ /g,'');
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function (
userpass,
adminpass,