mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-12-07 20:18:49 +00:00
Started work for having session-logins instead of sending passwords back and forth
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
var Admin = {
|
||||
|
||||
beginning:true,
|
||||
logged_in: false,
|
||||
|
||||
pw: function(msg) {
|
||||
Admin.logged_in = msg;
|
||||
if(!msg) return;
|
||||
w_p = false;
|
||||
if(adminpass == undefined || adminpass == "") {
|
||||
adminpass = Crypt.get_pass(chan.toLowerCase());
|
||||
//adminpass = Crypt.get_pass(chan.toLowerCase());
|
||||
}
|
||||
names = ["vote","addsongs","longsongs","frontpage", "allvideos",
|
||||
"removeplay", "skip", "shuffle", "userpass"];
|
||||
Crypt.set_pass(chan.toLowerCase(), Crypt.tmp_pass);
|
||||
//Crypt.set_pass(chan.toLowerCase(), Crypt.tmp_pass);
|
||||
|
||||
for (var i = 0; i < names.length; i++) {
|
||||
$("input[name="+names[i]+"]").attr("disabled", false);
|
||||
@@ -57,11 +59,11 @@ var Admin = {
|
||||
|
||||
conf: function(msg) {
|
||||
if(msg[0].adminpass == ""){
|
||||
Crypt.remove_pass(chan.toLowerCase());
|
||||
////Crypt.remove_pass(chan.toLowerCase());
|
||||
}
|
||||
Admin.set_conf(msg[0]);
|
||||
if(msg[0].adminpass !== "" && (Crypt.get_pass(chan.toLowerCase()) !== undefined && Admin.beginning && Crypt.get_pass(chan.toLowerCase()) !== "")){
|
||||
emit("password", {password: Crypt.crypt_pass(Crypt.get_pass(chan.toLowerCase())), channel: chan.toLowerCase()});
|
||||
if(msg[0].adminpass !== "" && Admin.beginning){
|
||||
//emit("password", {password: Crypt.crypt_pass(Crypt.get_pass(chan.toLowerCase())), channel: chan.toLowerCase()});
|
||||
Admin.beginning = false;
|
||||
}
|
||||
},
|
||||
@@ -69,7 +71,7 @@ var Admin = {
|
||||
pass_save: function() {
|
||||
if(!w_p) {
|
||||
//emit('password', {password: Crypt.crypt_pass(CryptoJS.SHA256(document.getElementById("password").value).toString()), channel: chan.toLowerCase(), oldpass: Crypt.crypt_pass(Crypt.get_pass(chan.toLowerCase()))});
|
||||
emit('password', {password: Crypt.crypt_pass(document.getElementById("password").value), channel: chan.toLowerCase(), oldpass: Crypt.crypt_pass(Crypt.get_pass(chan.toLowerCase()))});
|
||||
emit('password', {password: Crypt.crypt_pass(document.getElementById("password").value), channel: chan.toLowerCase()});
|
||||
} else {
|
||||
//emit('password', {password: Crypt.crypt_pass(CryptoJS.SHA256(document.getElementById("password").value).toString()), channel: chan.toLowerCase()});
|
||||
emit('password', {password: Crypt.crypt_pass(document.getElementById("password").value), channel: chan.toLowerCase()});
|
||||
@@ -78,9 +80,11 @@ var Admin = {
|
||||
|
||||
log_out: function() {
|
||||
before_toast();
|
||||
if(Crypt.get_pass(chan.toLowerCase())) {
|
||||
Crypt.remove_pass(chan.toLowerCase());
|
||||
Admin.display_logged_out();
|
||||
/*if(Crypt.get_pass(chan.toLowerCase())) {*/
|
||||
//Crypt.remove_pass(chan.toLowerCase());
|
||||
Admin.display_logged_out();
|
||||
if(Admin.logged_in) {
|
||||
socket.emit("logout");
|
||||
Materialize.toast("Logged out", 4000);
|
||||
} else {
|
||||
Materialize.toast("Not logged in", 4000);
|
||||
@@ -92,7 +96,6 @@ var Admin = {
|
||||
adminpass = "";
|
||||
names = ["vote","addsongs","longsongs","frontpage", "allvideos",
|
||||
"removeplay", "skip", "shuffle"];
|
||||
|
||||
document.getElementById("password").value = "";
|
||||
$("#thumbnail_form").css("display", "none");
|
||||
$("#description_form").css("display", "none");
|
||||
@@ -152,21 +155,13 @@ var Admin = {
|
||||
"removeplay", "skip", "shuffle", "userpass"];
|
||||
|
||||
|
||||
if(conf_array.adminpass === "" || !w_p){
|
||||
hasadmin = false;
|
||||
if(!Helper.mobilecheck()) {
|
||||
//$(".playlist-tabs").removeClass("hide");
|
||||
//$("#wrapper").toggleClass("tabs_height");
|
||||
}
|
||||
}
|
||||
else hasadmin = true;
|
||||
hasadmin = conf_array.adminpass != "";
|
||||
|
||||
for (var i = 0; i < names.length; i++) {
|
||||
document.getElementsByName(names[i])[0].checked = (conf_array[names[i]] === true);
|
||||
$("input[name="+names[i]+"]").attr("disabled", hasadmin);
|
||||
$("input[name="+names[i]+"]").attr("disabled", !Admin.logged_in);
|
||||
}
|
||||
|
||||
if((hasadmin)) {
|
||||
if((hasadmin) && !Admin.logged_in) {
|
||||
if($("#admin-lock").html() != "lock") Admin.display_logged_out();
|
||||
} else if(!hasadmin && Crypt.get_pass(chan.toLowerCase()) === undefined) {
|
||||
if(!Helper.contains($(".playlist-tabs").attr("class").split(" "), "hide")) {
|
||||
@@ -182,7 +177,7 @@ var Admin = {
|
||||
|
||||
if(!$(".password_protected").prop("checked") && !$(".change_user_pass").hasClass("hide")) {
|
||||
$(".change_user_pass").addClass("hide");
|
||||
Crypt.remove_userpass(chan.toLowerCase());
|
||||
//Crypt.remove_userpass(chan.toLowerCase());
|
||||
}
|
||||
|
||||
if(conf_array.thumbnail != undefined && conf_array.thumbnail != "") {
|
||||
@@ -220,7 +215,7 @@ var Admin = {
|
||||
userpass_changed: userpass_changed
|
||||
};
|
||||
if(userpass_changed){
|
||||
Crypt.set_userpass(chan.toLowerCase(), userpass);
|
||||
//Crypt.set_userpass(chan.toLowerCase(), userpass);
|
||||
}
|
||||
emit("conf", configs);
|
||||
},
|
||||
@@ -231,9 +226,9 @@ var Admin = {
|
||||
|
||||
shuffle: function() {
|
||||
if(!offline) {
|
||||
var u = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
//var u = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(u == undefined) u = "";
|
||||
emit('shuffle', {adminpass: adminpass !== undefined ? Crypt.crypt_pass(adminpass) : "", channel: chan.toLowerCase(), pass: embed ? '' : u});
|
||||
emit('shuffle', {channel: chan.toLowerCase()});
|
||||
} else {
|
||||
for(var x = 0; x < full_playlist.length; x++){
|
||||
var num = Math.floor(Math.random()*1000000);
|
||||
|
||||
@@ -17,7 +17,7 @@ var Channel = {
|
||||
$(".pagination-results").addClass("client-pagination-height");
|
||||
$(".control-list").addClass("client-control-list");
|
||||
}
|
||||
Admin.display_logged_out();
|
||||
if(!Admin.logged_in) Admin.display_logged_out();
|
||||
number_suggested = 0;
|
||||
var no_socket = true;
|
||||
|
||||
@@ -532,7 +532,7 @@ var Channel = {
|
||||
var add = "";
|
||||
w_p = true;
|
||||
if(private_channel) add = Crypt.getCookie("_uI") + "_";
|
||||
socket.emit("list", {version: parseInt(localStorage.getItem("VERSION")), channel: add + chan.toLowerCase(), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true)});
|
||||
socket.emit("list", {version: parseInt(localStorage.getItem("VERSION")), channel: add + chan.toLowerCase()});
|
||||
} else if(url_split[3] === "") {
|
||||
/*if(client) {
|
||||
var host = window.location.hostname.split(".");
|
||||
@@ -682,12 +682,12 @@ var Channel = {
|
||||
|
||||
function get_history() {
|
||||
if(socket && socket.id) {
|
||||
var p = Crypt.get_userpass();
|
||||
/*var p = Crypt.get_userpass();
|
||||
if(p == undefined) p = "";
|
||||
var c = Crypt.crypt_pass(p, true);
|
||||
if(c == undefined) c = "";
|
||||
socket.emit("get_history", {channel: chan.toLowerCase(), all: false, pass: embed ? '' : c});
|
||||
socket.emit("get_history", {channel: chan.toLowerCase(), all: true, pass: ""});
|
||||
if(c == undefined) c = "";*/
|
||||
socket.emit("get_history", {channel: chan.toLowerCase(), all: false});
|
||||
socket.emit("get_history", {channel: chan.toLowerCase(), all: true});
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
get_history();
|
||||
|
||||
@@ -9,8 +9,7 @@ var Chat = {
|
||||
if(input.length == 2) {
|
||||
var name = input[0];
|
||||
var password = input[1];
|
||||
temp_name = name;
|
||||
temp_pass = password;
|
||||
|
||||
password = Crypt.crypt_chat_pass(password);
|
||||
socket.emit("namechange", {name: name, channel: chan.toLowerCase(), password: password, first: first});
|
||||
} else if(input.length == 3) {
|
||||
@@ -18,8 +17,7 @@ var Chat = {
|
||||
var new_password = input[1];
|
||||
var old_password = input[2];
|
||||
|
||||
temp_name = name;
|
||||
temp_pass = password;
|
||||
|
||||
|
||||
new_password = Crypt.crypt_chat_pass(new_password);
|
||||
old_password = Crypt.crypt_chat_pass(old_password);
|
||||
@@ -83,7 +81,7 @@ var Chat = {
|
||||
} else if($(".chat-tab-li a.active").attr("href") == "#all_chat") {
|
||||
socket.emit("all,chat", {channel: chan.toLowerCase(), data: data.value});
|
||||
} else {
|
||||
socket.emit("chat", {channel: chan.toLowerCase(), data: data.value, pass: embed ? '' : Crypt.crypt_chat_pass(Crypt.get_userpass(chan.toLowerCase()))});
|
||||
socket.emit("chat", {channel: chan.toLowerCase(), data: data.value});
|
||||
}
|
||||
data.value = "";
|
||||
return;
|
||||
|
||||
@@ -23,9 +23,9 @@ var Crypt = {
|
||||
|
||||
if(window.location.pathname != "/") {
|
||||
try {
|
||||
Crypt.conf_pass = Crypt.decrypt(Crypt.getCookie(chan.toLowerCase()), chan.toLowerCase());
|
||||
//Crypt.conf_pass = Crypt.decrypt(Crypt.getCookie(chan.toLowerCase()), chan.toLowerCase());
|
||||
} catch(err) {
|
||||
Crypt.conf_pass = Crypt.decrypt(Crypt.create_cookie(chan.toLowerCase()), chan.toLowerCase());
|
||||
//Crypt.conf_pass = Crypt.decrypt(Crypt.create_cookie(chan.toLowerCase()), chan.toLowerCase());
|
||||
}
|
||||
|
||||
Hostcontroller.change_enabled(conf_arr.remote);
|
||||
@@ -148,7 +148,7 @@ var Crypt = {
|
||||
return Crypt.getCookie(name);
|
||||
},
|
||||
|
||||
set_pass: function(chan, pass) {
|
||||
/*set_pass: function(chan, pass) {
|
||||
Crypt.conf_pass.passwords[chan] = pass;
|
||||
Crypt.encrypt(Crypt.conf_pass, chan);
|
||||
},
|
||||
@@ -166,7 +166,7 @@ var Crypt = {
|
||||
remove_userpass:function(chan) {
|
||||
delete Crypt.conf_pass.passwords["userpass"];
|
||||
Crypt.encrypt(Crypt.conf_pass, chan.toLowerCase());
|
||||
},
|
||||
},*/
|
||||
|
||||
set_name:function(name, pass) {
|
||||
conf_arr.name = encodeURIComponent(name).replace(/\W/g, '');
|
||||
|
||||
@@ -195,7 +195,7 @@ function toast(msg) {
|
||||
case "wrongpass":
|
||||
if(embed) return;
|
||||
msg=Helper.rnd(["That's not the right password!", "Wrong! Better luck next time...", "You seem to have mistyped the password", "Incorrect. Have you tried meditating?","Nope, wrong password!", "Wrong password. The authorities have been notified."]);
|
||||
Crypt.remove_pass(chan.toLowerCase());
|
||||
//Crypt.remove_pass(chan.toLowerCase());
|
||||
Admin.display_logged_out();
|
||||
$("#thumbnail_form").css("display", "none");
|
||||
$("#description_form").css("display", "none");
|
||||
@@ -242,7 +242,7 @@ function toast(msg) {
|
||||
}
|
||||
tried_again = false;
|
||||
msg=Helper.rnd(["I'm sorry, but you have to be an admin to do that!", "Only admins can do that", "You're not allowed to do that, try logging in!", "I can't let you do that", "Please log in to do that"]);
|
||||
Crypt.remove_pass(chan.toLowerCase());
|
||||
//Crypt.remove_pass(chan.toLowerCase());
|
||||
Admin.display_logged_out();
|
||||
$("#thumbnail_form").css("display", "none");
|
||||
$("#description_form").css("display", "none");
|
||||
|
||||
@@ -97,7 +97,7 @@ function hide_native(way) {
|
||||
$("#chromecast_text").html("");
|
||||
$("#playing_on").css("display", "none");
|
||||
if(!offline){
|
||||
socket.emit('pos', {channel: chan.toLowerCase(), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true)});
|
||||
socket.emit('pos', {channel: chan.toLowerCase()});
|
||||
} else {
|
||||
Player.loadVideoById(video_id);
|
||||
}
|
||||
@@ -111,14 +111,14 @@ function chromecastListener(evt, data) {
|
||||
if(offline){
|
||||
Player.playNext();
|
||||
} else {
|
||||
socket.emit("end", {id: json_parsed.videoId, channel: chan.toLowerCase(), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true)});
|
||||
socket.emit("end", {id: json_parsed.videoId, channel: chan.toLowerCase()});
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
if(offline){
|
||||
Player.playNext();
|
||||
} else {
|
||||
emit("skip", {error: json_parsed.data_code, id: json_parsed.videoId, pass: adminpass == "" ? "" : Crypt.crypt_pass(adminpass), channel: chan.toLowerCase(), userpass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true)});
|
||||
emit("skip", {error: json_parsed.data_code, id: json_parsed.videoId, channel: chan.toLowerCase()});
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
@@ -142,7 +142,7 @@ function start_auth() {
|
||||
$("#player_overlay").removeClass("hide");
|
||||
$("#player_overlay").css("display", "block");
|
||||
$("#user_password").modal("open");
|
||||
Crypt.remove_userpass(chan.toLowerCase());
|
||||
//Crypt.remove_userpass(chan.toLowerCase());
|
||||
before_toast();
|
||||
Materialize.toast("That is not the correct password, try again..", 4000);
|
||||
}
|
||||
@@ -151,10 +151,10 @@ function start_auth() {
|
||||
function emit_list() {
|
||||
var add = "";
|
||||
if(private_channel) add = Crypt.getCookie("_uI") + "_";
|
||||
var p = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(p == undefined) p = "";
|
||||
/*var p = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(p == undefined) p = "";*/
|
||||
if(socket.id) {
|
||||
socket.emit("list", {version: parseInt(localStorage.getItem("VERSION")), channel: add + chan.toLowerCase(), pass: embed ? '' : p});
|
||||
socket.emit("list", {version: parseInt(localStorage.getItem("VERSION")), channel: add + chan.toLowerCase()});
|
||||
} else {
|
||||
setTimeout(function(){
|
||||
emit_list();
|
||||
@@ -163,14 +163,11 @@ function emit_list() {
|
||||
}
|
||||
|
||||
function get_list_ajax() {
|
||||
var c = Crypt.get_userpass(chan.toLowerCase());
|
||||
if(c == "" || c == undefined) {
|
||||
c = "";
|
||||
}
|
||||
//var c = Crypt.get_userpass(chan.toLowerCase());
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
userpass: c,
|
||||
userpass: "",
|
||||
},
|
||||
url: "/api/list/" + chan.toLowerCase(),
|
||||
success: function(response) {
|
||||
@@ -198,12 +195,12 @@ function get_list_ajax() {
|
||||
}
|
||||
|
||||
function get_np_ajax() {
|
||||
var c = Crypt.get_userpass(chan.toLowerCase());
|
||||
if(c == undefined) c = "";
|
||||
/*var c = Crypt.get_userpass(chan.toLowerCase());
|
||||
if(c == undefined) c = "";*/
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
userpass: c,
|
||||
userpass: "",
|
||||
fetch_song: true
|
||||
},
|
||||
url: "/api/list/" + chan.toLowerCase() + "/__np__",
|
||||
@@ -223,15 +220,15 @@ function get_np_ajax() {
|
||||
}
|
||||
|
||||
function del_ajax(id) {
|
||||
var a = Crypt.get_pass(chan.toLowerCase());
|
||||
/*var a = Crypt.get_pass(chan.toLowerCase());
|
||||
var u = Crypt.get_userpass(chan.toLowerCase());
|
||||
if(a == undefined) a = "";
|
||||
if(u == undefined) u = "";
|
||||
if(u == undefined) u = "";*/
|
||||
$.ajax({
|
||||
type: "DELETE",
|
||||
data: {
|
||||
adminpass: a,
|
||||
userpass: u
|
||||
adminpass: "",
|
||||
userpass: ""
|
||||
},
|
||||
url: "/api/list/" + chan.toLowerCase() + "/" + id,
|
||||
success: function(response) {
|
||||
@@ -250,15 +247,15 @@ function del_ajax(id) {
|
||||
}
|
||||
|
||||
function add_ajax(id, title, duration, playlist, num, full_num, start, end) {
|
||||
var a = Crypt.get_pass(chan.toLowerCase());
|
||||
/*var a = Crypt.get_pass(chan.toLowerCase());
|
||||
var u = Crypt.get_userpass(chan.toLowerCase());
|
||||
if(a == undefined) a = "";
|
||||
if(u == undefined) u = "";
|
||||
if(u == undefined) u = "";*/
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
adminpass: a,
|
||||
userpass: u,
|
||||
adminpass: "",
|
||||
userpass: "",
|
||||
title: title,
|
||||
duration: duration,
|
||||
end_time: end,
|
||||
@@ -281,15 +278,15 @@ function add_ajax(id, title, duration, playlist, num, full_num, start, end) {
|
||||
}
|
||||
|
||||
function vote_ajax(id) {
|
||||
var a = Crypt.get_pass(chan.toLowerCase());
|
||||
/*var a = Crypt.get_pass(chan.toLowerCase());
|
||||
var u = Crypt.get_userpass(chan.toLowerCase());
|
||||
if(a == undefined) a = "";
|
||||
if(u == undefined) u = "";
|
||||
if(u == undefined) u = "";*/
|
||||
$.ajax({
|
||||
type: "PUT",
|
||||
data: {
|
||||
adminpass: a,
|
||||
userpass: u
|
||||
adminpass: "",
|
||||
userpass: ""
|
||||
},
|
||||
url: "/api/list/" + chan.toLowerCase() + "/" + id,
|
||||
success: function(response) {
|
||||
@@ -316,7 +313,7 @@ function setup_auth_listener() {
|
||||
if(msg.hasOwnProperty("value") && msg.value) {
|
||||
if(temp_user_pass != "") {
|
||||
userpass = temp_user_pass;
|
||||
Crypt.set_userpass(chan.toLowerCase(), userpass);
|
||||
//Crypt.set_userpass(chan.toLowerCase(), userpass);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -347,11 +344,15 @@ function setup_youtube_listener(){
|
||||
function get_list_listener(){
|
||||
socket.on("get_list", function(){
|
||||
var add = "";
|
||||
if(private_channel) add = Crypt.getCookie("_uI") + "_";
|
||||
var p = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(p == undefined) p = "";
|
||||
socket.emit("list", { offline: offline, version: parseInt(localStorage.getItem("VERSION")), channel: add + chan.toLowerCase(), pass: embed ? '' : p});
|
||||
//if(private_channel) add = Crypt.getCookie("_uI") + "_";
|
||||
/*var p = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(p == undefined) p = "";*/
|
||||
socket.emit("list", { offline: offline, version: parseInt(localStorage.getItem("VERSION")), channel: add + chan.toLowerCase()});
|
||||
});
|
||||
socket.on("id_chromecast", function(msg) {
|
||||
chromecast_specs_sent = true;
|
||||
castSession.sendMessage("urn:x-cast:zoff.me", {type: "mobilespecs", guid: msg, socketid: socket.id})
|
||||
})
|
||||
}
|
||||
|
||||
function setup_suggested_listener(){
|
||||
@@ -538,10 +539,10 @@ function change_offline(enabled, already_offline){
|
||||
$("#controls").off("click", Channel.seekToClick);
|
||||
$("#seekToDuration").remove();
|
||||
if(window.location.pathname != "/"){
|
||||
socket.emit("pos", {channel: chan.toLowerCase(), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true)});
|
||||
socket.emit("pos", {channel: chan.toLowerCase()});
|
||||
var add = "";
|
||||
if(private_channel) add = Crypt.getCookie("_uI") + "_";
|
||||
socket.emit("list", {version: parseInt(localStorage.getItem("VERSION")), channel: add + chan.toLowerCase(), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true)});
|
||||
socket.emit("list", {version: parseInt(localStorage.getItem("VERSION")), channel: add + chan.toLowerCase()});
|
||||
if($("#controls").hasClass("ewresize")) $("#controls").removeClass("ewresize");
|
||||
}
|
||||
}
|
||||
@@ -591,7 +592,7 @@ function toast(msg) {
|
||||
case "wrongpass":
|
||||
if(embed) return;
|
||||
msg=Helper.rnd(["That's not the right password!", "Wrong! Better luck next time...", "You seem to have mistyped the password", "Incorrect. Have you tried meditating?","Nope, wrong password!", "Wrong password. The authorities have been notified."]);
|
||||
Crypt.remove_pass(chan.toLowerCase());
|
||||
//Crypt.remove_pass(chan.toLowerCase());
|
||||
Admin.display_logged_out();
|
||||
$("#thumbnail_form").css("display", "none");
|
||||
$("#description_form").css("display", "none");
|
||||
@@ -638,7 +639,7 @@ function toast(msg) {
|
||||
}
|
||||
tried_again = false;
|
||||
msg=Helper.rnd(["I'm sorry, but you have to be an admin to do that!", "Only admins can do that", "You're not allowed to do that, try logging in!", "I can't let you do that", "Please log in to do that"]);
|
||||
Crypt.remove_pass(chan.toLowerCase());
|
||||
//Crypt.remove_pass(chan.toLowerCase());
|
||||
Admin.display_logged_out();
|
||||
$("#thumbnail_form").css("display", "none");
|
||||
$("#description_form").css("display", "none");
|
||||
|
||||
@@ -47,7 +47,7 @@ var Hostcontroller = {
|
||||
w_p = true;
|
||||
var add = "";
|
||||
if(private_channel) add = Crypt.getCookie("_uI") + "_";
|
||||
socket.emit("list", {version: parseInt(localStorage.getItem("VERSION")), channel: add + chan.toLowerCase(), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true)});
|
||||
socket.emit("list", {version: parseInt(localStorage.getItem("VERSION")), channel: add + chan.toLowerCase()});
|
||||
|
||||
window.history.pushState("object or string", "Title", "/"+chan.toLowerCase());
|
||||
} else if(arr.type == "pause") {
|
||||
|
||||
@@ -557,9 +557,9 @@ var List = {
|
||||
return;
|
||||
}
|
||||
if(!offline || (vote == "del" && (hasadmin && (!w_p && adminpass != "")))){
|
||||
var u = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(u == undefined) u = "";
|
||||
emit('vote', {channel: chan, id: id, type: vote, adminpass: adminpass == "" ? "" : Crypt.crypt_pass(adminpass), pass: embed ? '' : u});
|
||||
/*var u = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(u == undefined) u = "";*/
|
||||
emit('vote', {channel: chan, id: id, type: vote});
|
||||
} else {
|
||||
if(vote == "pos"){
|
||||
List.voted_song(id, (new Date()).getTime()/1000);
|
||||
@@ -572,9 +572,9 @@ var List = {
|
||||
|
||||
skip: function(way) {
|
||||
if(!offline){
|
||||
var u = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(u == undefined) u = "";
|
||||
emit('skip', {pass: adminpass == "" ? "" : Crypt.crypt_pass(adminpass), id:video_id, channel: chan.toLowerCase(), userpass: embed ? '' : u});
|
||||
/*var u = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(u == undefined) u = "";*/
|
||||
emit('skip', {id:video_id, channel: chan.toLowerCase()});
|
||||
} else {
|
||||
if(way) {
|
||||
Player.playNext();
|
||||
|
||||
@@ -196,9 +196,9 @@ $().ready(function(){
|
||||
if(offline) {
|
||||
socket.emit("offline", {status: true, channel: chan != undefined ? chan.toLowerCase() : ""});
|
||||
}
|
||||
if(chan != undefined && (Crypt.get_pass(chan.toLowerCase()) !== undefined && Crypt.get_pass(chan.toLowerCase()) !== "")){
|
||||
/*if(chan != undefined && (Crypt.get_pass(chan.toLowerCase()) !== undefined && Crypt.get_pass(chan.toLowerCase()) !== "")){
|
||||
emit("password", {password: Crypt.crypt_pass(Crypt.get_pass(chan.toLowerCase())), channel: chan.toLowerCase()});
|
||||
}
|
||||
}*/
|
||||
if(chan != undefined && conf_arr.name !== undefined && conf_arr.name !== "" && conf_arr.chat_pass !== undefined && conf_arr.chat_pass !== ""){
|
||||
setTimeout(function() {
|
||||
Chat.namechange(conf_arr.name + " " + conf_arr.chat_pass, true);
|
||||
@@ -212,7 +212,7 @@ $().ready(function(){
|
||||
|
||||
});
|
||||
|
||||
socket.on("name", function(data) {
|
||||
/*socket.on("name", function(data) {
|
||||
if(data.type == "name" && data.accepted) {
|
||||
Crypt.set_name(temp_name, temp_pass);
|
||||
temp_name = "";
|
||||
@@ -221,7 +221,7 @@ $().ready(function(){
|
||||
temp_name = "";
|
||||
temp_pass = "";
|
||||
}
|
||||
});
|
||||
});*/
|
||||
|
||||
socket.on("self_ping", function() {
|
||||
if(chan != undefined && chan.toLowerCase() != "") {
|
||||
@@ -268,8 +268,7 @@ initializeCastApi = function() {
|
||||
castSession.sendMessage("urn:x-cast:zoff.me", {type: "nextVideo", videoId: full_playlist[0].id, title: full_playlist[0].title})
|
||||
|
||||
if(Helper.mobilecheck() && !chromecast_specs_sent) {
|
||||
chromecast_specs_sent = true;
|
||||
castSession.sendMessage("urn:x-cast:zoff.me", {type: "mobilespecs", guid: guid, socketid: socket.id, adminpass: adminpass == "" ? "" : Crypt.crypt_pass(adminpass), channel: chan.toLowerCase(), userpass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true)})
|
||||
socket.emit("get_id");
|
||||
}
|
||||
hide_native(1);
|
||||
if(Helper.mobilecheck()) {
|
||||
@@ -382,7 +381,7 @@ $(document).on("click", ".pagination-results a", function(e) {
|
||||
|
||||
$(document).on("click", ".accept-delete", function(e) {
|
||||
e.preventDefault();
|
||||
emit("delete_all", {channel: chan.toLowerCase(), adminpass: adminpass == "" ? "" : Crypt.crypt_pass(adminpass), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true)});
|
||||
emit("delete_all", {channel: chan.toLowerCase()});
|
||||
$("#delete_song_alert").modal("close");
|
||||
});
|
||||
|
||||
@@ -475,13 +474,13 @@ $(document).on("click", "#offline-mode", function(e){
|
||||
|
||||
$(document).on("submit", "#thumbnail_form", function(e){
|
||||
e.preventDefault();
|
||||
emit("suggest_thumbnail", {channel: chan, thumbnail: $("#chan_thumbnail").val(), adminpass: Crypt.crypt_pass(Crypt.get_pass(chan.toLowerCase())), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true)});
|
||||
emit("suggest_thumbnail", {channel: chan, thumbnail: $("#chan_thumbnail").val()});
|
||||
$("#chan_thumbnail").val("");
|
||||
});
|
||||
|
||||
$(document).on("submit", "#description_form", function(e){
|
||||
e.preventDefault();
|
||||
emit("suggest_description", {channel: chan, description: $("#chan_description").val(), adminpass: Crypt.crypt_pass(Crypt.get_pass(chan.toLowerCase())), pass: embed ? '' : Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true)});
|
||||
emit("suggest_description", {channel: chan, description: $("#chan_description").val()});
|
||||
$("#chan_description").val("");
|
||||
});
|
||||
|
||||
|
||||
@@ -274,9 +274,9 @@ var Player = {
|
||||
paused = false;
|
||||
|
||||
if(!offline) {
|
||||
var u = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(u == undefined) u = "";
|
||||
socket.emit("end", {id: video_id, channel: chan.toLowerCase(), pass: embed ? '' : u});
|
||||
/*var u = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(u == undefined) u = "";*/
|
||||
socket.emit("end", {id: video_id, channel: chan.toLowerCase()});
|
||||
} else {
|
||||
Player.playNext();
|
||||
}
|
||||
@@ -310,9 +310,9 @@ var Player = {
|
||||
$("#pause").toggleClass("hide");
|
||||
}
|
||||
if((paused || was_stopped) && !offline) {
|
||||
var u = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(u == undefined) u = "";
|
||||
socket.emit('pos', {channel: chan.toLowerCase(), pass: embed ? '' : u});
|
||||
/*var u = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(u == undefined) u = "";*/
|
||||
socket.emit('pos', {channel: chan.toLowerCase()});
|
||||
paused = false;
|
||||
was_stopped = false;
|
||||
}
|
||||
@@ -555,9 +555,9 @@ var Player = {
|
||||
if(!user_auth_started) {
|
||||
if(newState.data == 5 || newState.data == 100 || newState.data == 101 || newState.data == 150) {
|
||||
curr_playing = Player.player.getVideoUrl().replace("https://www.youtube.com/watch?v=", "");
|
||||
var u = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(u == undefined) u = "";
|
||||
emit("skip", {error: newState.data, id: video_id, pass: adminpass == "" ? "" : Crypt.crypt_pass(adminpass), channel: chan.toLowerCase(), userpass: embed ? '' : u});
|
||||
/*var u = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(u == undefined) u = "";*/
|
||||
emit("skip", {error: newState.data, id: video_id, channel: chan.toLowerCase()});
|
||||
|
||||
} else if(video_id !== undefined) {
|
||||
Player.loadVideoById(video_id, duration);
|
||||
@@ -754,9 +754,9 @@ var Player = {
|
||||
|
||||
if(!offline) {
|
||||
Player.player.pauseVideo();
|
||||
var u = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(u == undefined) u = "";
|
||||
socket.emit("end", {id: video_id, channel: chan.toLowerCase(), pass: embed ? '' : u});
|
||||
/*var u = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(u == undefined) u = "";*/
|
||||
socket.emit("end", {id: video_id, channel: chan.toLowerCase()});
|
||||
} else {
|
||||
Player.playNext();
|
||||
}
|
||||
|
||||
@@ -453,9 +453,9 @@ var Search = {
|
||||
List.vote(id, "pos");
|
||||
}
|
||||
} else {
|
||||
var u = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(u == undefined) u = "";
|
||||
emit("add", {id: id, start: start, end: end, title: title, adminpass: adminpass == "" ? "" : Crypt.crypt_pass(adminpass), list: chan.toLowerCase(), duration: duration, playlist: playlist, num: num, total: full_num, pass: embed ? '' : u});
|
||||
/*var u = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(u == undefined) u = "";*/
|
||||
emit("add", {id: id, start: start, end: end, title: title, list: chan.toLowerCase(), duration: duration, playlist: playlist, num: num, total: full_num});
|
||||
}//[id, decodeURIComponent(title), adminpass, duration, playlist]);
|
||||
},
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ $(document).ready(function() {
|
||||
$("#contact-container").empty();
|
||||
$("#contact-container").html("Send a mail to us: <a title='Open in client' href='mailto:contact@zoff.me?Subject=Contact%20Zoff'>contact@zoff.me</a>");
|
||||
$("#submit-contact-form").hide();
|
||||
|
||||
|
||||
ga('send', 'pageview');
|
||||
|
||||
if(!Helper.mobilecheck()) {
|
||||
|
||||
Reference in New Issue
Block a user