X-Git-Url: https://git.sesse.net/?p=remoteglot;a=blobdiff_plain;f=www%2Fserve-analysis.js;h=751a0ffc0b5c6e7c672556855ed8c41219d57e31;hp=948ea967c643b5fec2eddd67d02be9606b14f0fe;hb=9d0e6d5379e906fb387e5a48982f3dc6d76cefdb;hpb=9386e66cca3bbde38e9d59941a3b3cd1ed736913 diff --git a/www/serve-analysis.js b/www/serve-analysis.js index 948ea96..751a0ff 100644 --- a/www/serve-analysis.js +++ b/www/serve-analysis.js @@ -13,6 +13,7 @@ var delta = require('./js/json_delta.js'); // Constants. var JSON_FILENAME = '/srv/analysis.sesse.net/www/analysis.json'; var HISTORY_TO_KEEP = 5; +var MINIMUM_VERSION = null; // If set to 1, we are already processing a JSON update and should not // start a new one. If set to 2, we are _also_ having one in the queue. @@ -93,8 +94,8 @@ var create_json_historic_diff = function(new_json, history_left, new_diff_json, zlib.gzip(diff_text, function(err, buffer) { if (err) throw err; new_diff_json[histobj.last_modified] = { - plain: diff, - text: diff_text, + parsed: diff, + plain: diff_text, gzip: buffer, last_modified: new_json.last_modified, }; @@ -186,15 +187,19 @@ var send_json = function(response, ims, accept_gzip, num_viewers) { 'Vary': 'Accept-Encoding', }; + if (MINIMUM_VERSION) { + headers['X-RGMV'] = MINIMUM_VERSION; + } + if (accept_gzip) { headers['Content-Length'] = this_json.gzip.length; headers['Content-Encoding'] = 'gzip'; response.writeHead(200, headers); response.write(this_json.gzip); } else { - headers['Content-Length'] = this_json.text.length; + headers['Content-Length'] = this_json.plain.length; response.writeHead(200, headers); - response.write(this_json.text); + response.write(this_json.plain); } response.end(); }