Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2aef0347ae | ||
|
|
a49c022308 | ||
|
|
2d3ba024a4 | ||
|
|
1c7157327c | ||
|
|
6c27097c96 | ||
|
|
a91325a04f | ||
|
|
ef826d1ed1 | ||
|
|
933836f0a6 | ||
|
|
e04d8f360b | ||
|
|
4685632294 | ||
|
|
769025c41b | ||
|
|
2005e9b85e | ||
|
|
25abd220ad |
@@ -79,8 +79,8 @@ android {
|
|||||||
applicationId "com.ariacockpit"
|
applicationId "com.ariacockpit"
|
||||||
minSdkVersion rootProject.ext.minSdkVersion
|
minSdkVersion rootProject.ext.minSdkVersion
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||||
versionCode 20204
|
versionCode 20209
|
||||||
versionName "0.2.2.4"
|
versionName "0.2.2.9"
|
||||||
// Fallback fuer Libraries mit Product Flavors
|
// Fallback fuer Libraries mit Product Flavors
|
||||||
missingDimensionStrategy 'react-native-camera', 'general'
|
missingDimensionStrategy 'react-native-camera', 'general'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "aria-cockpit",
|
"name": "aria-cockpit",
|
||||||
"version": "0.2.2.4",
|
"version": "0.2.2.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"android": "react-native run-android",
|
"android": "react-native run-android",
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
* Cockpit-Modus → Workbench mit Taskleisten-Dock: Chat · Code · Desktop.
|
* Cockpit-Modus → Workbench mit Taskleisten-Dock: Chat · Code · Desktop.
|
||||||
*
|
*
|
||||||
* Aktivitaets-Badges am Dock: Editor blau, wenn schon Code-Dateien da sind;
|
* Aktivitaets-Badges am Dock: Editor blau, wenn schon Code-Dateien da sind;
|
||||||
* Desktop gruen, wenn eine VM verbunden ist.
|
* Desktop gruen NUR, wenn im aktiven Projekt eine VM laeuft.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useEffect, useMemo, useState } from 'react';
|
import React, { useEffect, useMemo, useState } from 'react';
|
||||||
import projectFocus, { FocusSnapshot } from '../services/projectFocus';
|
import projectFocus, { FocusSnapshot } from '../services/projectFocus';
|
||||||
import codeFile from '../services/codeFile';
|
import codeFile from '../services/codeFile';
|
||||||
import desktop from '../services/desktop';
|
import brainApi from '../services/brainApi';
|
||||||
import viewMode, { ViewModeValue } from '../services/viewMode';
|
import viewMode, { ViewModeValue } from '../services/viewMode';
|
||||||
import ChatScreen from '../screens/ChatScreen';
|
import ChatScreen from '../screens/ChatScreen';
|
||||||
import { TileId } from './layout';
|
import { TileId } from './layout';
|
||||||
@@ -29,7 +29,6 @@ const WorkspaceScreen: React.FC = () => {
|
|||||||
useEffect(() => projectFocus.subscribe(setFocus), []);
|
useEffect(() => projectFocus.subscribe(setFocus), []);
|
||||||
|
|
||||||
const pid = focus.focusedProjectId;
|
const pid = focus.focusedProjectId;
|
||||||
const kind = projectFocus.getProjectKind(pid);
|
|
||||||
|
|
||||||
// Code-Signal: hat der Spiegel schon Dateien fuer dieses Projekt?
|
// Code-Signal: hat der Spiegel schon Dateien fuer dieses Projekt?
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -39,13 +38,21 @@ const WorkspaceScreen: React.FC = () => {
|
|||||||
});
|
});
|
||||||
}, [pid]);
|
}, [pid]);
|
||||||
|
|
||||||
// Desktop-Signal + einmaliger Check beim Betreten eines Code-Projekts.
|
// Desktop-Signal: gruener Punkt NUR, wenn im AKTIVEN Projekt wirklich eine VM
|
||||||
|
// laeuft (nicht generell irgendwo). Quelle ist die projektbezogene VM-Liste;
|
||||||
|
// leichtes Nachfassen, damit Start/Stop sich zeitnah zeigt.
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setHasDesktop(desktop.getStatus().available);
|
if (!pid) { setHasDesktop(false); return; }
|
||||||
const unsub = desktop.subscribeStatus((s) => setHasDesktop(s.available));
|
let alive = true;
|
||||||
if (kind === 'code') desktop.requestCheck(pid);
|
const check = () => {
|
||||||
return unsub;
|
brainApi.listProjectVms(pid)
|
||||||
}, [pid, kind]);
|
.then(r => { if (alive) setHasDesktop((r.vms || []).some(v => v.running)); })
|
||||||
|
.catch(() => { if (alive) setHasDesktop(false); });
|
||||||
|
};
|
||||||
|
check();
|
||||||
|
const t = setInterval(check, 6000);
|
||||||
|
return () => { alive = false; clearInterval(t); };
|
||||||
|
}, [pid]);
|
||||||
|
|
||||||
const badges = useMemo(() => ({
|
const badges = useMemo(() => ({
|
||||||
editor: hasCode ? '#0096FF' : undefined,
|
editor: hasCode ? '#0096FF' : undefined,
|
||||||
|
|||||||
@@ -77,14 +77,13 @@ export const NOVNC_HTML = `<!doctype html><html><head><meta charset="utf-8">
|
|||||||
|
|
||||||
var msg=document.getElementById('msg');
|
var msg=document.getElementById('msg');
|
||||||
|
|
||||||
// Verstecktes Eingabefeld → Software-Tastatur des Handys tippt in die VM.
|
// Tastatur laeuft NICHT mehr ueber ein verstecktes WebView-Feld (Android
|
||||||
var kbd=document.createElement('input');
|
// oeffnet die Software-Tastatur dafuer unzuverlaessig). Stattdessen haelt die
|
||||||
kbd.setAttribute('autocomplete','off'); kbd.setAttribute('autocorrect','off');
|
// App ein echtes RN-<TextInput> und ruft window.ariaVncKey.* per
|
||||||
kbd.setAttribute('autocapitalize','off'); kbd.spellcheck=false;
|
// injectJavaScript auf → wird unten (nach RFB-Init) definiert.
|
||||||
kbd.style.cssText='position:absolute;left:-1000px;top:0;width:1px;height:1px;opacity:0;';
|
// cp<0x100 → Keysym == Codepoint (Latin-1)
|
||||||
document.body.appendChild(kbd);
|
// sonst → X11-Unicode-Keysym 0x01000000+cp
|
||||||
var SPECIAL={Enter:0xff0d,Backspace:0xff08,Tab:0xff09,Escape:0xff1b,Delete:0xffff,
|
function cpToKeysym(cp){ return cp < 0x100 ? cp : 0x01000000 + cp; }
|
||||||
ArrowLeft:0xff51,ArrowUp:0xff52,ArrowRight:0xff53,ArrowDown:0xff54,Home:0xff50,End:0xff57};
|
|
||||||
|
|
||||||
import('https://cdn.jsdelivr.net/npm/@novnc/novnc@1.4.0/core/rfb.js').then(function(mod){
|
import('https://cdn.jsdelivr.net/npm/@novnc/novnc@1.4.0/core/rfb.js').then(function(mod){
|
||||||
var RFB = mod.default;
|
var RFB = mod.default;
|
||||||
@@ -99,19 +98,29 @@ export const NOVNC_HTML = `<!doctype html><html><head><meta charset="utf-8">
|
|||||||
});
|
});
|
||||||
window.__rfb = rfb;
|
window.__rfb = rfb;
|
||||||
|
|
||||||
// Tasten aus dem versteckten Feld an die VM schicken.
|
// Down+Up einer Taste an die VM schicken.
|
||||||
function tap(keysym, code){ try{ rfb.sendKey(keysym, code||null, true); rfb.sendKey(keysym, code||null, false); }catch(_){} }
|
function tap(keysym, code){ try{ rfb.sendKey(keysym, code||null, true); rfb.sendKey(keysym, code||null, false); }catch(_){} }
|
||||||
kbd.addEventListener('keydown', function(e){
|
|
||||||
if(SPECIAL[e.key]!==undefined){ tap(SPECIAL[e.key], e.code); e.preventDefault(); }
|
// Empfaenger-API: die App (RN-<TextInput> + Sondertasten-Leiste) ruft das
|
||||||
});
|
// per injectJavaScript.
|
||||||
kbd.addEventListener('input', function(){
|
// char(cp) druckbares Zeichen (Codepoint)
|
||||||
var v=kbd.value; for(var i=0;i<v.length;i++){ tap(v.charCodeAt(i)); } kbd.value='';
|
// keysym(ks) Sondertaste als fertiges X11-Keysym (Enter/Esc/F1/…)
|
||||||
});
|
// combo(mods,ks) Modifier(-Keysyms) halten → Taste → wieder loslassen
|
||||||
|
// (Strg+C, Strg+Alt+Entf, …). mods = Array von Keysyms.
|
||||||
|
window.ariaVncKey = {
|
||||||
|
char: function(cp){ tap(cpToKeysym(cp)); },
|
||||||
|
keysym: function(ks){ tap(ks); },
|
||||||
|
combo: function(mods, ks){
|
||||||
|
try{
|
||||||
|
for(var i=0;i<mods.length;i++) rfb.sendKey(mods[i], null, true);
|
||||||
|
rfb.sendKey(ks, null, true); rfb.sendKey(ks, null, false);
|
||||||
|
for(var j=mods.length-1;j>=0;j--) rfb.sendKey(mods[j], null, false);
|
||||||
|
}catch(_){}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Steuerungs-API fuer die App (per injectJavaScript).
|
// Steuerungs-API fuer die App (per injectJavaScript).
|
||||||
window.ariaVncCtl = {
|
window.ariaVncCtl = {
|
||||||
focusKeyboard: function(){ try{ kbd.focus(); }catch(_){} },
|
|
||||||
blurKeyboard: function(){ try{ kbd.blur(); }catch(_){} },
|
|
||||||
cad: function(){ try{ rfb.sendCtrlAltDel(); }catch(_){} },
|
cad: function(){ try{ rfb.sendCtrlAltDel(); }catch(_){} },
|
||||||
toggleFit: function(){ fit=!fit; rfb.scaleViewport=fit; rfb.clipViewport=!fit; post({event:'vnc_fit', fit:fit}); }
|
toggleFit: function(){ fit=!fit; rfb.scaleViewport=fit; rfb.clipViewport=!fit; post({event:'vnc_fit', fit:fit}); }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ const DesktopTile: React.FC<Props> = ({ projectId, focused }) => {
|
|||||||
const [shot, setShot] = useState<{ name: string; b64: string } | null>(null);
|
const [shot, setShot] = useState<{ name: string; b64: string } | null>(null);
|
||||||
|
|
||||||
const load = useCallback(() => {
|
const load = useCallback(() => {
|
||||||
|
if (!projectId) { setVms([]); setErr(''); setLoading(false); return; }
|
||||||
setLoading(true); setErr('');
|
setLoading(true); setErr('');
|
||||||
brainApi.listProjectVms(projectId)
|
brainApi.listProjectVms(projectId)
|
||||||
.then(r => setVms(r.vms || []))
|
.then(r => setVms(r.vms || []))
|
||||||
@@ -71,21 +72,6 @@ const DesktopTile: React.FC<Props> = ({ projectId, focused }) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verbunden → noVNC-Ansicht der VM + Zurück-Leiste.
|
|
||||||
if (connected) {
|
|
||||||
return (
|
|
||||||
<View style={styles.container}>
|
|
||||||
<View style={styles.bar}>
|
|
||||||
<TouchableOpacity onPress={() => setConnected(null)} style={styles.barBtn}>
|
|
||||||
<Text style={styles.barBtnText}>‹ VMs</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
<Text style={styles.barTitle} numberOfLines={1}>{connected.name} · :{connected.vnc_display}</Text>
|
|
||||||
</View>
|
|
||||||
<VncTile projectId={projectId} focused port={connected.vnc_port || (5900 + (connected.vnc_display || 1))} />
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<View style={styles.bar}>
|
<View style={styles.bar}>
|
||||||
@@ -97,6 +83,8 @@ const DesktopTile: React.FC<Props> = ({ projectId, focused }) => {
|
|||||||
<ActivityIndicator color="#0096FF" style={{ marginTop: 20 }} />
|
<ActivityIndicator color="#0096FF" style={{ marginTop: 20 }} />
|
||||||
) : err ? (
|
) : err ? (
|
||||||
<Text style={styles.err}>{err}</Text>
|
<Text style={styles.err}>{err}</Text>
|
||||||
|
) : !projectId ? (
|
||||||
|
<Text style={styles.empty}>Kein aktives Projekt — wechsle in ein Projekt für dessen VMs.</Text>
|
||||||
) : vms.length === 0 ? (
|
) : vms.length === 0 ? (
|
||||||
<Text style={styles.empty}>
|
<Text style={styles.empty}>
|
||||||
Noch keine VM in diesem Projekt.{'\n'}
|
Noch keine VM in diesem Projekt.{'\n'}
|
||||||
@@ -157,6 +145,18 @@ const DesktopTile: React.FC<Props> = ({ projectId, focused }) => {
|
|||||||
<Text style={styles.shotHint}>Tippen zum Schließen</Text>
|
<Text style={styles.shotHint}>Tippen zum Schließen</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
|
{/* Vollbild-VNC — randlos ueber das ganze Display (Header + Dock weg). */}
|
||||||
|
{connected && (
|
||||||
|
<Modal visible animationType="slide" onRequestClose={() => setConnected(null)} supportedOrientations={['portrait', 'landscape']}>
|
||||||
|
<View style={styles.fs}>
|
||||||
|
<VncTile projectId={projectId} focused port={connected.vnc_port || (5900 + (connected.vnc_display || 1))} />
|
||||||
|
<TouchableOpacity style={styles.fsBack} onPress={() => setConnected(null)} activeOpacity={0.8}>
|
||||||
|
<Text style={styles.fsBackText}>‹ VMs</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
</View>
|
||||||
|
</Modal>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -180,6 +180,9 @@ const styles = StyleSheet.create({
|
|||||||
vmBtns: { flexDirection: 'row', gap: 6, alignItems: 'center' },
|
vmBtns: { flexDirection: 'row', gap: 6, alignItems: 'center' },
|
||||||
vmBtn: { borderWidth: 1, borderRadius: 8, paddingHorizontal: 10, paddingVertical: 6, minWidth: 34, alignItems: 'center' },
|
vmBtn: { borderWidth: 1, borderRadius: 8, paddingHorizontal: 10, paddingVertical: 6, minWidth: 34, alignItems: 'center' },
|
||||||
vmBtnText: { fontSize: 12, fontWeight: '700' },
|
vmBtnText: { fontSize: 12, fontWeight: '700' },
|
||||||
|
fs: { flex: 1, backgroundColor: '#000000' },
|
||||||
|
fsBack: { position: 'absolute', top: 34, left: 10, backgroundColor: 'rgba(18,18,42,0.9)', borderColor: '#2A2A3E', borderWidth: 1, borderRadius: 10, paddingHorizontal: 12, paddingVertical: 7 },
|
||||||
|
fsBackText: { color: '#0096FF', fontSize: 14, fontWeight: '700' },
|
||||||
shotOverlay: { flex: 1, backgroundColor: 'rgba(0,0,0,0.92)', alignItems: 'center', justifyContent: 'center', padding: 12 },
|
shotOverlay: { flex: 1, backgroundColor: 'rgba(0,0,0,0.92)', alignItems: 'center', justifyContent: 'center', padding: 12 },
|
||||||
shotTitle: { color: '#E0E0F0', fontSize: 14, fontWeight: '700', marginBottom: 10 },
|
shotTitle: { color: '#E0E0F0', fontSize: 14, fontWeight: '700', marginBottom: 10 },
|
||||||
shotImg: { width: '100%', height: '78%', backgroundColor: '#000' },
|
shotImg: { width: '100%', height: '78%', backgroundColor: '#000' },
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ const FilesTile: React.FC<Props> = ({ projectId, focused }) => {
|
|||||||
const [previewBusy, setPreviewBusy] = useState('');
|
const [previewBusy, setPreviewBusy] = useState('');
|
||||||
|
|
||||||
const load = useCallback(() => {
|
const load = useCallback(() => {
|
||||||
|
if (!projectId) { setFiles([]); setErr(''); setLoading(false); return; }
|
||||||
setLoading(true); setErr('');
|
setLoading(true); setErr('');
|
||||||
brainApi.listProjectFiles(projectId)
|
brainApi.listProjectFiles(projectId)
|
||||||
.then(r => setFiles((r.files || []).slice().sort((a, b) => a.path.localeCompare(b.path))))
|
.then(r => setFiles((r.files || []).slice().sort((a, b) => a.path.localeCompare(b.path))))
|
||||||
@@ -88,7 +89,7 @@ const FilesTile: React.FC<Props> = ({ projectId, focused }) => {
|
|||||||
) : err ? (
|
) : err ? (
|
||||||
<Text style={styles.err}>{err}</Text>
|
<Text style={styles.err}>{err}</Text>
|
||||||
) : files.length === 0 ? (
|
) : files.length === 0 ? (
|
||||||
<Text style={styles.empty}>Noch keine Dateien in diesem Projekt.</Text>
|
<Text style={styles.empty}>{!projectId ? 'Kein aktives Projekt — wechsle in ein Projekt für dessen Dateien.' : 'Noch keine Dateien in diesem Projekt.'}</Text>
|
||||||
) : (
|
) : (
|
||||||
files.map(f => (
|
files.map(f => (
|
||||||
<TouchableOpacity key={f.path} onPress={() => open(f)} style={styles.row} disabled={previewBusy === f.path}>
|
<TouchableOpacity key={f.path} onPress={() => open(f)} style={styles.row} disabled={previewBusy === f.path}>
|
||||||
|
|||||||
@@ -2,13 +2,16 @@
|
|||||||
* VncTile — Live-Desktop der QEMU-VM (noVNC in einer WebView, RFB durch RVS).
|
* VncTile — Live-Desktop der QEMU-VM (noVNC in einer WebView, RFB durch RVS).
|
||||||
*
|
*
|
||||||
* Nur aktiv, wenn das Desktop-Panel offen ist (focused): dann WebView mounten,
|
* Nur aktiv, wenn das Desktop-Panel offen ist (focused): dann WebView mounten,
|
||||||
* bei 'ready' den RVS-VNC-Tunnel oeffnen. Eine kleine Steuerungs-Leiste macht
|
* bei 'ready' den RVS-VNC-Tunnel oeffnen. Zwei Bedien-Leisten machen die VM auf
|
||||||
* die VM auf dem Handy bedienbar: Tastatur einblenden (tippt in die VM),
|
* dem Handy voll bedienbar:
|
||||||
* Strg-Alt-Entf, und Fit ↔ 1:1 umschalten.
|
* - ctlBar (oben rechts): Fn-Leiste ein/aus, Software-Tastatur, Fit ↔ 1:1.
|
||||||
|
* - keyBar (oben, Fn): echte Steuertasten, die keine Software-Tastatur
|
||||||
|
* liefert — Esc, Tab, Pfeile, Pos1/Ende/Bild, Einfg/Entf, Enter, F1–F12 und
|
||||||
|
* Sticky-Modifier Strg/Alt/Shift (fuer Strg+C, Strg+Alt+Entf, …).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
import { Keyboard, NativeSyntheticEvent, ScrollView, StyleSheet, Text, TextInput, TextInputChangeEventData, TextInputKeyPressEventData, TouchableOpacity, View } from 'react-native';
|
||||||
import { WebView, WebViewMessageEvent } from 'react-native-webview';
|
import { WebView, WebViewMessageEvent } from 'react-native-webview';
|
||||||
import desktop from '../../services/desktop';
|
import desktop from '../../services/desktop';
|
||||||
import { NOVNC_HTML } from '../assets/novncHtml';
|
import { NOVNC_HTML } from '../assets/novncHtml';
|
||||||
@@ -19,9 +22,30 @@ interface Props {
|
|||||||
port?: number; // VNC-Port der zu verbindenden VM (Default 5901 = Display :1)
|
port?: number; // VNC-Port der zu verbindenden VM (Default 5901 = Display :1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// X11-Keysyms fuer Sondertasten, die kein druckbares Zeichen liefern.
|
||||||
|
const KEYSYM = { Backspace: 0xff08, Enter: 0xff0d, Tab: 0xff09 };
|
||||||
|
const MOD = { ctrl: 0xffe3, alt: 0xffe9, shift: 0xffe1 };
|
||||||
|
const cpToKeysym = (cp: number) => (cp < 0x100 ? cp : 0x01000000 + cp);
|
||||||
|
|
||||||
|
// Sondertasten fuer die Fn-Leiste (Label → Keysym).
|
||||||
|
const NAV_KEYS: { label: string; ks: number }[] = [
|
||||||
|
{ label: 'Esc', ks: 0xff1b }, { label: 'Tab', ks: 0xff09 },
|
||||||
|
{ label: '←', ks: 0xff51 }, { label: '↑', ks: 0xff52 }, { label: '↓', ks: 0xff54 }, { label: '→', ks: 0xff53 },
|
||||||
|
{ label: 'Pos1', ks: 0xff50 }, { label: 'Ende', ks: 0xff57 },
|
||||||
|
{ label: 'Bild↑', ks: 0xff55 }, { label: 'Bild↓', ks: 0xff56 },
|
||||||
|
{ label: 'Einfg', ks: 0xff63 }, { label: 'Entf', ks: 0xffff }, { label: '⏎', ks: 0xff0d },
|
||||||
|
];
|
||||||
|
const F_KEYS: { label: string; ks: number }[] = Array.from({ length: 12 }, (_, i) => ({ label: 'F' + (i + 1), ks: 0xffbe + i }));
|
||||||
|
|
||||||
const VncTile: React.FC<Props> = ({ projectId, focused, port = 5901 }) => {
|
const VncTile: React.FC<Props> = ({ projectId, focused, port = 5901 }) => {
|
||||||
const webRef = useRef<WebView>(null);
|
const webRef = useRef<WebView>(null);
|
||||||
|
const kbdRef = useRef<TextInput>(null);
|
||||||
|
const bufRef = useRef(''); // Spiegel des TextInput-Textes
|
||||||
const [status, setStatus] = useState<'idle' | 'connecting' | 'connected' | 'disconnected'>('idle');
|
const [status, setStatus] = useState<'idle' | 'connecting' | 'connected' | 'disconnected'>('idle');
|
||||||
|
const [kbdOn, setKbdOn] = useState(false);
|
||||||
|
const [keyBar, setKeyBar] = useState(false); // Fn-Leiste sichtbar?
|
||||||
|
const [mods, setMods] = useState({ ctrl: false, alt: false, shift: false });
|
||||||
|
const modRef = useRef({ ctrl: false, alt: false, shift: false }); // Spiegel fuer Closures
|
||||||
const unsubDataRef = useRef<null | (() => void)>(null);
|
const unsubDataRef = useRef<null | (() => void)>(null);
|
||||||
|
|
||||||
const teardown = useCallback(() => {
|
const teardown = useCallback(() => {
|
||||||
@@ -34,10 +58,87 @@ const VncTile: React.FC<Props> = ({ projectId, focused, port = 5901 }) => {
|
|||||||
return () => teardown();
|
return () => teardown();
|
||||||
}, [focused, teardown]);
|
}, [focused, teardown]);
|
||||||
|
|
||||||
|
// Button-Zustand an die ECHTE Tastatur-Sichtbarkeit koppeln: Androids
|
||||||
|
// Zurueck-Taste blendet die Tastatur aus, ohne den TextInput zu blurren —
|
||||||
|
// ueber keyboardDidHide setzen wir das ⌨-Symbol trotzdem zurueck.
|
||||||
|
useEffect(() => {
|
||||||
|
if (!focused) return;
|
||||||
|
const show = Keyboard.addListener('keyboardDidShow', () => setKbdOn(true));
|
||||||
|
const hide = Keyboard.addListener('keyboardDidHide', () => setKbdOn(false));
|
||||||
|
return () => { show.remove(); hide.remove(); };
|
||||||
|
}, [focused]);
|
||||||
|
|
||||||
const ctl = useCallback((fn: string) => {
|
const ctl = useCallback((fn: string) => {
|
||||||
webRef.current?.injectJavaScript(`window.ariaVncCtl && window.ariaVncCtl.${fn}(); true;`);
|
webRef.current?.injectJavaScript(`window.ariaVncCtl && window.ariaVncCtl.${fn}(); true;`);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const sendKeysym = useCallback((ks: number) => {
|
||||||
|
webRef.current?.injectJavaScript(`window.ariaVncKey && window.ariaVncKey.keysym(${ks}); true;`);
|
||||||
|
}, []);
|
||||||
|
const sendCombo = useCallback((modKeysyms: number[], ks: number) => {
|
||||||
|
webRef.current?.injectJavaScript(`window.ariaVncKey && window.ariaVncKey.combo(${JSON.stringify(modKeysyms)}, ${ks}); true;`);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Aktive Sticky-Modifier als Keysym-Liste; nach dem Anwenden one-shot zuruecksetzen.
|
||||||
|
const activeMods = useCallback(() => {
|
||||||
|
const m = modRef.current; const a: number[] = [];
|
||||||
|
if (m.ctrl) a.push(MOD.ctrl); if (m.alt) a.push(MOD.alt); if (m.shift) a.push(MOD.shift);
|
||||||
|
return a;
|
||||||
|
}, []);
|
||||||
|
const clearMods = useCallback(() => {
|
||||||
|
if (modRef.current.ctrl || modRef.current.alt || modRef.current.shift) {
|
||||||
|
modRef.current = { ctrl: false, alt: false, shift: false };
|
||||||
|
setMods(modRef.current);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
const toggleMod = useCallback((k: 'ctrl' | 'alt' | 'shift') => {
|
||||||
|
modRef.current = { ...modRef.current, [k]: !modRef.current[k] };
|
||||||
|
setMods(modRef.current);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// Eine Taste (fertiges Keysym) senden — mit ggf. aktiven Modifiern.
|
||||||
|
const pressKey = useCallback((ks: number) => {
|
||||||
|
const m = activeMods();
|
||||||
|
if (m.length) { sendCombo(m, ks); clearMods(); } else sendKeysym(ks);
|
||||||
|
}, [activeMods, sendCombo, clearMods, sendKeysym]);
|
||||||
|
|
||||||
|
// Ein druckbares Zeichen senden — mit ggf. aktiven Modifiern (Strg+C etc.).
|
||||||
|
const pressChar = useCallback((cp: number) => {
|
||||||
|
const m = activeMods();
|
||||||
|
if (m.length) { sendCombo(m, cpToKeysym(cp)); clearMods(); }
|
||||||
|
else webRef.current?.injectJavaScript(`window.ariaVncKey && window.ariaVncKey.char(${cp}); true;`);
|
||||||
|
}, [activeMods, sendCombo, clearMods]);
|
||||||
|
|
||||||
|
// Tastatur ein-/ausblenden. Oeffnen: blur→focus erzwingt das Aufklappen auch
|
||||||
|
// dann, wenn der TextInput noch fokussiert ist (Tastatur per Zurueck-Taste
|
||||||
|
// versteckt). Schliessen: Keyboard.dismiss(); den Button-Zustand setzt der
|
||||||
|
// keyboardDidShow/Hide-Listener — nicht hier —, damit er nie „haengen" bleibt.
|
||||||
|
const toggleKbd = useCallback(() => {
|
||||||
|
if (kbdOn) { Keyboard.dismiss(); }
|
||||||
|
else { kbdRef.current?.blur(); setTimeout(() => kbdRef.current?.focus(), 30); }
|
||||||
|
}, [kbdOn]);
|
||||||
|
|
||||||
|
// Druckbare Zeichen: Prefix-Diff des (wachsenden) Feldes → nur neu Getipptes an
|
||||||
|
// die VM. Loeschungen kommen ueber onKeyPress(Backspace), daher hier nur Inserts.
|
||||||
|
const onKbdChange = useCallback((e: NativeSyntheticEvent<TextInputChangeEventData>) => {
|
||||||
|
const text = e.nativeEvent.text || '';
|
||||||
|
const prev = bufRef.current;
|
||||||
|
let i = 0;
|
||||||
|
const min = Math.min(prev.length, text.length);
|
||||||
|
while (i < min && prev.charCodeAt(i) === text.charCodeAt(i)) i++;
|
||||||
|
for (const ch of text.slice(i)) { const cp = ch.codePointAt(0); if (cp) pressChar(cp); }
|
||||||
|
bufRef.current = text;
|
||||||
|
if (text.length > 200) { bufRef.current = ''; kbdRef.current?.setNativeProps({ text: '' }); }
|
||||||
|
}, [pressChar]);
|
||||||
|
|
||||||
|
// Sondertasten der Software-Tastatur: Backspace feuert auf Android zuverlaessig
|
||||||
|
// als keyPress; die Return-Taste (Haken) kommt als onSubmitEditing (s.u.).
|
||||||
|
const onKbdKeyPress = useCallback((e: NativeSyntheticEvent<TextInputKeyPressEventData>) => {
|
||||||
|
const k = e.nativeEvent.key;
|
||||||
|
if (k === 'Backspace') pressKey(KEYSYM.Backspace);
|
||||||
|
else if (k === 'Enter') pressKey(KEYSYM.Enter);
|
||||||
|
}, [pressKey]);
|
||||||
|
|
||||||
const onMessage = useCallback((e: WebViewMessageEvent) => {
|
const onMessage = useCallback((e: WebViewMessageEvent) => {
|
||||||
let m: any;
|
let m: any;
|
||||||
try { m = JSON.parse(e.nativeEvent.data); } catch { return; }
|
try { m = JSON.parse(e.nativeEvent.data); } catch { return; }
|
||||||
@@ -84,14 +185,34 @@ const VncTile: React.FC<Props> = ({ projectId, focused, port = 5901 }) => {
|
|||||||
keyboardDisplayRequiresUserAction={false}
|
keyboardDisplayRequiresUserAction={false}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{/* Verstecktes Eingabefeld: fokussiert → Android-Tastatur tippt in die VM.
|
||||||
|
keyboardType=visible-password schaltet Autokorrektur/Vorschlaege ab und
|
||||||
|
liefert saubere Einzelzeichen. Offscreen, aber fokussierbar. */}
|
||||||
|
<TextInput
|
||||||
|
ref={kbdRef}
|
||||||
|
style={styles.hiddenInput}
|
||||||
|
onChange={onKbdChange}
|
||||||
|
onKeyPress={onKbdKeyPress}
|
||||||
|
onSubmitEditing={() => pressKey(KEYSYM.Enter)}
|
||||||
|
keyboardType="visible-password"
|
||||||
|
returnKeyType="send"
|
||||||
|
autoCapitalize="none"
|
||||||
|
autoCorrect={false}
|
||||||
|
spellCheck={false}
|
||||||
|
blurOnSubmit={false}
|
||||||
|
caretHidden
|
||||||
|
contextMenuHidden
|
||||||
|
multiline={false}
|
||||||
|
/>
|
||||||
|
|
||||||
{/* Steuerungs-Leiste — nur wenn verbunden */}
|
{/* Steuerungs-Leiste — nur wenn verbunden */}
|
||||||
{connected && (
|
{connected && (
|
||||||
<View style={styles.ctlBar}>
|
<View style={styles.ctlBar}>
|
||||||
<TouchableOpacity style={styles.ctlBtn} onPress={() => ctl('focusKeyboard')} activeOpacity={0.7}>
|
<TouchableOpacity style={[styles.ctlBtn, keyBar && styles.ctlBtnOn]} onPress={() => setKeyBar(v => !v)} activeOpacity={0.7}>
|
||||||
<Text style={styles.ctlText}>⌨</Text>
|
<Text style={styles.ctlText}>Fn</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<TouchableOpacity style={styles.ctlBtn} onPress={() => ctl('cad')} activeOpacity={0.7}>
|
<TouchableOpacity style={[styles.ctlBtn, kbdOn && styles.ctlBtnOn]} onPress={toggleKbd} activeOpacity={0.7}>
|
||||||
<Text style={styles.ctlTextSmall}>Strg+Alt+Entf</Text>
|
<Text style={styles.ctlText}>⌨</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<TouchableOpacity style={styles.ctlBtn} onPress={() => ctl('toggleFit')} activeOpacity={0.7}>
|
<TouchableOpacity style={styles.ctlBtn} onPress={() => ctl('toggleFit')} activeOpacity={0.7}>
|
||||||
<Text style={styles.ctlText}>⤢</Text>
|
<Text style={styles.ctlText}>⤢</Text>
|
||||||
@@ -99,6 +220,26 @@ const VncTile: React.FC<Props> = ({ projectId, focused, port = 5901 }) => {
|
|||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* Fn-Leiste — echte Steuertasten (oben, ueber der Software-Tastatur). */}
|
||||||
|
{connected && keyBar && (
|
||||||
|
<View style={styles.keyBar} pointerEvents="box-none">
|
||||||
|
<ScrollView horizontal showsHorizontalScrollIndicator={false} keyboardShouldPersistTaps="always" contentContainerStyle={styles.keyRow}>
|
||||||
|
<TouchableOpacity style={[styles.key, mods.ctrl && styles.keyOn]} onPress={() => toggleMod('ctrl')} activeOpacity={0.7}><Text style={styles.keyText}>Strg</Text></TouchableOpacity>
|
||||||
|
<TouchableOpacity style={[styles.key, mods.alt && styles.keyOn]} onPress={() => toggleMod('alt')} activeOpacity={0.7}><Text style={styles.keyText}>Alt</Text></TouchableOpacity>
|
||||||
|
<TouchableOpacity style={[styles.key, mods.shift && styles.keyOn]} onPress={() => toggleMod('shift')} activeOpacity={0.7}><Text style={styles.keyText}>Shift</Text></TouchableOpacity>
|
||||||
|
{NAV_KEYS.map(k => (
|
||||||
|
<TouchableOpacity key={k.label} style={styles.key} onPress={() => pressKey(k.ks)} activeOpacity={0.7}><Text style={styles.keyText}>{k.label}</Text></TouchableOpacity>
|
||||||
|
))}
|
||||||
|
</ScrollView>
|
||||||
|
<ScrollView horizontal showsHorizontalScrollIndicator={false} keyboardShouldPersistTaps="always" contentContainerStyle={styles.keyRow}>
|
||||||
|
{F_KEYS.map(k => (
|
||||||
|
<TouchableOpacity key={k.label} style={styles.key} onPress={() => pressKey(k.ks)} activeOpacity={0.7}><Text style={styles.keyText}>{k.label}</Text></TouchableOpacity>
|
||||||
|
))}
|
||||||
|
<TouchableOpacity style={styles.key} onPress={() => ctl('cad')} activeOpacity={0.7}><Text style={styles.keyTextSm}>Strg+Alt+Entf</Text></TouchableOpacity>
|
||||||
|
</ScrollView>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
|
||||||
{!connected && (
|
{!connected && (
|
||||||
<View style={styles.overlay} pointerEvents="none">
|
<View style={styles.overlay} pointerEvents="none">
|
||||||
<Text style={styles.overlayText}>
|
<Text style={styles.overlayText}>
|
||||||
@@ -119,7 +260,7 @@ const styles = StyleSheet.create({
|
|||||||
sub: { color: '#9090B0', fontSize: 14, marginTop: 8 },
|
sub: { color: '#9090B0', fontSize: 14, marginTop: 8 },
|
||||||
ctlBar: {
|
ctlBar: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top: 8,
|
top: 34,
|
||||||
right: 8,
|
right: 8,
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
gap: 6,
|
gap: 6,
|
||||||
@@ -135,8 +276,21 @@ const styles = StyleSheet.create({
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
},
|
},
|
||||||
|
ctlBtnOn: { backgroundColor: 'rgba(0,150,255,0.85)', borderColor: '#0096FF' },
|
||||||
ctlText: { color: '#E0E0F0', fontSize: 16, fontWeight: '700' },
|
ctlText: { color: '#E0E0F0', fontSize: 16, fontWeight: '700' },
|
||||||
ctlTextSmall: { color: '#E0E0F0', fontSize: 11, fontWeight: '700' },
|
ctlTextSmall: { color: '#E0E0F0', fontSize: 11, fontWeight: '700' },
|
||||||
|
// Fokussierbar (nicht display:none), aber aus dem Sichtfeld geschoben.
|
||||||
|
hiddenInput: { position: 'absolute', width: 1, height: 1, top: -100, left: -100, opacity: 0, padding: 0 },
|
||||||
|
keyBar: { position: 'absolute', top: 74, left: 0, right: 0, gap: 5 },
|
||||||
|
keyRow: { paddingHorizontal: 6, gap: 5, alignItems: 'center' },
|
||||||
|
key: {
|
||||||
|
backgroundColor: 'rgba(18,18,42,0.92)', borderColor: '#2A2A3E', borderWidth: 1,
|
||||||
|
borderRadius: 8, paddingHorizontal: 9, paddingVertical: 7, minWidth: 34,
|
||||||
|
alignItems: 'center', justifyContent: 'center',
|
||||||
|
},
|
||||||
|
keyOn: { backgroundColor: 'rgba(0,150,255,0.85)', borderColor: '#0096FF' },
|
||||||
|
keyText: { color: '#E0E0F0', fontSize: 13, fontWeight: '700' },
|
||||||
|
keyTextSm: { color: '#E0E0F0', fontSize: 10, fontWeight: '700' },
|
||||||
overlay: { position: 'absolute', top: 12, left: 0, right: 0, alignItems: 'center' },
|
overlay: { position: 'absolute', top: 12, left: 0, right: 0, alignItems: 'center' },
|
||||||
overlayText: { color: '#9090B0', fontSize: 12, backgroundColor: 'rgba(0,0,0,0.6)', paddingHorizontal: 10, paddingVertical: 4, borderRadius: 10, overflow: 'hidden' },
|
overlayText: { color: '#9090B0', fontSize: 12, backgroundColor: 'rgba(0,0,0,0.6)', paddingHorizontal: 10, paddingVertical: 4, borderRadius: 10, overflow: 'hidden' },
|
||||||
});
|
});
|
||||||
|
|||||||
+29
-23
@@ -963,17 +963,21 @@ def _docker_gateway() -> str:
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
def _ssh_aria_vm(*args: str, timeout: int = 25):
|
def _ssh_host(*cmd: str, timeout: int = 25):
|
||||||
import subprocess
|
import subprocess
|
||||||
cmd = ["ssh", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=8",
|
full = ["ssh", "-o", "StrictHostKeyChecking=no", "-o", "ConnectTimeout=8",
|
||||||
_ARIA_VM_HOST, "aria-vm", *[str(a) for a in args]]
|
_ARIA_VM_HOST, *[str(c) for c in cmd]]
|
||||||
try:
|
try:
|
||||||
r = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout)
|
r = subprocess.run(full, capture_output=True, text=True, timeout=timeout)
|
||||||
return r.returncode, r.stdout or "", r.stderr or ""
|
return r.returncode, r.stdout or "", r.stderr or ""
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
return 1, "", str(exc)
|
return 1, "", str(exc)
|
||||||
|
|
||||||
|
|
||||||
|
def _ssh_aria_vm(*args: str, timeout: int = 25):
|
||||||
|
return _ssh_host("aria-vm", *args, timeout=timeout)
|
||||||
|
|
||||||
|
|
||||||
def _vm_running_names() -> set:
|
def _vm_running_names() -> set:
|
||||||
rc, out, _err = _ssh_aria_vm("list", timeout=15)
|
rc, out, _err = _ssh_aria_vm("list", timeout=15)
|
||||||
names = set()
|
names = set()
|
||||||
@@ -1074,11 +1078,13 @@ def project_vm_stop(project_id: str, name: str):
|
|||||||
|
|
||||||
@app.post("/projects/{project_id}/vms/{name}/screenshot")
|
@app.post("/projects/{project_id}/vms/{name}/screenshot")
|
||||||
def project_vm_screenshot(project_id: str, name: str):
|
def project_vm_screenshot(project_id: str, name: str):
|
||||||
"""Macht einen Screenshot der laufenden VM (aria-vm screenshot → PNG in
|
"""Macht einen Screenshot der laufenden VM und liefert ihn als Base64.
|
||||||
/shared/uploads) und liefert ihn als Base64 zurueck. So sieht Stefan den
|
|
||||||
VM-Bildschirm auch ohne Live-VNC (genau wie ARIA es beim Testen macht)."""
|
aria-vm schreibt das PNG ins VM-Verzeichnis (dem aria-User gehoerend — nicht
|
||||||
|
ins /root-Shared-Volume, wo der aria-User keinen Zugriff hat). Der Brain holt
|
||||||
|
die Datei danach per SSH (base64) — funktioniert unabhaengig von Volume-
|
||||||
|
Rechten. Zusaetzlich wird das PNG ins Projekt kopiert (Dateien-Panel)."""
|
||||||
import base64
|
import base64
|
||||||
import time as _t
|
|
||||||
rc, out, err = _ssh_aria_vm("screenshot", name, timeout=30)
|
rc, out, err = _ssh_aria_vm("screenshot", name, timeout=30)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
raise HTTPException(status_code=400, detail=f"Screenshot fehlgeschlagen: {(err or out).strip()[:200]}")
|
raise HTTPException(status_code=400, detail=f"Screenshot fehlgeschlagen: {(err or out).strip()[:200]}")
|
||||||
@@ -1088,28 +1094,28 @@ def project_vm_screenshot(project_id: str, name: str):
|
|||||||
path = line.split("=", 1)[1].strip()
|
path = line.split("=", 1)[1].strip()
|
||||||
if not path:
|
if not path:
|
||||||
raise HTTPException(status_code=500, detail=f"Kein Screenshot-Pfad: {out.strip()[:200]}")
|
raise HTTPException(status_code=500, detail=f"Kein Screenshot-Pfad: {out.strip()[:200]}")
|
||||||
local = os.path.join("/shared/uploads", os.path.basename(path))
|
# PNG per SSH als Base64 holen (kein Shared-Volume noetig).
|
||||||
for _ in range(10): # kurze Bind-Mount-Latenz abfangen
|
rc2, b64, err2 = _ssh_host("base64", "-w0", path, timeout=20)
|
||||||
if os.path.isfile(local):
|
if rc2 != 0 or not b64.strip():
|
||||||
break
|
raise HTTPException(status_code=500, detail=f"Screenshot konnte nicht gelesen werden: {(err2 or 'leer').strip()[:200]}")
|
||||||
_t.sleep(0.2)
|
b64 = b64.strip()
|
||||||
if not os.path.isfile(local):
|
try:
|
||||||
raise HTTPException(status_code=500, detail=f"Screenshot-Datei nicht gefunden: {local}")
|
data = base64.b64decode(b64)
|
||||||
with open(local, "rb") as f:
|
except Exception as exc:
|
||||||
data = f.read()
|
raise HTTPException(status_code=500, detail=f"Base64 ungueltig: {exc}")
|
||||||
# Auch ins Projekt kopieren → taucht im Dateien-Panel auf.
|
fname = os.path.basename(path)
|
||||||
|
# Ins Projekt kopieren → taucht im Dateien-Panel auf.
|
||||||
proj_rel = ""
|
proj_rel = ""
|
||||||
try:
|
try:
|
||||||
shots_dir = os.path.join(_project_dir(project_id), "screenshots")
|
shots_dir = os.path.join(_project_dir(project_id), "screenshots")
|
||||||
os.makedirs(shots_dir, exist_ok=True)
|
os.makedirs(shots_dir, exist_ok=True)
|
||||||
with open(os.path.join(shots_dir, os.path.basename(local)), "wb") as f:
|
with open(os.path.join(shots_dir, fname), "wb") as f:
|
||||||
f.write(data)
|
f.write(data)
|
||||||
proj_rel = "screenshots/" + os.path.basename(local)
|
proj_rel = "screenshots/" + fname
|
||||||
except Exception:
|
except Exception:
|
||||||
proj_rel = ""
|
proj_rel = ""
|
||||||
return {"ok": True, "name": name, "filename": os.path.basename(local),
|
return {"ok": True, "name": name, "filename": fname,
|
||||||
"projectPath": proj_rel,
|
"projectPath": proj_rel, "base64": b64}
|
||||||
"base64": base64.b64encode(data).decode("ascii")}
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/conversation/stats")
|
@app.get("/conversation/stats")
|
||||||
|
|||||||
+23
-1
@@ -43,6 +43,25 @@ from openwakeword.model import Model as WakeWordModel
|
|||||||
|
|
||||||
from modes import Mode, canonical_id, detect_mode_switch, mode_from_id, should_speak
|
from modes import Mode, canonical_id, detect_mode_switch, mode_from_id, should_speak
|
||||||
|
|
||||||
|
|
||||||
|
def _docker_gateway() -> str:
|
||||||
|
"""Docker-Gateway-IP (= Host-IP auf DIESEM Container-Netz, aria-net) aus
|
||||||
|
/proc/net/route. Genau die IP, an die der Brain QEMUs VNC bindet — im
|
||||||
|
Gegensatz zu host.docker.internal, das auf die Default-Bridge (docker0)
|
||||||
|
zeigt und daher die VM nicht trifft."""
|
||||||
|
try:
|
||||||
|
import socket as _sock
|
||||||
|
import struct as _struct
|
||||||
|
with open("/proc/net/route") as f:
|
||||||
|
for line in f.readlines()[1:]:
|
||||||
|
fields = line.strip().split()
|
||||||
|
if len(fields) >= 4 and fields[1] == "00000000" and int(fields[3], 16) & 2:
|
||||||
|
return _sock.inet_ntoa(_struct.pack("<L", int(fields[2], 16)))
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
# ── Logging ──────────────────────────────────────────────────
|
# ── Logging ──────────────────────────────────────────────────
|
||||||
|
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
@@ -738,7 +757,10 @@ class ARIABridge:
|
|||||||
# "task": asyncio.Task}. Wir bruecken rohes RFB-TCP (QEMU-VNC auf dem
|
# "task": asyncio.Task}. Wir bruecken rohes RFB-TCP (QEMU-VNC auf dem
|
||||||
# Host) <-> RVS (vnc_data/vnc_input, Base64-in-JSON).
|
# Host) <-> RVS (vnc_data/vnc_input, Base64-in-JSON).
|
||||||
self._vnc_sessions: dict[str, dict] = {}
|
self._vnc_sessions: dict[str, dict] = {}
|
||||||
self._vnc_host: str = os.environ.get("ARIA_VNC_HOST", "host.docker.internal")
|
# VNC-Host: das aria-net-Gateway (dort bindet der Brain QEMUs VNC).
|
||||||
|
# host.docker.internal zeigt faelschlich auf docker0 (172.17.0.1) → refused.
|
||||||
|
self._vnc_host: str = (os.environ.get("ARIA_VNC_HOST")
|
||||||
|
or _docker_gateway() or "host.docker.internal")
|
||||||
# Satelliten (Aussenposten in fremden Netzen). id → {location, caps,
|
# Satelliten (Aussenposten in fremden Netzen). id → {location, caps,
|
||||||
# control, last_seen}. Registrierung via sat_hello. _pending_sat:
|
# control, last_seen}. Registrierung via sat_hello. _pending_sat:
|
||||||
# requestId → Future (sat_devices / sat_result), analog _pending_flux.
|
# requestId → Future (sat_devices / sat_result), analog _pending_flux.
|
||||||
|
|||||||
@@ -147,16 +147,20 @@ cmd_screenshot() {
|
|||||||
local d; d="$(vm_dir "${name}")"
|
local d; d="$(vm_dir "${name}")"
|
||||||
vm_running "${name}" || die "VM '${name}' laeuft nicht"
|
vm_running "${name}" || die "VM '${name}' laeuft nicht"
|
||||||
command -v socat >/dev/null || die "socat fehlt (qemu-setup.sh?)"
|
command -v socat >/dev/null || die "socat fehlt (qemu-setup.sh?)"
|
||||||
mkdir -p "${SHOT_DIR}"
|
# Standard: ins VM-Verzeichnis schreiben (dem aria-User gehoerend) — NICHT
|
||||||
|
# nach /root/... (da kommt der aria-User nicht hin). Der Brain holt das PNG
|
||||||
|
# danach per SSH (base64). Ueberschreibbar via ARIA_VM_SHOT_DIR.
|
||||||
|
local out_dir="${ARIA_VM_SHOT_DIR:-${d}}"
|
||||||
|
mkdir -p "${out_dir}"
|
||||||
local ts; ts="$(date +%s)"
|
local ts; ts="$(date +%s)"
|
||||||
local ppm="${d}/shot-${ts}.ppm"
|
local ppm="${d}/shot-${ts}.ppm"
|
||||||
printf 'screendump %s\n' "${ppm}" | socat - "unix-connect:${d}/monitor.sock" >/dev/null
|
printf 'screendump %s\n' "${ppm}" | socat - "unix-connect:${d}/monitor.sock" >/dev/null
|
||||||
sleep 0.3
|
sleep 0.3
|
||||||
local out="${SHOT_DIR}/${name}-${ts}.png"
|
local out="${out_dir}/${name}-${ts}.png"
|
||||||
if command -v convert >/dev/null; then
|
if command -v convert >/dev/null; then
|
||||||
convert "${ppm}" "${out}" && rm -f "${ppm}"
|
convert "${ppm}" "${out}" && rm -f "${ppm}"
|
||||||
else
|
else
|
||||||
out="${SHOT_DIR}/${name}-${ts}.ppm"; mv "${ppm}" "${out}"
|
out="${out_dir}/${name}-${ts}.ppm"; mv "${ppm}" "${out}"
|
||||||
fi
|
fi
|
||||||
echo "screenshot=${out}"
|
echo "screenshot=${out}"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user