From 7bacd1aabaa585764c707bd46eabc905104c8750 Mon Sep 17 00:00:00 2001 From: JonKazama-Hellion Date: Sat, 2 May 2026 02:18:43 +0200 Subject: [PATCH] Remove webinterface settings tab and configuration fields Webinterface adds a third-party HTTP surface that contradicts the DSGVO-by-default promise: it broadcasts every chat message including filtered ChatTypes (privacy filter only covers DB writes), ships a five-digit numeric auth code seeded from System.Random, binds on all interfaces by default and sets cookies without security flags. Hardening it for our threat model would land 500+ lines of code and permanent maintenance for a feature very few users actually use. The forks audience wants less surface, not more, so the entire feature is being removed in a focused commit cluster. This first commit drops the user-facing surface: settings tab class, tab registration and the Configuration fields plus their UpdateFrom mirror. --- ChatTwo/Configuration.cs | 13 -- ChatTwo/Ui/Settings.cs | 1 - ChatTwo/Ui/SettingsTabs/Webinterface.cs | 154 ------------------------ 3 files changed, 168 deletions(-) delete mode 100644 ChatTwo/Ui/SettingsTabs/Webinterface.cs diff --git a/ChatTwo/Configuration.cs b/ChatTwo/Configuration.cs index 74210e8..efe4c5d 100755 --- a/ChatTwo/Configuration.cs +++ b/ChatTwo/Configuration.cs @@ -171,14 +171,6 @@ public class Configuration : IPluginConfiguration public ConfigKeyBind? ChatTabForward; public ConfigKeyBind? ChatTabBackward; - // Webinterface - public bool WebinterfaceEnabled; - public bool WebinterfaceAutoStart; - public string WebinterfacePassword = WebinterfaceUtil.GenerateSimpleAuthCode(); - public int WebinterfacePort = 9000; - public HashSet AuthStore = []; - public int WebinterfaceMaxLinesToSend = 1000; // 1-10000 - public void UpdateFrom(Configuration other, bool backToOriginal) { if (backToOriginal) @@ -243,11 +235,6 @@ public class Configuration : IPluginConfiguration ChosenStyle = other.ChosenStyle; ChatTabForward = other.ChatTabForward; ChatTabBackward = other.ChatTabBackward; - WebinterfaceEnabled = other.WebinterfaceEnabled; - WebinterfaceAutoStart = other.WebinterfaceAutoStart; - WebinterfacePassword = other.WebinterfacePassword; - WebinterfacePort = other.WebinterfacePort; - WebinterfaceMaxLinesToSend = other.WebinterfaceMaxLinesToSend; PrivacyFilterEnabled = other.PrivacyFilterEnabled; PrivacyPersistChannels = [..other.PrivacyPersistChannels]; diff --git a/ChatTwo/Ui/Settings.cs b/ChatTwo/Ui/Settings.cs index eed5b75..c4fa8bc 100755 --- a/ChatTwo/Ui/Settings.cs +++ b/ChatTwo/Ui/Settings.cs @@ -42,7 +42,6 @@ public sealed class SettingsWindow : Window new Tabs(Plugin, Mutable), new SettingsTabs.Privacy(Plugin, Mutable), new Database(Plugin, Mutable), - new Webinterface(Plugin, Mutable), new Miscellaneous(Mutable), new Changelog(Mutable), new About() diff --git a/ChatTwo/Ui/SettingsTabs/Webinterface.cs b/ChatTwo/Ui/SettingsTabs/Webinterface.cs deleted file mode 100644 index 8623e61..0000000 --- a/ChatTwo/Ui/SettingsTabs/Webinterface.cs +++ /dev/null @@ -1,154 +0,0 @@ -using ChatTwo.Resources; -using ChatTwo.Util; -using Dalamud.Interface; -using Dalamud.Interface.Colors; -using Dalamud.Interface.ImGuiNotification; -using Dalamud.Interface.Utility.Raii; -using Dalamud.Bindings.ImGui; - -namespace ChatTwo.Ui.SettingsTabs; - -internal sealed class Webinterface(Plugin plugin, Configuration mutable) : ISettingsTab -{ - private Plugin Plugin { get; } = plugin; - private Configuration Mutable { get; } = mutable; - public string Name => Language.Options_Webinterface_Tab + "###tabs-Webinterface"; - - public void Draw(bool changed) - { - if (ImGui.CollapsingHeader(Language.Webinterface_UsageNotice, ImGuiTreeNodeFlags.DefaultOpen)) - { - ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudWhite, Language.Options_Webinterface_Warning_Header); - ImGui.Spacing(); - ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudOrange, Language.Options_Webinterface_Warning_Reason); - - ImGui.Spacing(); - ImGui.Spacing(); - ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudViolet, Language.Options_Webinterface_Warning_DoNot); - using (ImRaii.PushIndent(15.0f)) - { - ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudViolet, Language.Options_Webinterface_DoNot_Port); - ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudViolet, Language.Options_Webinterface_DoNot_Share); - ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudViolet, Language.Options_Webinterface_DoNot_Multibox); - } - ImGui.Spacing(); - ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudOrange, Language.Options_Webinterface_Warning_Support); - - ImGui.Spacing(); - } - - ImGui.Separator(); - ImGui.Spacing(); - - ImGuiUtil.OptionCheckbox(ref Mutable.WebinterfaceEnabled, Language.Options_WebinterfaceEnable_Name, Language.Options_WebinterfaceEnable_Description); - ImGui.Spacing(); - - if (!Mutable.WebinterfaceEnabled) - return; - ImGui.Spacing(); - - ImGuiUtil.OptionCheckbox(ref Mutable.WebinterfaceAutoStart, Language.Options_WebinterfaceAutoStart_Name, Language.Options_WebinterfaceAutoStart_Description); - ImGui.Spacing(); - - if (ImGuiUtil.InputIntVertical(Language.Webinterface_Option_Port_Name, Language.Webinterface_Option_Port_Description, ref Mutable.WebinterfacePort)) - Mutable.WebinterfacePort = Math.Clamp(Mutable.WebinterfacePort, 1024, 49151); - ImGui.Spacing(); - - if (ImGuiUtil.InputIntVertical(Language.Options_WebinterfaceMaxLinesToSend_Name, Language.Options_WebinterfaceMaxLinesToSend_Description, ref Mutable.WebinterfaceMaxLinesToSend)) - Mutable.WebinterfaceMaxLinesToSend = Math.Clamp(Mutable.WebinterfaceMaxLinesToSend, 1, 10_000); - ImGui.Spacing(); - - ImGuiUtil.WrappedTextWithColor(ImGuiColors.DalamudOrange, Language.Webinterface_CurrentPassword); - ImGui.AlignTextToFramePadding(); - ImGui.TextUnformatted(Mutable.WebinterfacePassword); - ImGui.SameLine(); - if (ImGuiUtil.IconButton(FontAwesomeIcon.Recycle, tooltip: Language.Webinterface_PasswordReset_Tooltip)) - { - Mutable.WebinterfacePassword = WebinterfaceUtil.GenerateSimpleAuthCode(); - Plugin.ServerCore.InvalidateSessions(); - } - - ImGui.TextUnformatted(Language.Webinterface_Controls); - using (ImRaii.PushIndent(10.0f)) - { - var isActive = Plugin.ServerCore.IsActive(); - using (ImRaii.Disabled(isActive || Plugin.ServerCore.IsStopping())) - { - if (ImGui.Button(Language.Webinterface_Button_Start)) - { - Task.Run(() => - { - var ok = Plugin.ServerCore.Start(); - if (ok) - { - Plugin.ServerCore.Run(); - WrapperUtil.AddNotification(Language.Webinterface_Start_Success, NotificationType.Success); - } - else - { - WrapperUtil.AddNotification(Language.Webinterface_Start_Failed, NotificationType.Error); - } - }); - } - } - - ImGui.SameLine(); - - using (ImRaii.Disabled(!isActive || Plugin.ServerCore.IsStopping())) - { - if (ImGui.Button(Language.Webinterface_Button_Stop)) - { - Task.Run(async () => - { - var ok = await Plugin.ServerCore.Stop(); - if (ok) - WrapperUtil.AddNotification(Language.Webinterface_Stop_Success, NotificationType.Success); - else - WrapperUtil.AddNotification(Language.Webinterface_Stop_Failed, NotificationType.Error); - }); - } - } - - ImGui.AlignTextToFramePadding(); - ImGui.TextUnformatted(Language.Webinterface_Controls_Active); - ImGui.SameLine(); - using (Plugin.FontManager.FontAwesome.Push()) - using (ImRaii.PushColor(ImGuiCol.Text, isActive ? ImGuiColors.HealerGreen : ImGuiColors.DalamudRed)) - { - ImGui.TextUnformatted(isActive ? FontAwesomeIcon.Check.ToIconString() : FontAwesomeIcon.Times.ToIconString()); - } - - Uri? uri; - try { - uri = new Uri($"http://{System.Net.Dns.GetHostName()}:{Mutable.WebinterfacePort}/"); - } - catch(Exception) - { - uri = null; - } - - ImGui.AlignTextToFramePadding(); - ImGui.TextUnformatted(Language.Webinterface_Controls_Url); - ImGui.SameLine(); - if (uri is not null) - { - var clicked = false; - clicked |= ImGui.Selectable(uri.AbsoluteUri); - ImGui.SameLine(); - clicked |= ImGuiUtil.IconButton(FontAwesomeIcon.ExternalLinkAlt, "urlOpen"); - - if (clicked) - WrapperUtil.TryOpenUri(uri); - } - else - { - ImGui.TextUnformatted(Language.Options_Webinterface_Hostname_Fail); - } - - ImGuiUtil.WrappedTextWithColor(ImGuiColors.HealerGreen, Language.Options_Webinterface_Note); - } - - ImGui.Spacing(); - ImGui.Spacing(); - } -}