Release 1.3.1 (#41)
* Added password refresh to activate browser dev task * Added http and https prefixes to broserdevurl * Added changelog filepull/42/head 1.3.1
							parent
							
								
									e80aaf7d18
								
							
						
					
					
						commit
						7913be080d
					
				|  | @ -0,0 +1,18 @@ | ||||||
|  | # Changelog | ||||||
|  | 
 | ||||||
|  | ## [1.3.1] - 08-12-2024 | ||||||
|  | 
 | ||||||
|  | * Fixes to Browser Dev feature: | ||||||
|  |     * Now edgeboxctl also fetches or generates the browser dev environment url and saves it into an option both when starting, and every time the browser dev status is fetched. | ||||||
|  | 
 | ||||||
|  | ## [1.3.0] - 05-12-2024 | ||||||
|  | 
 | ||||||
|  | * Added Edgebox Browser Development Environment Feature Support | ||||||
|  |     * Added tasks for handling browser development environment into tasks.go | ||||||
|  |     * Added executable tasks to ExecuteTask and scheduled ones to ExecuteSchedules | ||||||
|  | * Other bug fixes and improvements. | ||||||
|  | 
 | ||||||
|  | ### Missing Past Releases | ||||||
|  | 
 | ||||||
|  | Release notes for past versions are not available in this file. Please refer to the [GitHub releases](https://hithub.com/edgebox-iot/edgeboxctl/releases) for more information. Feel free to contribute to this file by adding missing release notes. | ||||||
|  | 
 | ||||||
|  | @ -18,6 +18,8 @@ import ( | ||||||
| 	"github.com/edgebox-iot/edgeboxctl/internal/system" | 	"github.com/edgebox-iot/edgeboxctl/internal/system" | ||||||
| 	"github.com/edgebox-iot/edgeboxctl/internal/utils" | 	"github.com/edgebox-iot/edgeboxctl/internal/utils" | ||||||
| 
 | 
 | ||||||
|  | 	"github.com/joho/godotenv" | ||||||
|  | 
 | ||||||
| 	_ "github.com/go-sql-driver/mysql" // Mysql Driver
 | 	_ "github.com/go-sql-driver/mysql" // Mysql Driver
 | ||||||
| 	_ "github.com/mattn/go-sqlite3"    // SQlite Driver
 | 	_ "github.com/mattn/go-sqlite3"    // SQlite Driver
 | ||||||
| ) | ) | ||||||
|  | @ -531,6 +533,8 @@ func ExecuteSchedules(tick int) { | ||||||
| 		log.Println("Fetching Browser Dev Environment Information") | 		log.Println("Fetching Browser Dev Environment Information") | ||||||
| 		taskGetBrowserDevPassword() | 		taskGetBrowserDevPassword() | ||||||
| 		taskGetBrowserDevStatus() | 		taskGetBrowserDevStatus() | ||||||
|  | 
 | ||||||
|  | 		taskCheckSystemUpdates() | ||||||
| 		 | 		 | ||||||
| 		ip := taskGetSystemIP() | 		ip := taskGetSystemIP() | ||||||
| 		log.Println("System IP is: " + ip) | 		log.Println("System IP is: " + ip) | ||||||
|  | @ -560,9 +564,7 @@ func ExecuteSchedules(tick int) { | ||||||
| 		taskStartWs() | 		taskStartWs() | ||||||
| 		log.Println(taskGetEdgeApps()) | 		log.Println(taskGetEdgeApps()) | ||||||
| 		taskUpdateSystemLoggerServices() | 		taskUpdateSystemLoggerServices() | ||||||
| 		taskRecoverFromUpdate() | 		taskRecoverFromUpdate()		 | ||||||
| 		taskCheckSystemUpdates() |  | ||||||
| 		 |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if tick%5 == 0 { | 	if tick%5 == 0 { | ||||||
|  | @ -571,6 +573,10 @@ func ExecuteSchedules(tick int) { | ||||||
| 		log.Println(taskGetStorageDevices()) | 		log.Println(taskGetStorageDevices()) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	if tick%15 == 0 { | ||||||
|  | 		taskGetBrowserDevStatus() | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	if tick%30 == 0 { | 	if tick%30 == 0 { | ||||||
| 		// Executing every 30 ticks
 | 		// Executing every 30 ticks
 | ||||||
| 		log.Println(taskGetEdgeApps()) | 		log.Println(taskGetEdgeApps()) | ||||||
|  | @ -1150,7 +1156,10 @@ func taskGetBrowserDevStatus() string { | ||||||
| 	if browserDevStatus == "active" { | 	if browserDevStatus == "active" { | ||||||
| 		fmt.Println("Browser Dev Environment is running") | 		fmt.Println("Browser Dev Environment is running") | ||||||
| 		utils.WriteOption("BROWSERDEV_STATUS", "running") | 		utils.WriteOption("BROWSERDEV_STATUS", "running") | ||||||
|  | 		taskGetBrowserDevUrl() | ||||||
|  | 
 | ||||||
| 		return "{\"status\": \"running\"}" | 		return "{\"status\": \"running\"}" | ||||||
|  | 
 | ||||||
| 	} else { | 	} else { | ||||||
| 		fmt.Println("Browser Dev Environment is not running") | 		fmt.Println("Browser Dev Environment is not running") | ||||||
| 		utils.WriteOption("BROWSERDEV_STATUS", "not_running") | 		utils.WriteOption("BROWSERDEV_STATUS", "not_running") | ||||||
|  | @ -1158,6 +1167,24 @@ func taskGetBrowserDevStatus() string { | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | func taskGetBrowserDevUrl() string { | ||||||
|  | 	url := "" | ||||||
|  | 	myEdgeAppServiceEnv, err := godotenv.Read(utils.GetPath(utils.EdgeAppsPath) + "dev/myedgeapp.env") | ||||||
|  | 	if err != nil { | ||||||
|  | 		log.Println("No myedge.app environment file found. Status is Network-Only") | ||||||
|  | 		url = "http://dev." + system.GetHostname() + ".local" | ||||||
|  | 	} else { | ||||||
|  | 		if myEdgeAppServiceEnv["INTERNET_URL"] != "" { | ||||||
|  | 			url = "https://" + myEdgeAppServiceEnv["INTERNET_URL"] | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	fmt.Println("Browser Dev Url: " + url) | ||||||
|  | 
 | ||||||
|  | 	utils.WriteOption("BROWSERDEV_URL", url) | ||||||
|  | 	return url | ||||||
|  | } | ||||||
|  | 
 | ||||||
| func taskActivateBrowserDev() string { | func taskActivateBrowserDev() string { | ||||||
| 	fmt.Println("Executing taskActivateBrowserDev") | 	fmt.Println("Executing taskActivateBrowserDev") | ||||||
| 	wsPath := utils.GetPath(utils.WsPath) | 	wsPath := utils.GetPath(utils.WsPath) | ||||||
|  | @ -1170,6 +1197,10 @@ func taskActivateBrowserDev() string { | ||||||
| 	system.StartWs() | 	system.StartWs() | ||||||
| 	// Write control option for API
 | 	// Write control option for API
 | ||||||
| 	utils.WriteOption("BROWSERDEV_STATUS", "running") | 	utils.WriteOption("BROWSERDEV_STATUS", "running") | ||||||
|  | 
 | ||||||
|  | 	// Write and refresh the dev environment password option
 | ||||||
|  | 	taskGetBrowserDevPassword() | ||||||
|  | 
 | ||||||
| 	return "{\"status\": \"ok\"}" | 	return "{\"status\": \"ok\"}" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1189,15 +1220,14 @@ func taskDeactivateBrowserDev() string { | ||||||
| 
 | 
 | ||||||
| func taskGetBrowserDevPassword() string { | func taskGetBrowserDevPassword() string { | ||||||
| 	fmt.Println("Executing taskGetBrowserDevPassword") | 	fmt.Println("Executing taskGetBrowserDevPassword") | ||||||
| 	password := utils.ReadOption("BROWSERDEV_PASSWORD") | 
 | ||||||
| 	if password == "" { | 	password, err := system.FetchBrowserDevPasswordFromFile() | ||||||
| 		password, err := system.FetchBrowserDevPasswordFromFile() | 	if err == nil { | ||||||
| 		if err == nil { | 		utils.WriteOption("BROWSERDEV_PASSWORD", password) | ||||||
| 			utils.WriteOption("BROWSERDEV_PASSWORD", password) | 	} else { | ||||||
| 		} else { | 		fmt.Println("Error fetching browser dev password from file: " + err.Error()) | ||||||
| 			fmt.Println("Error fetching browser dev password from file: " + err.Error()) |  | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
|  | 
 | ||||||
| 	return password | 	return password | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue