Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
55b7a02b85 | ||
|
|
ae2024ef55 |
@@ -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 20600
|
versionCode 20601
|
||||||
versionName "0.2.6.0"
|
versionName "0.2.6.1"
|
||||||
// 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.6.0",
|
"version": "0.2.6.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"android": "react-native run-android",
|
"android": "react-native run-android",
|
||||||
|
|||||||
@@ -2539,8 +2539,7 @@ const SettingsScreen: React.FC = () => {
|
|||||||
style={[styles.connectButton, {marginTop: 12}]}
|
style={[styles.connectButton, {marginTop: 12}]}
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
const updateService = require('../services/updater').default;
|
const updateService = require('../services/updater').default;
|
||||||
updateService.checkForUpdate();
|
updateService.checkForUpdateManual();
|
||||||
Alert.alert('Update-Check', 'Pruefe auf neue Version...');
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text style={styles.connectButtonText}>Auf Updates pr{'\u00FC'}fen</Text>
|
<Text style={styles.connectButtonText}>Auf Updates pr{'\u00FC'}fen</Text>
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ class UpdateService {
|
|||||||
private progressListeners: ProgressCallback[] = [];
|
private progressListeners: ProgressCallback[] = [];
|
||||||
private progress: UpdateProgress = { active: false, version: '', fraction: -1, receivedMB: 0, totalMB: 0, status: '' };
|
private progress: UpdateProgress = { active: false, version: '', fraction: -1, receivedMB: 0, totalMB: 0, status: '' };
|
||||||
private jobId: number | null = null;
|
private jobId: number | null = null;
|
||||||
|
/** Laeuft gerade eine Pruefung per Knopf? Dann geht die Antwort NUR dorthin
|
||||||
|
* (sonst zeigt der ChatScreen-Listener denselben Dialog ein zweites Mal). */
|
||||||
|
private manualWaiter: ((r: { type: 'available'; info: UpdateInfo } | { type: 'none'; latest: string }) => void) | null = null;
|
||||||
private cancelled = false;
|
private cancelled = false;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -66,10 +69,19 @@ class UpdateService {
|
|||||||
downloadUrl: (msg.payload.downloadUrl as string) || '',
|
downloadUrl: (msg.payload.downloadUrl as string) || '',
|
||||||
size: (msg.payload.size as number) || 0,
|
size: (msg.payload.size as number) || 0,
|
||||||
};
|
};
|
||||||
|
if (this.manualWaiter) {
|
||||||
|
const w = this.manualWaiter; this.manualWaiter = null;
|
||||||
|
if (info.version && this.isNewer(info.version)) w({ type: 'available', info });
|
||||||
|
else w({ type: 'none', latest: info.version });
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (info.version && this.isNewer(info.version)) {
|
if (info.version && this.isNewer(info.version)) {
|
||||||
console.log(`[Update] Neue Version verfuegbar: ${info.version} (aktuell: ${APP_VERSION})`);
|
console.log(`[Update] Neue Version verfuegbar: ${info.version} (aktuell: ${APP_VERSION})`);
|
||||||
this.listeners.forEach(cb => cb(info));
|
this.listeners.forEach(cb => cb(info));
|
||||||
}
|
}
|
||||||
|
} else if ((msg.type as string) === 'update_none' && this.manualWaiter) {
|
||||||
|
const w = this.manualWaiter; this.manualWaiter = null;
|
||||||
|
w({ type: 'none', latest: String(msg.payload.latest || '') });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -150,6 +162,64 @@ class UpdateService {
|
|||||||
setTimeout(() => { this.checking = false; }, 10000);
|
setTimeout(() => { this.checking = false; }, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pruefung per Knopf (Einstellungen → Ueber): sagt IMMER etwas —
|
||||||
|
* neue Version (Update-Dialog), "keine neue Version" mit der Version auf dem
|
||||||
|
* Server, oder warum der Update-Server nicht erreichbar ist (mit Details).
|
||||||
|
*/
|
||||||
|
async checkForUpdateManual(): Promise<void> {
|
||||||
|
const cfg = rvs.getConfig();
|
||||||
|
const where = cfg ? `${cfg.useTLS ? 'wss' : 'ws'}://${cfg.host}:${cfg.port}` : '(nicht eingerichtet)';
|
||||||
|
if (!cfg) {
|
||||||
|
Alert.alert('Update-Server nicht erreichbar', 'Es ist noch kein Server eingerichtet (Einstellungen → Verbindung).');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!rvs.isSocketOpen()) {
|
||||||
|
const lastErr = [...rvs.getConnectionLog()].reverse().find(e => e.level === 'error');
|
||||||
|
Alert.alert('Update-Server nicht erreichbar',
|
||||||
|
`Keine Verbindung zu ${where}.\n\nZustand: ${rvs.getState()}`
|
||||||
|
+ (lastErr ? `\nLetzter Fehler (${new Date(lastErr.timestamp).toLocaleTimeString()}):\n${lastErr.message}` : ''));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await new Promise<{ type: 'available'; info: UpdateInfo } | { type: 'none'; latest: string } | { type: 'timeout' }>(resolve => {
|
||||||
|
const t = setTimeout(() => { this.manualWaiter = null; resolve({ type: 'timeout' }); }, 10_000);
|
||||||
|
this.manualWaiter = (r) => { clearTimeout(t); resolve(r); };
|
||||||
|
rvs.send('update_check' as any, { version: APP_VERSION });
|
||||||
|
});
|
||||||
|
|
||||||
|
if (result.type === 'available') {
|
||||||
|
this.promptUpdate(result.info);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (result.type === 'timeout') {
|
||||||
|
Alert.alert('Update-Server antwortet nicht',
|
||||||
|
`Verbunden mit ${where}, aber nach 10 s keine Antwort auf die Update-Anfrage.\n\n`
|
||||||
|
+ 'Moeglicherweise laeuft auf dem Server eine alte RVS-Version.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keine neue Version — zusaetzlich pruefen, ob der Download-Weg funktioniert
|
||||||
|
let dl = '';
|
||||||
|
try {
|
||||||
|
const ctrl = new AbortController();
|
||||||
|
const t = setTimeout(() => ctrl.abort(), 10_000);
|
||||||
|
const r = await fetch(`${cfg.useTLS ? 'https' : 'http'}://${cfg.host}:${cfg.port}/update/latest.apk`,
|
||||||
|
{ method: 'HEAD', headers: { 'X-RVS-Token': cfg.token }, signal: ctrl.signal });
|
||||||
|
clearTimeout(t);
|
||||||
|
dl = r.ok ? 'Download-Weg: erreichbar ✓'
|
||||||
|
: r.status === 404 && result.latest ? 'Download-Weg: vom Server noch nicht unterstuetzt (alter RVS)'
|
||||||
|
: r.status === 404 ? 'Download-Weg: erreichbar, aber auf dem Server liegt keine APK'
|
||||||
|
: `Download-Weg: Fehler HTTP ${r.status}`;
|
||||||
|
} catch (e: any) {
|
||||||
|
dl = `Download-Weg: nicht erreichbar (${e?.name === 'AbortError' ? 'Zeitueberschreitung' : (e?.message || e)})`;
|
||||||
|
}
|
||||||
|
Alert.alert('Keine neue Version',
|
||||||
|
`Installiert: ${APP_VERSION}\n`
|
||||||
|
+ `Neueste auf dem Server: ${result.latest || '(keine APK hinterlegt)'}\n\n`
|
||||||
|
+ `Update-Server: ${where} ✓\n${dl}`);
|
||||||
|
}
|
||||||
|
|
||||||
/** Callback registrieren */
|
/** Callback registrieren */
|
||||||
onUpdateAvailable(callback: UpdateCallback): () => void {
|
onUpdateAvailable(callback: UpdateCallback): () => void {
|
||||||
this.listeners.push(callback);
|
this.listeners.push(callback);
|
||||||
|
|||||||
+9
-1
@@ -27,7 +27,7 @@ const ALLOWED_TYPES = new Set([
|
|||||||
"chat", "audio", "file", "location", "mode", "log", "event", "heartbeat",
|
"chat", "audio", "file", "location", "mode", "log", "event", "heartbeat",
|
||||||
"file_request", "file_response", "file_saved", "stt_result", "config", "tts_request",
|
"file_request", "file_response", "file_saved", "stt_result", "config", "tts_request",
|
||||||
"xtts_request", "xtts_response", "xtts_list_voices", "xtts_voices_list", "voice_upload", "xtts_voice_saved",
|
"xtts_request", "xtts_response", "xtts_list_voices", "xtts_voices_list", "voice_upload", "xtts_voice_saved",
|
||||||
"update_check", "update_available", "update_download", "update_data",
|
"update_check", "update_available", "update_none", "update_download", "update_data",
|
||||||
"agent_activity", "cancel_request", "interject",
|
"agent_activity", "cancel_request", "interject",
|
||||||
"audio_pcm",
|
"audio_pcm",
|
||||||
"file_from_aria",
|
"file_from_aria",
|
||||||
@@ -614,6 +614,14 @@ function registerClient(ws, token) {
|
|||||||
},
|
},
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
}));
|
}));
|
||||||
|
} else {
|
||||||
|
// Auch "nichts Neues" beantworten — die App zeigt dann, dass der
|
||||||
|
// Update-Server erreichbar ist und welche Version er hat
|
||||||
|
ws.send(JSON.stringify({
|
||||||
|
type: "update_none",
|
||||||
|
payload: { latest: apkInfo ? apkInfo.version : "", current: clientVersion },
|
||||||
|
timestamp: Date.now(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user