headless mode added to the bottom to trigger only on server start
This commit is contained in:
88
main.go
88
main.go
@@ -53,50 +53,6 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
// Running in headless mode
|
||||
if *headless {
|
||||
Config, err := config.ConfigInit()
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
// Returns the URl address type
|
||||
Addr := Ip4or6(Config.IPAddress)
|
||||
|
||||
// If address is provided
|
||||
if *addr != "" {
|
||||
Addr = *addr
|
||||
// Add brackets if the ip address is ipv6
|
||||
Addr = Ip4or6(Addr)
|
||||
}
|
||||
|
||||
var TaskExecute string
|
||||
|
||||
if *BinaryToExcute != "" {
|
||||
TaskExecute = *BinaryToExcute
|
||||
} else {
|
||||
// Read binary from config file
|
||||
TaskExecute = Config.ScriptToExecute
|
||||
}
|
||||
|
||||
// Starting screen share headless
|
||||
cmd := exec.Command("chromium-browser", "--no-sandbox", "--auto-select-desktop-capture-source=Entire screen", "--url", "https://"+Addr+":"+*port+"/?mode=headless", "--ignore-certificate-errors")
|
||||
if err := cmd.Start(); err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
// Makes program sleep for 2 seconds to allow chromium browser to open
|
||||
time.Sleep(3 * time.Second)
|
||||
|
||||
// Task to be executed
|
||||
err = RunTask(TaskExecute)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// kills laplace server
|
||||
if *killServer {
|
||||
cmd := exec.Command("pkill", "remotegameplay")
|
||||
@@ -173,6 +129,50 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// Running in headless mode
|
||||
if *headless {
|
||||
Config, err := config.ConfigInit()
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
// Returns the URl address type
|
||||
Addr := Ip4or6(Config.IPAddress)
|
||||
|
||||
// If address is provided
|
||||
if *addr != "" {
|
||||
Addr = *addr
|
||||
// Add brackets if the ip address is ipv6
|
||||
Addr = Ip4or6(Addr)
|
||||
}
|
||||
|
||||
var TaskExecute string
|
||||
|
||||
if *BinaryToExcute != "" {
|
||||
TaskExecute = *BinaryToExcute
|
||||
} else {
|
||||
// Read binary from config file
|
||||
TaskExecute = Config.ScriptToExecute
|
||||
}
|
||||
|
||||
// Starting screen share headless
|
||||
cmd := exec.Command("chromium-browser", "--no-sandbox", "--auto-select-desktop-capture-source=Entire screen", "--url", "https://"+Addr+":"+*port+"/?mode=headless", "--ignore-certificate-errors")
|
||||
if err := cmd.Start(); err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
// Makes program sleep for 2 seconds to allow chromium browser to open
|
||||
time.Sleep(3 * time.Second)
|
||||
|
||||
// Task to be executed
|
||||
err = RunTask(TaskExecute)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Start P2PRC server
|
||||
//_, err = abstractions.Start()
|
||||
//if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user