From 1354c349216ee15288606d5aa089113d67021ae2 Mon Sep 17 00:00:00 2001 From: Sylvie Crowe <107814465+oneirocosm@users.noreply.github.com> Date: Thu, 10 Oct 2024 17:23:27 -0700 Subject: [PATCH] fix: add conn prefix to askbeforewshinstall flag (#1013) --- frontend/types/gotypes.d.ts | 3 ++- pkg/remote/conncontroller/conncontroller.go | 6 +++--- pkg/wconfig/defaultconfig/settings.json | 4 ++-- pkg/wconfig/metaconsts.go | 3 ++- pkg/wconfig/settingsconfig.go | 3 ++- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/frontend/types/gotypes.d.ts b/frontend/types/gotypes.d.ts index e9613d386..5d21cbb8d 100644 --- a/frontend/types/gotypes.d.ts +++ b/frontend/types/gotypes.d.ts @@ -471,7 +471,8 @@ declare global { "window:disablehardwareacceleration"?: boolean; "telemetry:*"?: boolean; "telemetry:enabled"?: boolean; - askbeforewshinstall?: boolean; + "conn:*"?: boolean; + "conn:askbeforewshinstall"?: boolean; }; // waveobj.StickerClickOptsType diff --git a/pkg/remote/conncontroller/conncontroller.go b/pkg/remote/conncontroller/conncontroller.go index 0e8f986b1..d50f63978 100644 --- a/pkg/remote/conncontroller/conncontroller.go +++ b/pkg/remote/conncontroller/conncontroller.go @@ -315,11 +315,11 @@ func (conn *SSHConn) CheckAndInstallWsh(ctx context.Context, clientDisplayName s } if response.CheckboxStat { meta := waveobj.MetaMapType{ - wconfig.ConfigKey_AskBeforeWshInstall: false, + wconfig.ConfigKey_ConnAskBeforeWshInstall: false, } err := wconfig.SetBaseConfigValue(meta) if err != nil { - return fmt.Errorf("error setting askbeforewshinstall value: %w", err) + return fmt.Errorf("error setting conn:askbeforewshinstall value: %w", err) } } } @@ -438,7 +438,7 @@ func (conn *SSHConn) connectInternal(ctx context.Context) error { return err } config := wconfig.ReadFullConfig() - installErr := conn.CheckAndInstallWsh(ctx, clientDisplayName, &WshInstallOpts{NoUserPrompt: !config.Settings.AskBeforeWshInstall}) + installErr := conn.CheckAndInstallWsh(ctx, clientDisplayName, &WshInstallOpts{NoUserPrompt: !config.Settings.ConnAskBeforeWshInstall}) if installErr != nil { log.Printf("error: unable to install wsh shell extensions for %s: %v\n", conn.GetName(), err) return fmt.Errorf("conncontroller %s wsh install error: %v", conn.GetName(), installErr) diff --git a/pkg/wconfig/defaultconfig/settings.json b/pkg/wconfig/defaultconfig/settings.json index 71970e56b..791901ee8 100644 --- a/pkg/wconfig/defaultconfig/settings.json +++ b/pkg/wconfig/defaultconfig/settings.json @@ -5,10 +5,10 @@ "autoupdate:enabled": true, "autoupdate:installonquit": true, "autoupdate:intervalms": 3600000, + "conn:askbeforewshinstall": true, "editor:minimapenabled": true, "web:defaulturl": "https://github.com/wavetermdev/waveterm", "web:defaultsearch": "https://www.google.com/search?q={query}", "window:tilegapsize": 3, - "telemetry:enabled": true, - "askbeforewshinstall": true + "telemetry:enabled": true } diff --git a/pkg/wconfig/metaconsts.go b/pkg/wconfig/metaconsts.go index d3cdd9ee8..4a9b29a37 100644 --- a/pkg/wconfig/metaconsts.go +++ b/pkg/wconfig/metaconsts.go @@ -62,6 +62,7 @@ const ( ConfigKey_TelemetryClear = "telemetry:*" ConfigKey_TelemetryEnabled = "telemetry:enabled" - ConfigKey_AskBeforeWshInstall = "askbeforewshinstall" + ConfigKey_ConnClear = "conn:*" + ConfigKey_ConnAskBeforeWshInstall = "conn:askbeforewshinstall" ) diff --git a/pkg/wconfig/settingsconfig.go b/pkg/wconfig/settingsconfig.go index dea03f718..e4ecf5bf8 100644 --- a/pkg/wconfig/settingsconfig.go +++ b/pkg/wconfig/settingsconfig.go @@ -96,7 +96,8 @@ type SettingsType struct { TelemetryClear bool `json:"telemetry:*,omitempty"` TelemetryEnabled bool `json:"telemetry:enabled,omitempty"` - AskBeforeWshInstall bool `json:"askbeforewshinstall,omitempty"` + ConnClear bool `json:"conn:*,omitempty"` + ConnAskBeforeWshInstall bool `json:"conn:askbeforewshinstall,omitempty"` } type ConfigError struct {