mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Fixed issue with client vote/add and such
This commit is contained in:
@@ -278,13 +278,14 @@ function del_ajax(id) {
|
||||
url: "/api/list/" + chan.toLowerCase() + "/" + id,
|
||||
success: function(response) {
|
||||
toast("deletesong");
|
||||
get_list_ajax();
|
||||
},
|
||||
error: function(response) {
|
||||
if(response.responseJSON.status == 403) {
|
||||
start_auth();
|
||||
toast("listhaspass");
|
||||
} else if(response.responseJSON.status == 429) {
|
||||
setTimeout(function() {
|
||||
vote_ajax(id);
|
||||
del_ajax(id);
|
||||
}, response.getResponseHeader("Retry-After") * 1000);
|
||||
}
|
||||
}
|
||||
@@ -310,9 +311,12 @@ function add_ajax(id, title, duration, playlist, num, full_num, start, end) {
|
||||
url: "/api/list/" + chan.toLowerCase() + "/" + id,
|
||||
success: function(response) {
|
||||
toast("addedsong");
|
||||
get_list_ajax();
|
||||
},
|
||||
error: function(response) {
|
||||
if(response.responseJSON.status == 409) {
|
||||
if(response.responseJSON.status == 403) {
|
||||
toast("listhaspass");
|
||||
} else if(response.responseJSON.status == 409) {
|
||||
vote_ajax(id);
|
||||
} else if(response.responseJSON.status == 429) {
|
||||
setTimeout(function() {
|
||||
@@ -338,10 +342,11 @@ function vote_ajax(id) {
|
||||
url: "/api/list/" + chan.toLowerCase() + "/" + id,
|
||||
success: function(response) {
|
||||
toast("voted");
|
||||
get_list_ajax();
|
||||
},
|
||||
error: function(response) {
|
||||
if(response.responseJSON.status == 403) {
|
||||
start_auth();
|
||||
toast("listhaspass");
|
||||
} else if(response.responseJSON.status == 429) {
|
||||
setTimeout(function() {
|
||||
vote_ajax(id);
|
||||
@@ -391,6 +396,7 @@ function setup_youtube_listener(){
|
||||
function get_list_listener(){
|
||||
socket.on("get_list", function(){
|
||||
var add = "";
|
||||
socket_connected = true;
|
||||
//if(private_channel) add = Crypt.getCookie("_uI") + "_";
|
||||
/*var p = Crypt.crypt_pass(Crypt.get_userpass(chan.toLowerCase()), true);
|
||||
if(p == undefined) p = "";*/
|
||||
|
||||
@@ -548,7 +548,7 @@ var List = {
|
||||
},
|
||||
|
||||
vote: function(id, vote) {
|
||||
if(client && !socket.connected) {
|
||||
if(client && !socket_connected) {
|
||||
if(vote != "del") {
|
||||
vote_ajax(id);
|
||||
} else {
|
||||
|
||||
@@ -5,6 +5,7 @@ var client = false;
|
||||
if(domain.length > 0 && domain[0] == "client") {
|
||||
client = true;
|
||||
}
|
||||
var socket_connected = false;
|
||||
var hasadmin = 0;
|
||||
var list_html = $("#list-song-html").html();
|
||||
var unseen = false;
|
||||
|
||||
@@ -463,7 +463,7 @@ var Search = {
|
||||
},
|
||||
|
||||
submit: function(id,title,duration, playlist, num, full_num, start, end){
|
||||
if(client && !socket.connected) {
|
||||
if(client && !socket_connected) {
|
||||
add_ajax(id, title, duration, playlist, num, full_num, start, end);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user