mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Cleaning up logs, now working chromecast on private channel
This commit is contained in:
@@ -256,7 +256,6 @@ function getSessionChatPass(id, callback) {
|
|||||||
|
|
||||||
function setChromecastHost(id, other_id, list, callback) {
|
function setChromecastHost(id, other_id, list, callback) {
|
||||||
try {
|
try {
|
||||||
console.log("settingChromecastHost: ", id, other_id);
|
|
||||||
if(id == "empty" || id == undefined) {
|
if(id == "empty" || id == undefined) {
|
||||||
callback();
|
callback();
|
||||||
return;
|
return;
|
||||||
@@ -266,7 +265,6 @@ function setChromecastHost(id, other_id, list, callback) {
|
|||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.log(e);
|
|
||||||
callback(false);
|
callback(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -288,7 +286,6 @@ function setSessionUserPass(id, userpass, list, callback) {
|
|||||||
|
|
||||||
function getSessionAdminUser(id, list, callback) {
|
function getSessionAdminUser(id, list, callback) {
|
||||||
try {
|
try {
|
||||||
console.log(id);
|
|
||||||
if(id == "empty" || id == undefined) {
|
if(id == "empty" || id == undefined) {
|
||||||
callback("", "", false);
|
callback("", "", false);
|
||||||
return;
|
return;
|
||||||
@@ -297,7 +294,6 @@ function getSessionAdminUser(id, list, callback) {
|
|||||||
var userpass = "";
|
var userpass = "";
|
||||||
var adminpass = "";
|
var adminpass = "";
|
||||||
if(d.length > 0) {
|
if(d.length > 0) {
|
||||||
console.log(id, d);
|
|
||||||
if(d[0].hasOwnProperty("chromecast") && d[0].chromecast) {
|
if(d[0].hasOwnProperty("chromecast") && d[0].chromecast) {
|
||||||
getSessionAdminUser(d[0].id, list, callback);
|
getSessionAdminUser(d[0].id, list, callback);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -79,16 +79,11 @@ module.exports = function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on('chromecast', function(msg) {
|
socket.on('chromecast', function(msg) {
|
||||||
console.log("chromecast event", msg);
|
|
||||||
console.log(Functions.getSession(socket));
|
|
||||||
console.log("cookie_id", socket.cookie_id);
|
|
||||||
try {
|
try {
|
||||||
if(typeof(msg) == "object" && msg.hasOwnProperty("guid") &&
|
if(typeof(msg) == "object" && msg.hasOwnProperty("guid") &&
|
||||||
msg.hasOwnProperty("socket_id") && msg.hasOwnProperty("channel") && typeof(msg.guid) == "string" &&
|
msg.hasOwnProperty("socket_id") && msg.hasOwnProperty("channel") && typeof(msg.guid) == "string" &&
|
||||||
typeof(msg.channel) == "string" && typeof(msg.socket_id) == "string" && msg.channel != "") {
|
typeof(msg.channel) == "string" && typeof(msg.socket_id) == "string" && msg.channel != "") {
|
||||||
db.collection("connected_users").find({"_id": msg.channel}, function(err, connected_users_channel) {
|
db.collection("connected_users").find({"_id": msg.channel}, function(err, connected_users_channel) {
|
||||||
console.log("another error", err);
|
|
||||||
console.log("test: ", connected_users_channel.length > 0 && connected_users_channel[0].users.indexOf(msg.guid) > -1, connected_users_channel.length > 0, connected_users_channel[0].users.indexOf(msg.guid) > -1, connected_users_channel)
|
|
||||||
if(connected_users_channel.length > 0 && connected_users_channel[0].users.indexOf(msg.guid) > -1) {
|
if(connected_users_channel.length > 0 && connected_users_channel[0].users.indexOf(msg.guid) > -1) {
|
||||||
coll = msg.channel.toLowerCase();//.replace(/ /g,'');
|
coll = msg.channel.toLowerCase();//.replace(/ /g,'');
|
||||||
coll = Functions.removeEmojis(coll).toLowerCase();
|
coll = Functions.removeEmojis(coll).toLowerCase();
|
||||||
@@ -97,7 +92,6 @@ module.exports = function() {
|
|||||||
coll = coll.substring(0, coll.indexOf("?"));
|
coll = coll.substring(0, coll.indexOf("?"));
|
||||||
}
|
}
|
||||||
Functions.setChromecastHost(socket.cookie_id, msg.socket_id, msg.channel, function(results) {
|
Functions.setChromecastHost(socket.cookie_id, msg.socket_id, msg.channel, function(results) {
|
||||||
console.log("setChromecastHost: ", results);
|
|
||||||
});
|
});
|
||||||
//socket.cookie_id = msg.guid;
|
//socket.cookie_id = msg.guid;
|
||||||
guid = msg.guid;
|
guid = msg.guid;
|
||||||
@@ -107,20 +101,17 @@ module.exports = function() {
|
|||||||
msg.channel = Functions.encodeChannelName(msg.channel);
|
msg.channel = Functions.encodeChannelName(msg.channel);
|
||||||
}
|
}
|
||||||
in_list = true;
|
in_list = true;
|
||||||
console.log("chromecast list", coll);
|
|
||||||
chromecast_object = true;
|
chromecast_object = true;
|
||||||
socket.join(coll);
|
socket.join(coll);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.log("this is the crash", e);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("get_id", function() {
|
socket.on("get_id", function() {
|
||||||
console.log("gotten request from mobile", Functions.getSession(socket));
|
|
||||||
socket.emit("id_chromecast", {cookie_id: Functions.getSession(socket), guid: guid});
|
socket.emit("id_chromecast", {cookie_id: Functions.getSession(socket), guid: guid});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -406,7 +397,6 @@ module.exports = function() {
|
|||||||
|
|
||||||
socket.on('end', function(obj)
|
socket.on('end', function(obj)
|
||||||
{
|
{
|
||||||
console.log("end event", obj);
|
|
||||||
if(obj.hasOwnProperty("channel") && obj.channel.indexOf("?") > -1){
|
if(obj.hasOwnProperty("channel") && obj.channel.indexOf("?") > -1){
|
||||||
var _list = obj.channel.substring(0, obj.channel.indexOf("?"));
|
var _list = obj.channel.substring(0, obj.channel.indexOf("?"));
|
||||||
obj.channel = _list;
|
obj.channel = _list;
|
||||||
@@ -649,7 +639,6 @@ module.exports = function() {
|
|||||||
|
|
||||||
socket.on('pos', function(obj)
|
socket.on('pos', function(obj)
|
||||||
{
|
{
|
||||||
console.log("pos object", obj);
|
|
||||||
if(obj != undefined && obj.hasOwnProperty("channel") && obj.channel.indexOf("?") > -1){
|
if(obj != undefined && obj.hasOwnProperty("channel") && obj.channel.indexOf("?") > -1){
|
||||||
var _list = obj.channel.substring(0, obj.channel.indexOf("?"));
|
var _list = obj.channel.substring(0, obj.channel.indexOf("?"));
|
||||||
obj.channel = _list;
|
obj.channel = _list;
|
||||||
@@ -689,9 +678,7 @@ module.exports = function() {
|
|||||||
}
|
}
|
||||||
if(coll == undefined) return;
|
if(coll == undefined) return;
|
||||||
db.collection(coll + "_settings").find(function(err, docs) {
|
db.collection(coll + "_settings").find(function(err, docs) {
|
||||||
console.log("trying to get pos in song");
|
|
||||||
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass) {
|
Functions.getSessionAdminUser(Functions.getSession(socket), coll, function(userpass, adminpass) {
|
||||||
console.log("userpass, adminpass", userpass, adminpass);
|
|
||||||
if(userpass != "" || obj.pass == undefined) {
|
if(userpass != "" || obj.pass == undefined) {
|
||||||
obj.pass = userpass;
|
obj.pass = userpass;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user