mirror of
https://codeberg.org/PLG-Development/PLG-MuDiCS
synced 2026-07-06 00:47:09 +00:00
fix(control): sometimes could not start browser
This commit is contained in:
+6
-10
@@ -7,21 +7,17 @@ import (
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func OpenBrowserWindow(url string, fullscreen bool, temp bool) error {
|
||||
func OpenBrowserWindow(url string, fullscreen bool) error {
|
||||
bins := []string{"chromium", "chromium-browser"}
|
||||
|
||||
args := []string{fmt.Sprintf("--app=%s", url), "--autoplay-policy=no-user-gesture-required"}
|
||||
tempDirPath, err := os.MkdirTemp("", "plg-mudics-browser-")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
args := []string{fmt.Sprintf("--app=%s", url), "--autoplay-policy=no-user-gesture-required", fmt.Sprintf("--user-data-dir=%s", tempDirPath)}
|
||||
if fullscreen {
|
||||
args = append(args, "--start-fullscreen")
|
||||
}
|
||||
if temp {
|
||||
tempDirPath, err := os.MkdirTemp("", "plg-mudics-browser-")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
arg := fmt.Sprintf("--user-data-dir=%s", tempDirPath)
|
||||
args = append(args, arg)
|
||||
}
|
||||
|
||||
errs := []string{}
|
||||
for _, bin := range bins {
|
||||
|
||||
Reference in New Issue
Block a user