Add support for dynamic hosts file management, browser opening, and new favicon handling in web server. Add elimination workflow UI enhancements with better state management and design.

TODO: Test elimination per finding type in web view

Figure out where RustDesk registry persistence is located. The installer is aware of it somehow
This commit is contained in:
Evan Hosinski
2025-10-12 20:02:49 -04:00
parent 15fb9eb510
commit adcad167df
12 changed files with 712 additions and 39 deletions
+45
View File
@@ -0,0 +1,45 @@
package web
import (
"fmt"
"syscall"
"unsafe"
)
var (
shell32 = syscall.NewLazyDLL("shell32.dll")
shellExecuteW = shell32.NewProc("ShellExecuteW")
)
// OpenBrowser opens the default browser to the specified URL using Windows ShellExecute API
func OpenBrowser(url string) error {
// Convert strings to UTF16 pointers
operation, err := syscall.UTF16PtrFromString("open")
if err != nil {
return fmt.Errorf("failed to convert operation string: %w", err)
}
urlPtr, err := syscall.UTF16PtrFromString(url)
if err != nil {
return fmt.Errorf("failed to convert URL string: %w", err)
}
// ShellExecuteW(hwnd, operation, file, parameters, directory, showCmd)
// SW_SHOWNORMAL = 1, SW_SHOW = 5
ret, _, callErr := shellExecuteW.Call(
0, // hwnd (NULL)
uintptr(unsafe.Pointer(operation)), // operation ("open")
uintptr(unsafe.Pointer(urlPtr)), // file (URL)
0, // parameters (NULL)
0, // directory (NULL)
5, // showCmd (SW_SHOW)
)
// ShellExecute returns a value > 32 on success
if ret <= 32 {
return fmt.Errorf("ShellExecute failed with code: %d (error: %v)", ret, callErr)
}
fmt.Printf("[web] Browser opened successfully (return code: %d)\n", ret)
return nil
}