mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-12-08 20:48:48 +00:00
Added functionality to add songs from another channel
This commit is contained in:
@@ -35,6 +35,14 @@
|
|||||||
pass: Base64(channel_pass)
|
pass: Base64(channel_pass)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Imports songs from another zoff-channel
|
||||||
|
'import_zoff', {
|
||||||
|
channel: CHANNELNAME,
|
||||||
|
new_channel: CHANNELNAME-TO-IMPORT-FROM,
|
||||||
|
adminpass: Base64(PASSWORD),
|
||||||
|
userpass: Bse64(CHANNEL_PASSWORD)
|
||||||
|
}
|
||||||
|
|
||||||
// Tells the server to disconnect the user from the current channel, is used for remote controlling on the host side
|
// Tells the server to disconnect the user from the current channel, is used for remote controlling on the host side
|
||||||
'change_channel', {
|
'change_channel', {
|
||||||
channel: channel_name
|
channel: channel_name
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ var settings = [];
|
|||||||
|
|
||||||
db.getCollectionNames(function(err, docs) {
|
db.getCollectionNames(function(err, docs) {
|
||||||
for(var i = 0; i < docs.length; i++) {
|
for(var i = 0; i < docs.length; i++) {
|
||||||
if(docs[i].indexOf("_settings")) {
|
if(docs[i].indexOf("_settings") == -1) {
|
||||||
t(docs[i]);
|
t(docs[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,10 +26,12 @@ db.getCollectionNames(function(err, docs) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function t(docs) {
|
function t(docs) {
|
||||||
db.collection(docs).find({id: "config"}, function(e, _docs) {
|
db.collection(docs).find({id: {$exists: true}}, function(e, _docs) {
|
||||||
if(_docs.length > 0 && _docs[0].userpass == undefined) {
|
if(_docs.length > 0) {
|
||||||
console.log(docs);
|
db.collection(docs).createIndex({id: 1}, {unique: true}, function(e,d){
|
||||||
})
|
console.log(docs);
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,14 +95,12 @@ app.use(function (req, res, next) {
|
|||||||
maxAge: 365 * 10000 * 3600000,
|
maxAge: 365 * 10000 * 3600000,
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
secure: secure,
|
secure: secure,
|
||||||
domain: "zoff.me"
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
res.cookie('_uI', cookie, {
|
res.cookie('_uI', cookie, {
|
||||||
maxAge: 365 * 10000 * 3600000,
|
maxAge: 365 * 10000 * 3600000,
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
secure: secure,
|
secure: secure,
|
||||||
domain: "zoff.me"
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
res.header("Access-Control-Allow-Origin", "*");
|
res.header("Access-Control-Allow-Origin", "*");
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ function get_history(channel, all, socket) {
|
|||||||
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) {
|
||||||
pass = userpass;
|
if(userpass != "" || pass == undefined) {
|
||||||
|
pass = userpass;
|
||||||
|
}
|
||||||
db.collection(channel + "_settings").find({id: "config"}, function(err, conf) {
|
db.collection(channel + "_settings").find({id: "config"}, function(err, conf) {
|
||||||
if(conf.length > 0) {
|
if(conf.length > 0) {
|
||||||
if(conf[0].userpass == "" || conf[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socket.zoff_id, pass)).digest('base64')) {
|
if(conf[0].userpass == "" || conf[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socket.zoff_id, pass)).digest('base64')) {
|
||||||
@@ -66,7 +68,9 @@ function chat(msg, guid, offline, socket) {
|
|||||||
}
|
}
|
||||||
var coll = msg.channel.toLowerCase().replace(/ /g,'');
|
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;
|
if(userpass != "" || msg.pass == undefined) {
|
||||||
|
msg.pass = userpass;
|
||||||
|
}
|
||||||
db.collection(coll + "_settings").find(function(err, docs){
|
db.collection(coll + "_settings").find(function(err, docs){
|
||||||
if(docs.length > 0 && (docs[0].userpass == undefined || docs[0].userpass == "" || (msg.hasOwnProperty('pass') && docs[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socket.zoff_id, msg.pass)).digest("base64")))) {
|
if(docs.length > 0 && (docs[0].userpass == undefined || docs[0].userpass == "" || (msg.hasOwnProperty('pass') && docs[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socket.zoff_id, msg.pass)).digest("base64")))) {
|
||||||
var data = msg.data;
|
var data = msg.data;
|
||||||
|
|||||||
@@ -227,7 +227,6 @@ function setSessionUserPass(id, userpass, list, callback) {
|
|||||||
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;
|
||||||
|
|||||||
@@ -233,6 +233,10 @@ module.exports = function() {
|
|||||||
Frontpage.frontpage_lists(msg, socket);
|
Frontpage.frontpage_lists(msg, socket);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket.on('import_zoff', function(msg) {
|
||||||
|
ListChange.addFromOtherList(msg, guid, socket);
|
||||||
|
})
|
||||||
|
|
||||||
socket.on('now_playing', function(list, fn)
|
socket.on('now_playing', function(list, fn)
|
||||||
{
|
{
|
||||||
List.now_playing(list, fn, socket);
|
List.now_playing(list, fn, socket);
|
||||||
@@ -448,7 +452,9 @@ module.exports = function() {
|
|||||||
|
|
||||||
db.collection(coll + "_settings").find(function(err, docs) {
|
db.collection(coll + "_settings").find(function(err, docs) {
|
||||||
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass) {
|
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass) {
|
||||||
obj.pass = userpass;
|
if(userpass != "" || obj.pass == undefined) {
|
||||||
|
obj.pass = userpass;
|
||||||
|
}
|
||||||
if(docs.length > 0 && (docs[0].userpass == undefined || docs[0].userpass == "" || (obj.hasOwnProperty('pass') && docs[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socketid, obj.pass)).digest("base64")))) {
|
if(docs.length > 0 && (docs[0].userpass == undefined || docs[0].userpass == "" || (obj.hasOwnProperty('pass') && docs[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socketid, obj.pass)).digest("base64")))) {
|
||||||
Functions.check_inlist(coll, guid, socket, offline);
|
Functions.check_inlist(coll, guid, socket, offline);
|
||||||
List.send_play(coll, socket);
|
List.send_play(coll, socket);
|
||||||
|
|||||||
@@ -78,12 +78,14 @@ function list(msg, guid, coll, offline, socket) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
db.createCollection(coll, function(err, docs){
|
db.createCollection(coll, function(err, docs){
|
||||||
var configs = {"addsongs":false, "adminpass":"", "allvideos":true, "frontpage":true, "longsongs":false, "removeplay": false, "shuffle": true, "skip": false, "skips": [], "startTime":Functions.get_time(), "views": [], "vote": false, "desc": "", userpass: "", id: "config"};
|
db.collection(coll).createIndex({ id: 1}, {unique: true}, function(e, d) {
|
||||||
db.collection(coll + "_settings").insert(configs, function(err, docs){
|
var configs = {"addsongs":false, "adminpass":"", "allvideos":true, "frontpage":true, "longsongs":false, "removeplay": false, "shuffle": true, "skip": false, "skips": [], "startTime":Functions.get_time(), "views": [], "vote": false, "desc": "", userpass: "", id: "config"};
|
||||||
socket.join(coll);
|
db.collection(coll + "_settings").insert(configs, function(err, docs){
|
||||||
List.send_list(coll, socket, true, false, true);
|
socket.join(coll);
|
||||||
db.collection("frontpage_lists").insert({"_id": coll, "count" : 0, "frontpage": true, "accessed": Functions.get_time(), "viewers": 1});
|
List.send_list(coll, socket, true, false, true);
|
||||||
Functions.check_inlist(coll, guid, socket, offline);
|
db.collection("frontpage_lists").insert({"_id": coll, "count" : 0, "frontpage": true, "accessed": Functions.get_time(), "viewers": 1});
|
||||||
|
Functions.check_inlist(coll, guid, socket, offline);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -142,8 +144,12 @@ function skip(list, guid, coll, offline, socket) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass) {
|
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass) {
|
||||||
list.pass = adminpass;
|
if(adminpass != "" || list.pass == undefined) {
|
||||||
list.userpass = userpass;
|
list.pass = adminpass;
|
||||||
|
}
|
||||||
|
if(userpass != "" || list.userpass == undefined) {
|
||||||
|
list.userpass = userpass;
|
||||||
|
}
|
||||||
|
|
||||||
db.collection(coll + "_settings").find(function(err, docs){
|
db.collection(coll + "_settings").find(function(err, docs){
|
||||||
if(docs.length > 0 && (docs[0].userpass == undefined || docs[0].userpass == "" || (list.hasOwnProperty('userpass') && docs[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socketid, list.userpass)).digest("base64")))) {
|
if(docs.length > 0 && (docs[0].userpass == undefined || docs[0].userpass == "" || (list.hasOwnProperty('userpass') && docs[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socketid, list.userpass)).digest("base64")))) {
|
||||||
@@ -539,7 +545,9 @@ function end(obj, coll, guid, offline, socket) {
|
|||||||
}
|
}
|
||||||
coll = coll.replace(/ /g,'');
|
coll = coll.replace(/ /g,'');
|
||||||
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass) {
|
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass) {
|
||||||
obj.pass = userpass;
|
if(userpass != "" || obj.pass == undefined) {
|
||||||
|
obj.pass = userpass;
|
||||||
|
}
|
||||||
|
|
||||||
db.collection(coll + "_settings").find(function(err, docs){
|
db.collection(coll + "_settings").find(function(err, docs){
|
||||||
if(docs.length > 0 && (docs[0].userpass == undefined || docs[0].userpass == "" || (obj.hasOwnProperty('pass') && docs[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socketid, obj.pass)).digest("base64")))) {
|
if(docs.length > 0 && (docs[0].userpass == undefined || docs[0].userpass == "" || (obj.hasOwnProperty('pass') && docs[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socketid, obj.pass)).digest("base64")))) {
|
||||||
|
|||||||
@@ -1,3 +1,97 @@
|
|||||||
|
function addFromOtherList(arr, guid, socket) {
|
||||||
|
var MongoClient = require('mongodb').MongoClient;
|
||||||
|
var socketid = socket.zoff_id;
|
||||||
|
if(typeof(arr) == "object") {
|
||||||
|
if(!arr.hasOwnProperty("channel") || !arr.hasOwnProperty("new_channel")
|
||||||
|
|| typeof(arr.channel) != "string" || typeof(arr.new_channel) != "string") {
|
||||||
|
var result = {
|
||||||
|
channel: {
|
||||||
|
expected: "string",
|
||||||
|
got: arr.hasOwnProperty("channel") ? typeof(arr.channel) : undefined
|
||||||
|
},
|
||||||
|
new_channel: {
|
||||||
|
expected: "string",
|
||||||
|
got: arr.hasOwnProperty("new_channel") ? typeof(arr.new_channel) : undefined
|
||||||
|
}
|
||||||
|
};
|
||||||
|
socket.emit('update_required', result);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var channel = arr.channel.replace(/ /g,'').toLowerCase();
|
||||||
|
var new_channel = arr.new_channel.replace(/ /g, '').toLowerCase();
|
||||||
|
db.collection("frontpage_lists").find({_id: new_channel}, function(err, fp) {
|
||||||
|
if(fp.length == 0) {
|
||||||
|
socket.emit("toast", "nolist");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Functions.getSessionAdminUser(Functions.getSession(socket), channel, function(userpass) {
|
||||||
|
if(userpass != "" || arr.userpass == undefined) {
|
||||||
|
arr.userpass = userpass;
|
||||||
|
}
|
||||||
|
Functions.getSessionAdminUser(Functions.getSession(socket), new_channel, function(userpass) {
|
||||||
|
var otheruser = "";
|
||||||
|
if(userpass != "") {
|
||||||
|
otheruser = userpass;
|
||||||
|
}
|
||||||
|
db.collection(channel).find({now_playing: true}, function(e, np) {
|
||||||
|
|
||||||
|
var project_object = {
|
||||||
|
"id": 1,
|
||||||
|
"added": 1,
|
||||||
|
"guids": { "$literal": [] },
|
||||||
|
"now_playing": 1,
|
||||||
|
"title": 1,
|
||||||
|
"votes": { "$literal": 0 },
|
||||||
|
"start": 1,
|
||||||
|
"duration": 1,
|
||||||
|
"end": 1,
|
||||||
|
"type": 1
|
||||||
|
};
|
||||||
|
if(np.length > 0) project_object.now_playing = { "$literal": false };
|
||||||
|
db.collection(new_channel + "_settings").find({id: "config"}, function(e, new_conf) {
|
||||||
|
if(new_conf.length > 0 && (new_conf[0].userpass == "" || !new_conf[0].userpass || new_conf[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socketid, otheruser)).digest("base64"))) {
|
||||||
|
db.collection(channel + "_settings").find({id: "config"}, function(e, this_conf) {
|
||||||
|
if(this_conf.userpass == "" || !this_conf.userpass || this_conf.userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socketid, arr.userpass)).digest("base64")) {
|
||||||
|
db.collection(new_channel).aggregate([
|
||||||
|
{
|
||||||
|
"$match": { type: "video" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$project": project_object
|
||||||
|
}
|
||||||
|
], function(e, docs) {
|
||||||
|
var path = require('path');
|
||||||
|
var mongo_config = require(path.join(path.join(__dirname, '../config/'), 'mongo_config.js'));
|
||||||
|
var MongoClient = require('mongodb').MongoClient;
|
||||||
|
var url = "mongodb://" + mongo_config.host + ":" + mongo_config.port + "/";
|
||||||
|
MongoClient.connect(url, function(err, _db) {
|
||||||
|
var dbo = _db.db(mongo_config.config);
|
||||||
|
dbo.collection(channel).insertMany(docs, {ordered: false}, function(err, res) {
|
||||||
|
List.send_list(channel, undefined, false, true, false);
|
||||||
|
List.send_play(channel, undefined);
|
||||||
|
socket.emit("toast", "addedplaylist");
|
||||||
|
_db.close();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
socket.emit("auth_required");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
socket.emit("toast", "other_list_pass");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function add_function(arr, coll, guid, offline, socket) {
|
function add_function(arr, coll, guid, offline, socket) {
|
||||||
var socketid = socket.zoff_id;
|
var socketid = socket.zoff_id;
|
||||||
if(typeof(arr) === 'object' && arr !== undefined && arr !== null && arr !== "" && !isNaN(parseInt(arr.duration)))
|
if(typeof(arr) === 'object' && arr !== undefined && arr !== null && arr !== "" && !isNaN(parseInt(arr.duration)))
|
||||||
@@ -91,8 +185,12 @@ function add_function(arr, coll, guid, offline, socket) {
|
|||||||
}
|
}
|
||||||
coll = coll.replace(/ /g,'');
|
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;
|
if(adminpass != "" || arr.adminpass == undefined) {
|
||||||
arr.userpass = userpass;
|
arr.adminpass = adminpass;
|
||||||
|
}
|
||||||
|
if(userpass != "" || arr.userpass == undefined) {
|
||||||
|
arr.userpass = userpass;
|
||||||
|
}
|
||||||
db.collection(coll + "_settings").find(function(err, docs){
|
db.collection(coll + "_settings").find(function(err, docs){
|
||||||
if(docs.length > 0 && (docs[0].userpass == undefined || docs[0].userpass == "" || (arr.hasOwnProperty('pass') && docs[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socketid, arr.pass)).digest("base64")))) {
|
if(docs.length > 0 && (docs[0].userpass == undefined || docs[0].userpass == "" || (arr.hasOwnProperty('pass') && docs[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socketid, arr.pass)).digest("base64")))) {
|
||||||
|
|
||||||
@@ -280,8 +378,12 @@ function voteUndecided(msg, coll, guid, offline, socket) {
|
|||||||
}
|
}
|
||||||
coll = msg.channel.toLowerCase().replace(/ /g,'');
|
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;
|
if(adminpass != "" || msg.adminpass == undefined) {
|
||||||
msg.pass = userpass;
|
msg.adminpass = adminpass;
|
||||||
|
}
|
||||||
|
if(userpass != "" || msg.pass == undefined) {
|
||||||
|
msg.pass = userpass;
|
||||||
|
}
|
||||||
|
|
||||||
db.collection(coll + "_settings").find({id: "config"}, function(err, docs){
|
db.collection(coll + "_settings").find({id: "config"}, function(err, docs){
|
||||||
if(docs.length > 0 && (docs[0].userpass == undefined || docs[0].userpass == "" || (msg.hasOwnProperty('pass') && docs[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socketid, msg.pass)).digest("base64")))) {
|
if(docs.length > 0 && (docs[0].userpass == undefined || docs[0].userpass == "" || (msg.hasOwnProperty('pass') && docs[0].userpass == crypto.createHash('sha256').update(Functions.decrypt_string(socketid, msg.pass)).digest("base64")))) {
|
||||||
@@ -341,8 +443,12 @@ function shuffle(msg, coll, guid, offline, socket) {
|
|||||||
coll = msg.channel.toLowerCase().replace(/ /g,'');
|
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;
|
if(adminpass != "" || msg.adminpass == undefined) {
|
||||||
msg.pass = userpass;
|
msg.adminpass = adminpass;
|
||||||
|
}
|
||||||
|
if(userpass != "" || msg.pass == undefined) {
|
||||||
|
msg.pass = userpass;
|
||||||
|
}
|
||||||
db.collection("timeout_api").find({
|
db.collection("timeout_api").find({
|
||||||
type: "shuffle",
|
type: "shuffle",
|
||||||
guid: coll,
|
guid: coll,
|
||||||
@@ -454,8 +560,12 @@ function delete_all(msg, coll, guid, offline, socket) {
|
|||||||
}
|
}
|
||||||
coll = coll.replace(/ /g,'');
|
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;
|
if(adminpass != "" || msg.adminpass == undefined) {
|
||||||
msg.pass = userpass;
|
msg.adminpass = adminpass;
|
||||||
|
}
|
||||||
|
if(userpass != "" || msg.pass == undefined) {
|
||||||
|
msg.pass = userpass;
|
||||||
|
}
|
||||||
var hash = Functions.hash_pass(Functions.hash_pass(Functions.decrypt_string(socketid, msg.adminpass),true));
|
var hash = Functions.hash_pass(Functions.hash_pass(Functions.decrypt_string(socketid, msg.adminpass),true));
|
||||||
var hash_userpass = crypto.createHash('sha256').update(Functions.decrypt_string(socketid, msg.pass)).digest("base64");
|
var hash_userpass = crypto.createHash('sha256').update(Functions.decrypt_string(socketid, msg.pass)).digest("base64");
|
||||||
db.collection(coll + "_settings").find(function(err, conf) {
|
db.collection(coll + "_settings").find(function(err, conf) {
|
||||||
@@ -505,6 +615,7 @@ function vote(coll, id, guid, socket, full_list, last) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.addFromOtherList = addFromOtherList;
|
||||||
module.exports.add_function = add_function;
|
module.exports.add_function = add_function;
|
||||||
module.exports.voteUndecided = voteUndecided;
|
module.exports.voteUndecided = voteUndecided;
|
||||||
module.exports.shuffle = shuffle;
|
module.exports.shuffle = shuffle;
|
||||||
|
|||||||
@@ -25,8 +25,12 @@ function thumbnail(msg, coll, guid, offline, socket) {
|
|||||||
}
|
}
|
||||||
coll = coll.replace(/ /g,'');
|
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;
|
if(userpass != "" || msg.userpass == undefined) {
|
||||||
msg.adminpass = adminpass;
|
msg.userpass = userpass;
|
||||||
|
}
|
||||||
|
if(adminpass != "" || msg.adminpass == undefined) {
|
||||||
|
msg.adminpass = adminpass;
|
||||||
|
}
|
||||||
|
|
||||||
msg.thumbnail = msg.thumbnail.replace(/^https?\:\/\//i, "");
|
msg.thumbnail = msg.thumbnail.replace(/^https?\:\/\//i, "");
|
||||||
if(msg.thumbnail.substring(0,2) != "//") msg.thumbnail = "//" + msg.thumbnail;
|
if(msg.thumbnail.substring(0,2) != "//") msg.thumbnail = "//" + msg.thumbnail;
|
||||||
@@ -76,8 +80,12 @@ function description(msg, coll, guid, offline, socket) {
|
|||||||
}
|
}
|
||||||
coll = coll.replace(/ /g,'');
|
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;
|
if(userpass != "" || msg.userpass == undefined) {
|
||||||
msg.adminpass = adminpass;
|
msg.userpass = userpass;
|
||||||
|
}
|
||||||
|
if(adminpass != "" || msg.adminpass == undefined) {
|
||||||
|
msg.adminpass = adminpass;
|
||||||
|
}
|
||||||
var channel = msg.channel.toLowerCase();
|
var channel = msg.channel.toLowerCase();
|
||||||
var hash = Functions.hash_pass(Functions.decrypt_string(socket.zoff_id, msg.adminpass));
|
var hash = Functions.hash_pass(Functions.decrypt_string(socket.zoff_id, msg.adminpass));
|
||||||
db.collection(channel + "_settings").find({id: "config"}, function(err, docs){
|
db.collection(channel + "_settings").find({id: "config"}, function(err, docs){
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ li.disabled span {
|
|||||||
color: white !important;
|
color: white !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.import-spotify-auth, .import-youtube, .export-spotify-auth, .export-youtube, .exported-playlist{
|
.import-spotify-auth, .import-youtube, .export-spotify-auth, .export-youtube, .exported-playlist, .import-zoff{
|
||||||
color:white !important;
|
color:white !important;
|
||||||
height:40px !important;
|
height:40px !important;
|
||||||
line-height: 40px !important;
|
line-height: 40px !important;
|
||||||
@@ -701,7 +701,7 @@ input[type=text]:focus:not([readonly]) + label, input[type=password]:focus:not([
|
|||||||
background-color: #ff9800 !important;
|
background-color: #ff9800 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#import, #import_spotify{
|
#import, #import_spotify, #import_zoff{
|
||||||
width: 65%;
|
width: 65%;
|
||||||
padding-left: 35px;
|
padding-left: 35px;
|
||||||
color: rgb(68,68,68);
|
color: rgb(68,68,68);
|
||||||
@@ -710,6 +710,10 @@ input[type=text]:focus:not([readonly]) + label, input[type=password]:focus:not([
|
|||||||
height: 64px;
|
height: 64px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#import_zoff {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
#password{
|
#password{
|
||||||
width: 84%;
|
width: 84%;
|
||||||
margin-left: 30px;
|
margin-left: 30px;
|
||||||
@@ -1194,6 +1198,14 @@ margin:-1px;
|
|||||||
top:20px;
|
top:20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.zoff-image-import {
|
||||||
|
height: 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.zoff-color {
|
||||||
|
background: #2d2d2d !important;
|
||||||
|
}
|
||||||
|
|
||||||
.side_away {
|
.side_away {
|
||||||
-webkit-transition: all .3s !important;
|
-webkit-transition: all .3s !important;
|
||||||
-moz-transition: all .3s !important;
|
-moz-transition: all .3s !important;
|
||||||
|
|||||||
@@ -596,6 +596,12 @@ function change_offline(enabled, already_offline){
|
|||||||
|
|
||||||
function toast(msg) {
|
function toast(msg) {
|
||||||
switch(msg) {
|
switch(msg) {
|
||||||
|
case "other_list_pass":
|
||||||
|
msg = "The other list has a pass, can't import the songs..";
|
||||||
|
break;
|
||||||
|
case "nolist":
|
||||||
|
msg = "There is no list with that name";
|
||||||
|
break;
|
||||||
case "suggested_thumbnail":
|
case "suggested_thumbnail":
|
||||||
if(embed) return;
|
if(embed) return;
|
||||||
msg = "The thumbnail has been suggested!";
|
msg = "The thumbnail has been suggested!";
|
||||||
|
|||||||
@@ -876,6 +876,22 @@ $(document).on("submit", "#listImport", function(e){
|
|||||||
document.getElementById("import").value = "";
|
document.getElementById("import").value = "";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on("submit", "#listImportZoff", function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var new_channel = $("#import_zoff").val();
|
||||||
|
if(new_channel == "") {
|
||||||
|
Materialize.toast("It seems you've entered a invalid channel-name.", 4000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
socket.emit("import_zoff", {channel: chan.toLowerCase(), new_channel: new_channel.toLowerCase()});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on("click", ".import-zoff", function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$(".import-zoff-container").addClass("hide");
|
||||||
|
$(".zoff_add_field").removeClass("hide");
|
||||||
|
});
|
||||||
|
|
||||||
$(document).on("submit", "#listImportSpotify", function(e){
|
$(document).on("submit", "#listImportSpotify", function(e){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if(spotify_authenticated && $("#import_spotify").val() !== ""){
|
if(spotify_authenticated && $("#import_spotify").val() !== ""){
|
||||||
|
|||||||
@@ -332,6 +332,24 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="white-bg">
|
||||||
|
<div class="input-field field-settings import-buttons import-zoff-container">
|
||||||
|
<a class="waves-effect zoff-color lighten btn import-zoff" title="Import Zoff playlist">
|
||||||
|
<img src="/assets/images/z.svg" class="left zoff-logo zoff-image-import" alt="Zoff Logo" />Zoff
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="input-field field-settings zoff_add_field hide">
|
||||||
|
<form action="#" id="listImportZoff">
|
||||||
|
<i class="material-icons import-icon">playlist_add</i>
|
||||||
|
<input title="Input Zoff-playlist name here!" placeholder="Enter Zoff-list" id="import_zoff" type="text" class="validate" autocomplete="off" />
|
||||||
|
<div id="playlist_loader_zoff" class="valign playlist_loader_padding hide">
|
||||||
|
<div class="preloader-wrapper small active">
|
||||||
|
{{> spinner}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
<li class="not-imported white-bg hide">
|
<li class="not-imported white-bg hide">
|
||||||
<div class="center-align">Not imported</div>
|
<div class="center-align">Not imported</div>
|
||||||
<ul class="input-field field-settings not-imported-container">
|
<ul class="input-field field-settings not-imported-container">
|
||||||
|
|||||||
Reference in New Issue
Block a user