feat(satellite): APK-Rollout per ADB — Fire TV & Android aus der Ferne bespielen
Der Satellit kann Android-Geraete im LAN erkennen und die Agent-APK ausrollen, statt sie von Hand aufs Geraet zu kopieren. - satellite.py: adb.devices/connect/install/shell. _apk_fetch laedt die APK per HTTP (gecached in /data/apk, sha256 optional) statt sie durchs RVS zu schicken — der RVS ist ein BROADCAST-Relay (jede base64-APK ginge an alle Clients, und das Satelliten-max_size liegt bei 8 MB). adb.install ist selbstheilend (connect -> install -r) und uebersetzt die typischen Fehler in klare Ansagen (unauthorized, Signatur-Mismatch, Speicher voll). Imports lokal in den Funktionen (Hausmuster). - Discovery: mDNS-Typen _amzn-wplay/_adb-tls-connect/_androidtvremote2, _mdns_kind -> firetv/android-adb/androidtv, plus _enrich_adb (TCP-Probe 5555) -> adbCapable. - Dockerfile: adb; compose: HOME=/data (ADB-Key persistent, sonst fragt das Geraet nach jedem Rebuild neu) + ANDROID_ADB_SERVER_PORT=5038 (Host-Kollision). - .env.example: neue Aktionen + Warnung, dass die Allowlist den Code-Default ueberschreibt (sonst lehnt ein bestehender Satellit adb.* ab). - Brain: adb.* in der satellite_command-Beschreibung; WICHTIG Timeout 200s fuer adb.*/ssh.exec — der Bridge-Default von 20s haette jede Installation abgewuergt. - Diagnostic: sat_command (Browser->RVS) und sat_result (RVS->Browser) gab es bisher GAR NICHT; beide ergaenzt. 📦-Button je ADB-faehigem Geraet + Rollout- Modal mit Status/Log, ADB-Tag in der Geraeteliste. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+79
-1
@@ -1594,6 +1594,36 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- APK-Rollout-Modal (Agent auf Fire TV / Android-Gerät installieren) -->
|
||||
<div class="modal-overlay" id="apk-modal">
|
||||
<div class="modal-box" style="max-width:620px;">
|
||||
<div class="modal-header">
|
||||
<h3 id="apk-title">ARIA-Agent ausrollen</h3>
|
||||
<button class="modal-close" onclick="closeApkDeploy()">×</button>
|
||||
</div>
|
||||
<div class="modal-body" style="padding:16px;font-size:13px;color:#E0E0F0;">
|
||||
<div style="color:#8888AA;margin-bottom:10px;">
|
||||
Installiert die Agent-App per ADB über das Netzwerk. Voraussetzung am Gerät:
|
||||
<strong>ADB-Debugging aktiv</strong> (Fire TV: Einstellungen › Mein Fire TV ›
|
||||
Entwickleroptionen) — beim ersten Mal erscheint dort ein Dialog
|
||||
„USB-Debugging zulassen?", den Du bestätigen musst.
|
||||
</div>
|
||||
<label style="display:block;margin-bottom:4px;color:#8888AA;">APK-URL</label>
|
||||
<input id="apk-url" type="text" style="width:100%;padding:6px;background:#0D0D1A;border:1px solid #1E1E2E;border-radius:4px;color:#E0E0F0;"
|
||||
placeholder="https://…/aria-host-agent-android-agent-v0.0.1.0.apk">
|
||||
<div style="color:#666;font-size:11px;margin-top:4px;">
|
||||
Aus dem Gitea-Release. Der Satellit lädt die Datei selbst (einmal) und
|
||||
installiert sie auf dem Gerät.
|
||||
</div>
|
||||
<div style="margin-top:14px;">
|
||||
<button class="btn" onclick="runApkDeploy()">📦 Jetzt ausrollen</button>
|
||||
<span id="apk-status" style="margin-left:10px;color:#8888AA;"></span>
|
||||
</div>
|
||||
<pre id="apk-log" style="margin-top:12px;background:#0D0D1A;border-radius:6px;padding:10px;max-height:240px;overflow:auto;white-space:pre-wrap;color:#8888AA;font-size:12px;display:none;"></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Agent-Historie-Modal (Befehle + Screenshots pro Nachricht) -->
|
||||
<div class="modal-overlay" id="agent-history-modal">
|
||||
<div class="modal-box" style="max-width:760px;">
|
||||
@@ -2199,6 +2229,7 @@
|
||||
}
|
||||
if (msg.type === 'host_update') { hosts = msg.hosts || []; renderHosts(); return; }
|
||||
if (msg.type === 'rooms_info') { rooms = (msg.payload && msg.payload.rooms) || []; renderRooms(); return; }
|
||||
if (msg.type === 'sat_result') { onSatResult(msg.payload || {}); return; }
|
||||
if (msg.type === 'agent_history_list') {
|
||||
if (agentHistoryHost && msg.payload && msg.payload.host === agentHistoryHost) {
|
||||
renderAgentHistory(msg.payload.events || []);
|
||||
@@ -4680,6 +4711,47 @@
|
||||
'</div>';
|
||||
}).join('');
|
||||
}
|
||||
// ── APK-Rollout auf Android/Fire TV (per Satellit + ADB) ─────────
|
||||
let apkTarget = null; // {satId, ip, name}
|
||||
let apkRequestId = null;
|
||||
|
||||
function openApkDeploy(satId, ip, name) {
|
||||
apkTarget = { satId, ip, name };
|
||||
document.getElementById('apk-title').textContent = 'ARIA-Agent ausrollen → ' + name;
|
||||
document.getElementById('apk-status').textContent = '';
|
||||
const log = document.getElementById('apk-log');
|
||||
log.style.display = 'none'; log.textContent = '';
|
||||
document.getElementById('apk-modal').classList.add('open');
|
||||
}
|
||||
function closeApkDeploy() {
|
||||
document.getElementById('apk-modal').classList.remove('open');
|
||||
apkTarget = null; apkRequestId = null;
|
||||
}
|
||||
function runApkDeploy() {
|
||||
if (!apkTarget) return;
|
||||
const url = document.getElementById('apk-url').value.trim();
|
||||
if (!url) { document.getElementById('apk-status').textContent = 'APK-URL fehlt'; return; }
|
||||
apkRequestId = 'apk_' + Date.now() + '_' + Math.floor(Math.random() * 100000);
|
||||
document.getElementById('apk-status').textContent = 'läuft … (kann 1–2 Minuten dauern)';
|
||||
send({ action: 'sat_command', satellite: apkTarget.satId, cmd: 'adb.install',
|
||||
requestId: apkRequestId, params: { ip: apkTarget.ip, url } });
|
||||
}
|
||||
function onSatResult(p) {
|
||||
if (!apkRequestId || !p || p.requestId !== apkRequestId) return;
|
||||
const status = document.getElementById('apk-status');
|
||||
const log = document.getElementById('apk-log');
|
||||
log.style.display = 'block';
|
||||
if (p.ok) {
|
||||
const r = p.result || {};
|
||||
status.innerHTML = '<span style="color:#34C759;">✓ erfolgreich</span>';
|
||||
log.textContent = r.message || JSON.stringify(r, null, 2);
|
||||
} else {
|
||||
status.innerHTML = '<span style="color:#FF6E6E;">✗ fehlgeschlagen</span>';
|
||||
log.textContent = p.error || 'Unbekannter Fehler';
|
||||
}
|
||||
apkRequestId = null;
|
||||
}
|
||||
|
||||
// ── Agent-Historie (Befehle + Screenshots pro Nachricht) ──────────
|
||||
let agentHistoryHost = null;
|
||||
|
||||
@@ -4788,18 +4860,24 @@
|
||||
if (d.model) tags.push(escapeHtml(d.model));
|
||||
if (d.snmp && d.snmp.descr) tags.push(escapeHtml(String(d.snmp.descr).slice(0, 40)));
|
||||
if (d.dialAppUrl) tags.push('DIAL');
|
||||
if (d.adbCapable) tags.push('ADB');
|
||||
if (d.mac) tags.push(escapeHtml(d.mac));
|
||||
const tagStr = tags.length ? ' <span style="color:#666;">(' + tags.join(' · ') + ')</span>' : '';
|
||||
const hasCreds = d.ip && (satCreds[s.id] || {})[d.ip] && (satCreds[s.id][d.ip] || []).length;
|
||||
const keyBtn = d.ip ? '<button class="btn secondary" title="Zugangsdaten (SNMP / HTTP / FritzBox)" ' +
|
||||
'onclick="openDeviceCreds(\'' + escapeHtml(s.id) + '\',\'' + escapeHtml(d.ip) + '\',\'' + escapeHtml(d.name || d.ip) + '\')" ' +
|
||||
'style="padding:1px 6px;font-size:11px;margin-left:8px;">' + (hasCreds ? '🔑 ✓' : '🔑') + '</button>' : '';
|
||||
// APK ausrollen: bei ADB-faehigen Geraeten (Fire TV & Co.).
|
||||
const canAdb = d.ip && (d.adbCapable || ['firetv', 'android', 'android-adb', 'androidtv', 'dial'].includes(d.type));
|
||||
const apkBtn = canAdb ? '<button class="btn secondary" title="ARIA-Agent (APK) auf dieses Gerät ausrollen" ' +
|
||||
'onclick="openApkDeploy(\'' + escapeHtml(s.id) + '\',\'' + escapeHtml(d.ip) + '\',\'' + escapeHtml(d.name || d.ip) + '\')" ' +
|
||||
'style="padding:1px 6px;font-size:11px;margin-left:6px;">📦</button>' : '';
|
||||
return '<div style="padding:3px 6px;background:#0D0D1A;border-radius:4px;display:flex;align-items:center;">' +
|
||||
'<div style="flex:1;min-width:0;">' +
|
||||
'<span style="color:#E0E0F0;">' + escapeHtml(d.name || d.id || '?') + '</span> ' +
|
||||
'<span style="color:#0096FF;">[' + escapeHtml(d.type || '?') + ']</span> ' +
|
||||
'<span style="color:#8888AA;">' + escapeHtml(d.ip || '') + '</span>' + tagStr +
|
||||
'</div>' + keyBtn +
|
||||
'</div>' + keyBtn + apkBtn +
|
||||
'</div>';
|
||||
}).join('') + '</div>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user