Added password refresh to activate browser dev task

pull/41/head
Paulo Truta 2024-12-08 18:15:45 +01:00
parent e80aaf7d18
commit b5a9a1d85c
1 changed files with 11 additions and 8 deletions

View File

@ -1170,6 +1170,10 @@ func taskActivateBrowserDev() string {
system.StartWs()
// Write control option for API
utils.WriteOption("BROWSERDEV_STATUS", "running")
// Write and refresh the dev environment password option
taskGetBrowserDevPassword()
return "{\"status\": \"ok\"}"
}
@ -1189,15 +1193,14 @@ func taskDeactivateBrowserDev() string {
func taskGetBrowserDevPassword() string {
fmt.Println("Executing taskGetBrowserDevPassword")
password := utils.ReadOption("BROWSERDEV_PASSWORD")
if password == "" {
password, err := system.FetchBrowserDevPasswordFromFile()
if err == nil {
utils.WriteOption("BROWSERDEV_PASSWORD", password)
} else {
fmt.Println("Error fetching browser dev password from file: " + err.Error())
}
password, err := system.FetchBrowserDevPasswordFromFile()
if err == nil {
utils.WriteOption("BROWSERDEV_PASSWORD", password)
} else {
fmt.Println("Error fetching browser dev password from file: " + err.Error())
}
return password
}