X-Git-Url: https://git.sesse.net/?p=remoteglot;a=blobdiff_plain;f=www%2Fjs%2Fremoteglot.js;h=6844428dc8ee617151e3266c77f8629fbb22a5c5;hp=440419fd0062eb702e5f928655b1e22b0092ef13;hb=9d0e6d5379e906fb387e5a48982f3dc6d76cefdb;hpb=32831fbc835791a4b4e384cc363cdbaf4511c012 diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js index 440419f..6844428 100644 --- a/www/js/remoteglot.js +++ b/www/js/remoteglot.js @@ -1,5 +1,14 @@ (function() { +/** + * Version of this script. If the server returns a version larger than + * this, it is a sign we should reload to upgrade ourselves. + * + * @type {Number} + * @const + * @private */ +var SCRIPT_VERSION = 2015062103; + /** @type {window.ChessBoard} @private */ var board = null; @@ -144,6 +153,13 @@ var request_update = function() { } else { new_data = data; } + + var minimum_version = xhr.getResponseHeader('X-RGMV'); + if (minimum_version && minimum_version > SCRIPT_VERSION) { + // Upgrade to latest version with a force-reload. + location.reload(true); + } + possibly_play_sound(current_analysis_data, new_data); current_analysis_data = new_data; update_board(current_analysis_data, displayed_analysis_data);