From: Steinar H. Gunderson Date: Wed, 12 Jul 2023 10:18:22 +0000 (+0200) Subject: Send the first JSON inline. X-Git-Url: https://git.sesse.net/?p=remoteglot;a=commitdiff_plain;h=b4498c56489f3accf18014c17b771fa61e7888b9 Send the first JSON inline. This removes a round-trip, although it's probably slightly less bandwidth-efficient and definitely more complex. You'll need to make Varnish rewrite / to /index-inline.html and send it to the backend. It doesn't work on the .dev version, unfortunately. --- diff --git a/www/analysis.pl b/www/analysis.pl old mode 100755 new mode 100644 diff --git a/www/index.dev.html b/www/index.dev.html index a8c02a7..4562b48 100644 --- a/www/index.dev.html +++ b/www/index.dev.html @@ -11,7 +11,7 @@ - + diff --git a/www/js/remoteglot.js b/www/js/remoteglot.js index ae522e2..e14fffa 100644 --- a/www/js/remoteglot.js +++ b/www/js/remoteglot.js @@ -2482,6 +2482,11 @@ function init() { document.getElementById("board").addEventListener('mousedown', mousedownSquare); document.getElementById("board").addEventListener('mouseup', mouseupSquare); + if (window['inline_json']) { + let j = window['inline_json']; + process_update_response(j['data'], { 'get': (h) => j['headers'][h] }); + delete window['inline_json']; + } request_update(); window.addEventListener('resize', function() { board.resize();