From 74e6d360aae5adad787972019338139f7e9f4995 Mon Sep 17 00:00:00 2001 From: Loporrit <141286461+loporrit@users.noreply.github.com> Date: Sun, 3 Dec 2023 16:34:39 +0000 Subject: [PATCH] Disallow editing of secret keys --- MareSynchronos/UI/SettingsUi.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/MareSynchronos/UI/SettingsUi.cs b/MareSynchronos/UI/SettingsUi.cs index e80635a..42e33b4 100644 --- a/MareSynchronos/UI/SettingsUi.cs +++ b/MareSynchronos/UI/SettingsUi.cs @@ -1048,12 +1048,15 @@ public class SettingsUi : WindowMediatorSubscriberBase _serverConfigurationManager.Save(); } var key = item.Value.Key; + var keyInUse = selectedServer.Authentications.Exists(p => p.SecretKeyIdx == item.Key); + if (keyInUse) ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudGrey3); if (ImGui.InputText("Secret Key", ref key, 64)) { item.Value.Key = key; _serverConfigurationManager.Save(); } - if (!selectedServer.Authentications.Exists(p => p.SecretKeyIdx == item.Key)) + if (keyInUse) ImGui.PopStyleColor(); + if (!keyInUse) { if (UiSharedService.NormalizedIconTextButton(FontAwesomeIcon.Trash, "Delete Secret Key") && UiSharedService.CtrlPressed()) { @@ -1064,7 +1067,7 @@ public class SettingsUi : WindowMediatorSubscriberBase } else { - UiSharedService.ColorTextWrapped("This key is in use and cannot be deleted", ImGuiColors.DalamudYellow); + UiSharedService.ColorTextWrapped("This key is in use and cannot be edited or deleted", ImGuiColors.DalamudYellow); } if (item.Key != selectedServer.SecretKeys.Keys.LastOrDefault())