feat(android): Cockpit-App und Android-Agent per MDM ausrollen
Beide Apps lesen ihre Verbindungsdaten aus der App-Konfiguration des MDM (Android Managed Configuration). Sind host und token gesetzt, verbindet sich die App ohne QR-Code; die MDM-Werte haben Vorrang vor der Eingabe am Geraet. - Cockpit (com.ariacockpit): host, token, port, tls; natives Modul MdmConfig, gelesen beim Start in rvs.loadConfig() - Agent (de.hackersoft.ariaagent): zusaetzlich name, control, reply_mode; gelesen beim App-Start und nach dem Booten - README: Abschnitt "Ausrollen per MDM" mit Screenshots unter docs/images/mdm/ Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -491,7 +491,40 @@ class RVSConnection {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verbindungsdaten aus dem MDM (Managed Configuration), falls beim Ausrollen
|
||||
* gesetzt. Nur gueltig mit host UND token. Schluessel: res/xml/app_restrictions.xml
|
||||
*/
|
||||
async loadMdmConfig(): Promise<ConnectionConfig | null> {
|
||||
try {
|
||||
const Mdm: any = NativeModules.MdmConfig;
|
||||
if (Platform.OS !== 'android' || !Mdm?.getConfig) return null;
|
||||
const m = await Mdm.getConfig();
|
||||
const host = String(m?.host ?? '').trim();
|
||||
const token = String(m?.token ?? '').trim();
|
||||
if (!host || !token) return null;
|
||||
const port = Number(m.port);
|
||||
return {
|
||||
host,
|
||||
token,
|
||||
port: Number.isFinite(port) && port > 0 ? port : 443,
|
||||
useTLS: m.tls !== false,
|
||||
};
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async loadConfig(): Promise<ConnectionConfig | null> {
|
||||
// Vom MDM gesetzte Werte haben Vorrang: so kommen geaenderte Zugangsdaten
|
||||
// beim naechsten App-Start an, ohne dass jemand am Geraet etwas tun muss.
|
||||
const mdm = await this.loadMdmConfig();
|
||||
if (mdm) {
|
||||
console.log('[RVS] Konfiguration aus dem MDM');
|
||||
this.config = mdm;
|
||||
await this.saveConfig(mdm);
|
||||
return mdm;
|
||||
}
|
||||
try {
|
||||
const data = await AsyncStorage.getItem(RVSConnection.STORAGE_KEY);
|
||||
if (data) {
|
||||
|
||||
Reference in New Issue
Block a user