From f571d3543b356e968645f3b6dfdd2c82b8e1404c Mon Sep 17 00:00:00 2001 From: siinus Date: Thu, 3 Feb 2022 04:42:51 +0200 Subject: [PATCH 1/3] Cleanup, fix code, modernize, reformat, dark mode --- www/index.html | 345 ++++++++++++++++++++++--------------------------- 1 file changed, 155 insertions(+), 190 deletions(-) diff --git a/www/index.html b/www/index.html index 5f97e26..335c238 100644 --- a/www/index.html +++ b/www/index.html @@ -1,202 +1,167 @@ - - - - - - + } + - - - - -

Viido

- - Mopidy music
- VNC remote desktop
- -

Projektori juhtimine

- -
- - - - - -
-

Sisendi juhtimine

- -
- - - - - - - - - - -
-
-
- - - - - - - - -
-

Linux audio tunnel

- -pacmd load-module module-tunnel-sink-new server=viido -PULSE_SERVER=viido pavucontrol & -pavucontrol & - - -
- - + http.send('mode=' + value); + } + + + + +

Viido

+
+ VNC remote desktop +
+ +

Projektori juhtimine

+ +
+ + +
+ +

Sisendi juhtimine

+
+ + + + + + +
+ +

Linux audio tunnel

+ + pacmd load-module module-tunnel-sink-new server=viido + PULSE_SERVER=viido pavucontrol & + pavucontrol & + + +
+ + From d1dfde7652eb4edc727c5582a2b29176529442de Mon Sep 17 00:00:00 2001 From: siinus Date: Thu, 3 Feb 2022 07:41:45 +0200 Subject: [PATCH 2/3] Add projector lamp indicators --- nginx/default | 13 ++++++++----- www/index.html | 29 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/nginx/default b/nginx/default index d32b58a..faa90d7 100644 --- a/nginx/default +++ b/nginx/default @@ -91,12 +91,15 @@ server { location /projektor/ { proxy_pass http://127.0.0.1:6999/; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Scheme $scheme; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Scheme $scheme; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } + location /projector/ { + proxy_pass http://projektor.kontor.lapikud.ee/cgi-bin/; } } diff --git a/www/index.html b/www/index.html index 335c238..c9d425b 100644 --- a/www/index.html +++ b/www/index.html @@ -28,6 +28,10 @@ color: black; } + .center { + text-align: center; + } + .button-grid { display: grid; grid-auto-columns: 1fr; @@ -136,6 +140,7 @@ +

Sisendi juhtimine

@@ -162,6 +167,30 @@ send_mode(event.target.value); }); } + + function query_projector(request_string, closure) { + const xhr = new XMLHttpRequest(); + xhr.open('GET', '/projector/pjctrl.cgi.elf?D=' + request_string, true) + xhr.overrideMimeType('text/plain'); + xhr.onreadystatechange = function () { + if (xhr.readyState === 4) { + let data = JSON.parse(xhr.response.replace(',]', ']')); + if ((data[0] & 0x80) === 0) { + closure(data); + } + } + }; + xhr.send(); + } + + query_projector('%07%03%96%00%00%02%00%01H', function (data) { + const used = ((data[10] << 24) | (data[9] << 16) | (data[8] << 8) | data[7]) / 3600; + document.getElementById('projector_lamp_hours').innerText = + 'Lambi läbisõit ' + Math.round(used) + 'h. '; + }); + query_projector('%07%03%96%00%00%02%00%04H', function (data) { + document.getElementById('projector_lamp_remaining').innerText = 'Alles jäänud ' + data[7] + '%'; + }); From 018e5e6ad0e168e3288b2030796d71b06f6babfe Mon Sep 17 00:00:00 2001 From: siinus Date: Thu, 3 Feb 2022 08:15:40 +0200 Subject: [PATCH 3/3] Hide audio tunnel commands by default --- www/index.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/www/index.html b/www/index.html index c9d425b..e6c5272 100644 --- a/www/index.html +++ b/www/index.html @@ -152,8 +152,11 @@
-

Linux audio tunnel

- +

+
+ +
+ pacmd load-module module-tunnel-sink-new server=viido PULSE_SERVER=viido pavucontrol & pavucontrol & @@ -161,6 +164,12 @@