From 0e47d5c4bc285129693e579fe9f7128ff7df7b5b Mon Sep 17 00:00:00 2001 From: Nofre Date: Tue, 2 Feb 2016 18:47:53 +0100 Subject: [PATCH] Dirble's token fix --- htdocs/js/mpd.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index 51e8fdc..ceb523b 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -16,6 +16,8 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +var TOKEN = ""; + var socket; var last_state; var last_outputs; @@ -106,6 +108,9 @@ var app = $.sammy(function() { this.get(/\#\/dirble\/(\d+)\/(\d+)/, function() { + + if (TOKEN === "") context.redirect("#/0"); + prepare(); current_app = 'dirble'; $('#breadcrump').removeClass('hide').empty().append("
  • Categories
  • "+dirble_selected_cat+"
  • "); @@ -131,6 +136,9 @@ var app = $.sammy(function() { this.get(/\#\/dirble\//, function() { + + if (TOKEN === "") context.redirect("#/0"); + prepare(); current_app = 'dirble'; $('#breadcrump').removeClass('hide').empty().append("
  • Categories
  • "); @@ -177,6 +185,9 @@ $(document).ready(function(){ else if ($.cookie("notification") === "true") $('#btnnotify').addClass("active") + + if (TOKEN === "") $('#dirble').addClass('hide'); + }); @@ -764,7 +775,7 @@ function dirble_load_categories() { dirble_page = 1; - $.getJSON( "http://api.dirble.com/v2/categories?token=2e223c9909593b94fc6577361a", function( data ) { + $.getJSON( "http://api.dirble.com/v2/categories?token="+TOKEN, function( data ) { $('#dirble_loading').addClass('hide'); @@ -812,7 +823,7 @@ function dirble_load_categories() { function dirble_load_stations() { - $.getJSON( "http://api.dirble.com/v2/category/"+dirble_catid+"/stations?page="+dirble_page+"&per_page=20&token=2e223c9909593b94fc6577361a", function( data ) { + $.getJSON( "http://api.dirble.com/v2/category/"+dirble_catid+"/stations?page="+dirble_page+"&per_page=20&token="+TOKEN, function( data ) { $('#dirble_loading').addClass('hide'); if (data.length == 20) $('#next').removeClass('hide'); @@ -839,7 +850,7 @@ function dirble_load_stations() { click: function() { var _this = $(this); - $.getJSON( "http://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token=2e223c9909593b94fc6577361a", function( data ) { + $.getJSON( "http://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token="+TOKEN, function( data ) { socket.send("MPD_API_ADD_TRACK," + data.streams[0].stream); $('.top-right').notify({ @@ -857,7 +868,7 @@ function dirble_load_stations() { "").find('a').click(function(e) { e.stopPropagation(); - $.getJSON( "http://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token=2e223c9909593b94fc6577361a", function( data ) { + $.getJSON( "http://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token="+TOKEN, function( data ) { socket.send("MPD_API_ADD_PLAY_TRACK," + data.streams[0].stream); $('.top-right').notify({ @@ -878,7 +889,7 @@ function dirble_load_stations() { click: function() { var _this = $(this); - $.getJSON( "http://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token=2e223c9909593b94fc6577361a", function( data ) { + $.getJSON( "http://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token="+TOKEN, function( data ) { socket.send("MPD_API_ADD_TRACK," + data.streams[0].stream); $('.top-right').notify({ @@ -896,7 +907,7 @@ function dirble_load_stations() { "").find('a').click(function(e) { e.stopPropagation(); - $.getJSON( "http://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token=2e223c9909593b94fc6577361a", function( data ) { + $.getJSON( "http://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token="+TOKEN, function( data ) { socket.send("MPD_API_ADD_PLAY_TRACK," + data.streams[0].stream); $('.top-right').notify({ -- 2.20.1