mirror of
https://github.com/Lapikud/Viido.git
synced 2026-03-23 13:14:19 +00:00
Merge pull request #6 from Lapikud/year-2022
This commit is contained in:
@@ -96,7 +96,10 @@ server {
|
|||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection "upgrade";
|
||||||
|
}
|
||||||
|
|
||||||
|
location /projector/ {
|
||||||
|
proxy_pass http://projektor.kontor.lapikud.ee/cgi-bin/;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
233
www/index.html
233
www/index.html
@@ -1,9 +1,9 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html lang="et">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta content="width=device-width, initial-scale=1" name="viewport">
|
||||||
|
<title>Viido</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
margin: 40px auto;
|
margin: 40px auto;
|
||||||
@@ -12,92 +12,67 @@
|
|||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
color: #444;
|
color: #444;
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
font-family: Helvetica, Arial, Sans-Serif;
|
font-family: Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
font-family: Helvetica, Arial, sans-serif;
|
||||||
|
line-height: 1.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
text-align:center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button {
|
|
||||||
background-color: #4CAF50; /* Green */
|
|
||||||
border: none;
|
|
||||||
color: white;
|
|
||||||
padding: 16px 0;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
text-decoration: none;
|
|
||||||
display: inline-block;
|
|
||||||
font-size: 32px;
|
|
||||||
margin: 4px -2px;
|
|
||||||
-webkit-transition-duration: 0.4s; /* Safari */
|
|
||||||
transition-duration: 0.4s;
|
|
||||||
cursor: pointer;
|
|
||||||
width:100%;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.button1 {
|
|
||||||
background-color: white;
|
a:any-link {
|
||||||
color: black;
|
color: black;
|
||||||
border: 2px solid #4CAF50;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.button2 {
|
.center {
|
||||||
background-color: green;
|
text-align: center;
|
||||||
color: black;
|
|
||||||
border: 2px solid #4CAF50;
|
|
||||||
width:33%
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.radio-toolbar {
|
.button-grid {
|
||||||
display: flex;
|
display: grid;
|
||||||
flex-direction: row;
|
grid-auto-columns: 1fr;
|
||||||
width: 100%;
|
gap: 8px;
|
||||||
flex-wrap: wrap;
|
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-webkit-user-select: none; /* Chrome all / Safari all */
|
-webkit-user-select: none; /* Chrome all / Safari all */
|
||||||
-moz-user-select: none; /* Firefox all */
|
-moz-user-select: none; /* Firefox all */
|
||||||
-ms-user-select: none; /* IE 10+ */
|
|
||||||
user-select: none; /* Likely future */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.radio-toolbar input[type="button"] {
|
.button-grid :nth-child(2) {
|
||||||
display: none;
|
grid-column: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.radio-toolbar label {
|
.button-grid :nth-child(3) {
|
||||||
background-color: white; /* RED */
|
grid-column: 3;
|
||||||
border: none;
|
}
|
||||||
color: black;
|
|
||||||
|
.button-grid * {
|
||||||
|
background-color: transparent;
|
||||||
padding: 12px 0;
|
padding: 12px 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
display: inline-block;
|
|
||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
margin: 0 4px;
|
|
||||||
-webkit-transition-duration: 0.4s; /* Safari */
|
-webkit-transition-duration: 0.4s; /* Safari */
|
||||||
transition-duration: 0.4s;
|
transition-duration: 0.4s;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
flex: 1 0 auto;
|
|
||||||
border: 2px solid #4CAF50;
|
border: 2px solid #4CAF50;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rbnt{
|
.button-grid *:hover {
|
||||||
width: 30%;
|
|
||||||
transition-duration: 0s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.rbnt:active{
|
|
||||||
background-color: #4CAF50;
|
background-color: #4CAF50;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
.radio-toolbar lable.red {
|
|
||||||
|
.button-grid *.red {
|
||||||
border: 2px solid #af4c4c;
|
border: 2px solid #af4c4c;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button1:hover {
|
.button-grid *.red:hover {
|
||||||
background-color: #4CAF50;
|
background-color: #af4c4c;
|
||||||
color: white;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
@@ -105,8 +80,7 @@
|
|||||||
margin-top: 2em;
|
margin-top: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#loading
|
#loading {
|
||||||
{
|
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -118,85 +92,114 @@
|
|||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (prefers-color-scheme: dark) {
|
||||||
|
body {
|
||||||
|
background-color: #111;
|
||||||
|
color: #BBB;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
color: #BBB;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:any-link {
|
||||||
|
color: #BBB;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function show_loading(visible)
|
function show_loading(visible) {
|
||||||
{
|
|
||||||
document.getElementById('loading').style.visibility = visible ? 'visible' : 'hidden';
|
document.getElementById('loading').style.visibility = visible ? 'visible' : 'hidden';
|
||||||
}
|
}
|
||||||
|
|
||||||
function send_mode(value)
|
function send_mode(value) {
|
||||||
{
|
|
||||||
show_loading(true);
|
show_loading(true);
|
||||||
var http = new XMLHttpRequest();
|
const http = new XMLHttpRequest();
|
||||||
http.open('POST', '/projektor/status', true);
|
http.open('POST', '/projektor/status', true);
|
||||||
http.onreadystatechange = function() {
|
http.onreadystatechange = function () {
|
||||||
if (http.readyState == 4 && http.status == 200) {
|
if (http.readyState === 4 && http.status === 200) {
|
||||||
show_loading(false);
|
show_loading(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
http.send('mode=' + value);
|
http.send('mode=' + value);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1>Viido</h1>
|
<h1>Viido</h1>
|
||||||
|
<div class="button-grid">
|
||||||
|
<a class="button" href="vnc">VNC remote desktop</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<a href="iris" class="button button1">Mopidy music</a><br />
|
<h2 class="title">Projektori juhtimine</h2>
|
||||||
<a href="vnc" class="button button1">VNC remote desktop</a><br />
|
|
||||||
|
|
||||||
<h2 class="title">Projektori juhtimine</h2>
|
<div class="button-grid">
|
||||||
|
<button class="red" name="projektor" value="off">OFF</button>
|
||||||
|
<button name="projektor" value="on">ON</button>
|
||||||
|
</div>
|
||||||
|
<p class="center"><span id="projector_lamp_hours"></span><span id="projector_lamp_remaining"></span></p>
|
||||||
|
|
||||||
<div class="radio-toolbar">
|
<h2 class="title">Sisendi juhtimine</h2>
|
||||||
<input type="button" id="power1" name="power" value="off">
|
<div class="button-grid">
|
||||||
<label for="power1" class="red">OFF</label>
|
<button name="projektor" value="viido">Viido</button>
|
||||||
|
<button name="projektor" value="steam">Steam</button>
|
||||||
|
<button name="projektor" value="volumeup">Vol +</button>
|
||||||
|
<button name="projektor" value="hdmi">HDMI</button>
|
||||||
|
<button name="projektor" value="aux">AUX</button>
|
||||||
|
<button name="projektor" value="volumedown">Vol -</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<input type="button" id="power2" name="power" value="on">
|
<h2 class="title"></h2>
|
||||||
<label for="power2">ON</label>
|
<div class="button-grid">
|
||||||
</div>
|
<button id="audio_tunnel_toggle">Linux audio tunnel</button>
|
||||||
<h2 class="title">Sisendi juhtimine</h2>
|
</div>
|
||||||
|
<code id="audio_tunnel">
|
||||||
|
pacmd load-module module-tunnel-sink-new server=viido
|
||||||
|
PULSE_SERVER=viido pavucontrol &
|
||||||
|
pavucontrol &
|
||||||
|
</code>
|
||||||
|
|
||||||
<div class="radio-toolbar">
|
<div id="loading"></div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
const audio_tunnel = document.getElementById('audio_tunnel');
|
||||||
|
audio_tunnel.hidden = true;
|
||||||
|
document.getElementById('audio_tunnel_toggle').addEventListener('click', function () {
|
||||||
|
audio_tunnel.hidden = !audio_tunnel.hidden;
|
||||||
|
});
|
||||||
|
|
||||||
<input type="button" id="r2" name="receiver" value="viido">
|
const modeButtons = document.querySelectorAll('button[name="projektor"]');
|
||||||
<label class="rbnt" for="r2">Viido</label>
|
for (let i = 0; i < modeButtons.length; i++) {
|
||||||
|
modeButtons[i].addEventListener('click', function (event) {
|
||||||
<input type="button" id="r3" name="receiver" value="steam">
|
|
||||||
<label class="rbnt" for="r3">Steam</label>
|
|
||||||
|
|
||||||
<input type="button" id="v1" name="receiver" value="volumeup">
|
|
||||||
<label class="rbnt" for="v1">Vol +</label>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<br>
|
|
||||||
<div class="radio-toolbar">
|
|
||||||
<input type="button" id="r4" name="receiver" value="hdmi">
|
|
||||||
<label class="rbnt" for="r4">HDMI</label>
|
|
||||||
|
|
||||||
<input type="button" id="r5" name="receiver" value="aux">
|
|
||||||
<label class="rbnt" for="r5">AUX</label>
|
|
||||||
|
|
||||||
<input type="button" id="v2" name="receiver" value="volumedown">
|
|
||||||
<label class="rbnt" for="v2">Vol -</label>
|
|
||||||
</div>
|
|
||||||
<h2 class="title">Linux audio tunnel</h2>
|
|
||||||
<code>
|
|
||||||
pacmd load-module module-tunnel-sink-new server=viido
|
|
||||||
PULSE_SERVER=viido pavucontrol &
|
|
||||||
pavucontrol &
|
|
||||||
</code>
|
|
||||||
|
|
||||||
<div id="loading"></div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var modebuttons = document.querySelectorAll('.radio-toolbar input');
|
|
||||||
for (var i = 0; i < modebuttons.length; i++)
|
|
||||||
{
|
|
||||||
modebuttons[i].addEventListener('click', function(event) {
|
|
||||||
send_mode(event.target.value);
|
send_mode(event.target.value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
</script>
|
|
||||||
</body>
|
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] + '%';
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user