added possiblity to execute custom command when starting a screenshare
This commit is contained in:
@@ -30,10 +30,6 @@ run apt-get -q -y update; apt-get -q -y upgrade && \
|
||||
apt-get -q -y install sudo openssh-server && \
|
||||
mkdir /var/run/sshd
|
||||
|
||||
# Installing golang and git
|
||||
run apt install golang && \
|
||||
apt install git
|
||||
|
||||
|
||||
# Set root password
|
||||
run echo 'root:password' >> /root/passwdfile
|
||||
@@ -52,8 +48,6 @@ run chpasswd -c SHA512 < /root/passwdfile && \
|
||||
# Port 22 is used for ssh
|
||||
expose 22
|
||||
|
||||
expose
|
||||
|
||||
|
||||
# Assign /data as static volume.
|
||||
volume ["/data"]
|
||||
|
||||
@@ -23,6 +23,7 @@ type Config struct {
|
||||
BarrierHostName string
|
||||
Rooms string
|
||||
IPAddress string
|
||||
BinaryToExecute string
|
||||
}
|
||||
|
||||
// Exists reports whether the named file or directory exists.
|
||||
@@ -61,6 +62,7 @@ func SetDefaults() error {
|
||||
defaults["BarrierHostName"] = name
|
||||
defaults["Rooms"] = defaultPath + "room.json"
|
||||
defaults["IPAddress"] = "0.0.0.0"
|
||||
defaults["BinaryToExecute"] = "/home/akilan/.local/share/Steam/steamapps/common/X-Plane 11"
|
||||
|
||||
//Paths to search for config file
|
||||
configPaths = append(configPaths, defaultPath)
|
||||
|
||||
@@ -13,13 +13,16 @@ const iceConfig = {
|
||||
|
||||
const displayMediaOptions = {
|
||||
noConstraint: {
|
||||
video: true,
|
||||
video: {
|
||||
height: 1080,
|
||||
frameRate: 120,
|
||||
},
|
||||
audio: true,
|
||||
},
|
||||
v720p30: {
|
||||
video: {
|
||||
height: 720,
|
||||
frameRate: 60,
|
||||
height: 1080,
|
||||
frameRate: 120,
|
||||
},
|
||||
audio: true,
|
||||
},
|
||||
|
||||
29
main.go
29
main.go
@@ -23,6 +23,7 @@ func main() {
|
||||
roomInfo := flag.Bool("roomInfo", false, "Getting room id of headless server")
|
||||
killServer := flag.Bool("killServer", false, "Kills the laplace")
|
||||
killChromium := flag.Bool("killChromium", false, "Kills all chromuim")
|
||||
BinaryToExcute := flag.String("BinaryToExecute","","Providing path (i.e Absolute path) of binary to execute")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
@@ -64,11 +65,27 @@ func main() {
|
||||
Addr = Ip4or6(Addr)
|
||||
}
|
||||
|
||||
var TaskExecute string
|
||||
|
||||
if *BinaryToExcute != "" {
|
||||
TaskExecute = *BinaryToExcute
|
||||
} else {
|
||||
// Read binary from config file
|
||||
TaskExecute = Config.BinaryToExecute
|
||||
}
|
||||
|
||||
// Starting screen share headless
|
||||
cmd := exec.Command("chromium-browser" ,"--no-sandbox","--auto-select-desktop-capture-source=Entire screen","--url","https://" + Addr + ":8888/?mode=headless","--ignore-certificate-errors")
|
||||
if err := cmd.Run(); err != nil {
|
||||
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
|
||||
RunTask(TaskExecute)
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
@@ -131,3 +148,13 @@ func Ip4or6(s string) string {
|
||||
return "[" + s + "]"
|
||||
|
||||
}
|
||||
|
||||
func RunTask(task string) error {
|
||||
// Halts the process
|
||||
cmd := exec.Command(task)
|
||||
if err := cmd.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
2
p2prc.sh
2
p2prc.sh
@@ -16,7 +16,7 @@ apt install -y barrier
|
||||
|
||||
# Installing chromium
|
||||
wget https://github.com/RobRich999/Chromium_Clang/releases/download/v94.0.4585.0-r904940-linux64-deb-avx/chromium-browser-unstable_94.0.4585.0-1_amd64.deb
|
||||
apt install -y ./v94.0.4585.0-r904940-linux64-deb-avx/chromium-browser-unstable_94.0.4585.0-1_amd64.deb
|
||||
apt install -y ./chromium-browser-unstable_94.0.4585.0-1_amd64.deb
|
||||
|
||||
# clone remotegameplay distribution
|
||||
git clone https://github.com/Akilan1999/remotegameplay
|
||||
|
||||
3
package-lock.json
generated
Normal file
3
package-lock.json
generated
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"lockfileVersion": 1
|
||||
}
|
||||
Reference in New Issue
Block a user