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
+13 -7
View File
@@ -209,7 +209,7 @@ func cmdRun(mode string) {
}()
go sm.Run()
} else {
um := client.NewUseManager(c)
um := client.NewUseManager(c, cfg, cfgPath)
webHandler.GetDevices = func() interface{} {
available := um.GetAvailableDevices()
attached := um.GetAttachedDevices()
@@ -231,11 +231,15 @@ func cmdRun(mode string) {
var attachList []map[string]interface{}
for _, d := range attached {
attachList = append(attachList, map[string]interface{}{
"bus_id": d.BusID,
"client_id": d.ClientID,
"client_name": d.ClientName,
"tunnel_id": d.TunnelID,
"vhci_port": d.VHCIPort,
"bus_id": d.BusID,
"vendor_id": d.VendorID,
"product_id": d.ProductID,
"name": d.Name,
"client_id": d.ClientID,
"client_name": d.ClientName,
"tunnel_id": d.TunnelID,
"vhci_port": d.VHCIPort,
"auto_connect": um.IsAutoConnect(d.VendorID, d.ProductID),
})
}
@@ -247,6 +251,8 @@ func cmdRun(mode string) {
}
webHandler.AttachDevice = um.AttachDevice
webHandler.DetachDevice = um.DetachDevice
webHandler.SetAutoConnect = um.SetAutoConnect
webHandler.IsAutoConnect = um.IsAutoConnect
webHandler.GetStatus = func() map[string]interface{} {
return map[string]interface{}{
"connected": true,
@@ -278,7 +284,7 @@ func cmdRun(mode string) {
sm := client.NewShareManager(c)
go sm.Run()
} else {
client.NewUseManager(c)
client.NewUseManager(c, cfg, cfgPath)
}
go func() {
if err := c.Run(); err != nil {