feat: authenticate Windows command launcher and signal helper
This commit is contained in:
+17
-2
@@ -41,7 +41,7 @@ func run(args []string, output, diagnostics io.Writer) error {
|
||||
return errors.New("an internal mode is required (use --help)")
|
||||
}
|
||||
if args[0] == "--help" || args[0] == "-h" {
|
||||
_, err := io.WriteString(output, "usage: rvbox --service|--tray|--check-config|--install-service|--uninstall-service|--configure-service|--start-service|--stop-service|--restart-service --config PATH\n")
|
||||
_, err := io.WriteString(output, "usage: rvbox --service|--tray|--launcher|--signal-helper|--check-config|--install-service|--uninstall-service|--configure-service|--start-service|--stop-service|--restart-service --config PATH\n")
|
||||
return err
|
||||
}
|
||||
flags := flag.NewFlagSet("rvbox", flag.ContinueOnError)
|
||||
@@ -49,6 +49,9 @@ func run(args []string, output, diagnostics io.Writer) error {
|
||||
configPath := flags.String("config", defaultClientConfigPath(), "absolute client TOML configuration path")
|
||||
serviceMode := flags.Bool("service", false, "run under the Windows Service Control Manager")
|
||||
trayMode := flags.Bool("tray", false, "run the current user's notification-area frontend")
|
||||
launcherMode := flags.Bool("launcher", false, "run one private authenticated command launcher")
|
||||
signalHelperMode := flags.Bool("signal-helper", false, "run one private authenticated signal helper")
|
||||
channel := flags.String("channel", "", "private launcher channel (internal use only)")
|
||||
checkConfig := flags.Bool("check-config", false, "validate client configuration and exit")
|
||||
install := flags.Bool("install-service", false, "install or update the machine-wide service")
|
||||
uninstall := flags.Bool("uninstall-service", false, "remove the machine-wide service")
|
||||
@@ -64,7 +67,7 @@ func run(args []string, output, diagnostics io.Writer) error {
|
||||
return fmt.Errorf("unexpected argument %q", flags.Arg(0))
|
||||
}
|
||||
selected := 0
|
||||
for _, value := range []bool{*serviceMode, *trayMode, *checkConfig, *install, *uninstall, *configure, *start, *stop, *restart} {
|
||||
for _, value := range []bool{*serviceMode, *trayMode, *launcherMode, *signalHelperMode, *checkConfig, *install, *uninstall, *configure, *start, *stop, *restart} {
|
||||
if value {
|
||||
selected++
|
||||
}
|
||||
@@ -105,6 +108,18 @@ func run(args []string, output, diagnostics io.Writer) error {
|
||||
if *trayMode {
|
||||
return runTray(*configPath, diagnostics)
|
||||
}
|
||||
if *launcherMode {
|
||||
if *channel == "" {
|
||||
return errors.New("--launcher requires an internal channel")
|
||||
}
|
||||
return runLauncher(*channel, diagnostics)
|
||||
}
|
||||
if *signalHelperMode {
|
||||
if *channel == "" {
|
||||
return errors.New("--signal-helper requires an internal channel")
|
||||
}
|
||||
return runSignalHelper(*channel, diagnostics)
|
||||
}
|
||||
return runService(*configPath, diagnostics)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user