feat: embed optional apps in player server
This commit is contained in:
@ -4,7 +4,9 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"forge.cadoles.com/arcad/arcast"
|
||||
"forge.cadoles.com/arcad/arcast/pkg/browser/lorca"
|
||||
"forge.cadoles.com/arcad/arcast/pkg/selfsigned"
|
||||
"forge.cadoles.com/arcad/arcast/pkg/server"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/urfave/cli/v2"
|
||||
@ -26,11 +28,26 @@ func Run() *cli.Command {
|
||||
EnvVars: []string{"ARCAST_DESKTOP_INSTANCE_ID"},
|
||||
Value: "",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "address",
|
||||
EnvVars: []string{"ARCAST_DESKTOP_ADDRESS"},
|
||||
Value: ":",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "tls-address",
|
||||
EnvVars: []string{"ARCAST_DESKTOP_TLS_ADDRESS"},
|
||||
Value: ":",
|
||||
},
|
||||
&cli.IntFlag{
|
||||
Name: "window-height",
|
||||
EnvVars: []string{"ARCAST_DESKTOP_WINDOW_HEIGHT"},
|
||||
Value: defaults.Height,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "apps",
|
||||
EnvVars: []string{"ARCAST_DESKTOP_APPS"},
|
||||
Value: false,
|
||||
},
|
||||
&cli.IntFlag{
|
||||
Name: "window-width",
|
||||
EnvVars: []string{"ARCAST_DESKTOP_WINDOW_WIDTH"},
|
||||
@ -41,6 +58,9 @@ func Run() *cli.Command {
|
||||
windowHeight := ctx.Int("window-height")
|
||||
windowWidth := ctx.Int("window-width")
|
||||
chromeArgs := addFlagsPrefix(ctx.StringSlice("additional-chrome-arg")...)
|
||||
enableApps := ctx.Bool("apps")
|
||||
serverAddress := ctx.String("address")
|
||||
serverTLSAddress := ctx.String("tls-address")
|
||||
|
||||
browser := lorca.NewBrowser(
|
||||
lorca.WithAdditionalChromeArgs(chromeArgs...),
|
||||
@ -69,7 +89,20 @@ func Run() *cli.Command {
|
||||
instanceID = server.NewRandomInstanceID()
|
||||
}
|
||||
|
||||
server := server.New(browser, server.WithInstanceID(instanceID))
|
||||
cert, err := selfsigned.NewLANCert()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not generate self signed certificate")
|
||||
}
|
||||
|
||||
server := server.New(browser,
|
||||
server.WithInstanceID(instanceID),
|
||||
server.WithAppsEnabled(enableApps),
|
||||
server.WithDefaultApp("home"),
|
||||
server.WithApps(arcast.DefaultApps...),
|
||||
server.WithAddress(serverAddress),
|
||||
server.WithTLSAddress(serverTLSAddress),
|
||||
server.WithTLSCertificate(cert),
|
||||
)
|
||||
|
||||
if err := server.Start(); err != nil {
|
||||
return errors.Wrap(err, "could not start server")
|
||||
|
Reference in New Issue
Block a user