added autostart for windows and autostart for devices

This commit is contained in:
2026-02-19 09:34:38 +01:00
parent e2b853840d
commit 486cf6d239
10 changed files with 290 additions and 19 deletions
+26 -1
View File
@@ -94,13 +94,19 @@ function renderUseDevices(container, available, attached) {
html += attached.map(dev => `
<div class="device-card">
<div class="device-info">
<div class="device-name">${escapeHtml(dev.bus_id)}</div>
<div class="device-name">${escapeHtml(dev.name || dev.bus_id)}</div>
<div class="device-details">
<span>Von: ${escapeHtml(dev.client_name || dev.client_id)}</span>
${dev.vendor_id ? `<span>VID:PID: ${dev.vendor_id}:${dev.product_id}</span>` : ''}
<span>VHCI Port: ${dev.vhci_port}</span>
</div>
</div>
<div class="device-status">
<label class="auto-connect-label" title="Beim Start automatisch verbinden">
<input type="checkbox" ${dev.auto_connect ? 'checked' : ''}
onchange="toggleAutoConnect('${dev.vendor_id}', '${dev.product_id}', this.checked)">
Autostart
</label>
<span class="badge attached">Verbunden</span>
<button class="btn small danger" onclick="detachDevice('${dev.client_id}', '${dev.bus_id}')">Trennen</button>
</div>
@@ -191,6 +197,25 @@ async function detachDevice(clientId, busId) {
}
}
// Auto-connect toggle
async function toggleAutoConnect(vendorId, productId, enabled) {
try {
const resp = await fetch(API_BASE + '/api/auto-connect', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ vendor_id: vendorId, product_id: productId, enabled: enabled })
});
const data = await resp.json();
if (!data.ok) {
alert('Fehler: ' + (data.error || 'Unbekannt'));
updateDevices();
}
} catch (e) {
alert('Fehler: ' + e.message);
updateDevices();
}
}
// Settings
async function loadSettings() {
try {