From b4498c56489f3accf18014c17b771fa61e7888b9 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Wed, 12 Jul 2023 12:18:22 +0200 Subject: [PATCH] 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. --- www/analysis.pl | 0 www/index.dev.html | 2 +- www/js/remoteglot.js | 5 +++++ 3 files changed, 6 insertions(+), 1 deletion(-) mode change 100755 => 100644 www/analysis.pl 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(); -- 2.39.2