added autostart for windows and autostart for devices
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -279,3 +279,18 @@ nav {
|
||||
color: #666;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
.auto-connect-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.3rem;
|
||||
font-size: 0.8rem;
|
||||
color: #888;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.auto-connect-label input[type="checkbox"] {
|
||||
accent-color: #00d4ff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user