From: Steinar H. Gunderson Date: Tue, 22 Mar 2016 09:49:20 +0000 (+0100) Subject: Add support for switching /hash backends when switching regular backends at the same... X-Git-Url: https://git.sesse.net/?p=remoteglot;a=commitdiff_plain;h=77b0976da398bcb6cd8e8df77133ce16a1dfdc2f Add support for switching /hash backends when switching regular backends at the same time. --- diff --git a/remoteglot.pl b/remoteglot.pl index 11c5d41..b466d4d 100755 --- a/remoteglot.pl +++ b/remoteglot.pl @@ -929,7 +929,8 @@ sub output_json { push @games, { id => $ref->{'id'}, name => "$white–$black", - url => $ref->{'url'} + url => $ref->{'url'}, + hashurl => $ref->{'hash_url'}, }; }; if ($@) { diff --git a/remoteglot.sql b/remoteglot.sql index 7d06b35..af0456f 100644 --- a/remoteglot.sql +++ b/remoteglot.sql @@ -19,5 +19,6 @@ CREATE TABLE current_games ( id varchar not null primary key, json_path varchar not null, url varchar not null, + hashurl varchar not null, priority integer not null default 0, ); diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js index 7ad1ff0..bff8e9c 100644 --- a/www/js/remoteglot.js +++ b/www/js/remoteglot.js @@ -912,7 +912,7 @@ var possibly_switch_game_from_hash = function() { for (var i = 0; i < current_games.length; ++i) { if (current_games[i]['id'] === hash) { if (backend_url !== current_games[i]['url']) { - switch_backend(current_games[i]['url']); + switch_backend(current_games[i]['url'], current_games[i]['hashurl']); } return; } @@ -1999,7 +1999,7 @@ var compute_score_sort_key = function(score, invert) { /** * @param {string} new_backend_url */ -var switch_backend = function(new_backend_url) { +var switch_backend = function(new_backend_url, new_backend_hash_url) { // Stop looking at historic data. current_display_line = null; current_display_move = null; @@ -2029,6 +2029,7 @@ var switch_backend = function(new_backend_url) { // Request an immediate fetch with the new backend. backend_url = new_backend_url; + backend_hash_url = new_backend_hash_url; current_analysis_data = null; ims = 0; request_update();