66 lines
2.6 KiB
HTML
66 lines
2.6 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="de">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<title>AeroMC-Schnellstart</title>
|
||
<style>
|
||
body { font-family: "Segoe UI", sans-serif; font-size: 13px; color: #d8d8d8; background: #2d2d2d; margin: 0; padding: 12px; }
|
||
label { display: block; margin-bottom: 4px; color: #a8a8a8; }
|
||
select { width: 100%; padding: 6px; background: #3d3d3d; color: #fff; border: 1px solid #555; border-radius: 4px; }
|
||
.hint { margin-top: 10px; color: #8a8a8a; font-size: 12px; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<label for="wahl">Schnellstart-Platz (Strg+Zahl in AeroMC)</label>
|
||
<select id="wahl"><option value="">Lade …</option></select>
|
||
<p class="hint" id="hinweis"></p>
|
||
<script>
|
||
let ws, uuid, aktion, einstellungen = {}, wiederholung = null;
|
||
|
||
function frage() {
|
||
if (ws.readyState === 1) ws.send(JSON.stringify({ event: 'sendToPlugin', action: aktion, context: uuid, payload: { frage: 'liste' } }));
|
||
}
|
||
|
||
function fuelle(p) {
|
||
if (p.erreichbar) { clearInterval(wiederholung); wiederholung = null; }
|
||
else if (!wiederholung) wiederholung = setInterval(frage, 2000);
|
||
const sel = document.getElementById('wahl');
|
||
const hinweis = document.getElementById('hinweis');
|
||
sel.innerHTML = '';
|
||
if (!p.erreichbar) {
|
||
sel.innerHTML = '<option value="">AeroMC nicht erreichbar</option>';
|
||
hinweis.textContent = 'AeroMC starten und unter Optionen → Allgemein „Stream Deck erlauben“ einschalten. Dieses Fenster aktualisiert sich dann selbst.';
|
||
return;
|
||
}
|
||
hinweis.textContent = '';
|
||
const namen = Object.fromEntries(p.instanzen.map((i) => [i.id, i.name]));
|
||
for (const n of ['1', '2', '3', '4', '5']) {
|
||
const o = document.createElement('option');
|
||
o.value = n;
|
||
o.textContent = 'Strg+' + n + ' – ' + (namen[p.schnellstart[n]] || 'nicht belegt');
|
||
sel.appendChild(o);
|
||
}
|
||
if (!einstellungen.slot) einstellungen.slot = '1';
|
||
sel.value = einstellungen.slot || '';
|
||
}
|
||
|
||
function connectElgatoStreamDeckSocket(port, inUUID, registerEvent, info, actionInfo) {
|
||
uuid = inUUID;
|
||
const a = JSON.parse(actionInfo);
|
||
aktion = a.action;
|
||
einstellungen = (a.payload && a.payload.settings) || {};
|
||
ws = new WebSocket('ws://127.0.0.1:' + port);
|
||
ws.onopen = () => { ws.send(JSON.stringify({ event: registerEvent, uuid })); frage(); };
|
||
ws.onmessage = (e) => {
|
||
const m = JSON.parse(e.data);
|
||
if (m.event === 'sendToPropertyInspector') fuelle(m.payload || {});
|
||
};
|
||
document.getElementById('wahl').addEventListener('change', (ev) => {
|
||
einstellungen.slot = ev.target.value;
|
||
ws.send(JSON.stringify({ event: 'setSettings', context: uuid, payload: einstellungen }));
|
||
});
|
||
}
|
||
</script>
|
||
</body>
|
||
</html>
|