diff --git a/src/MaaWpfGui/Constants/ConfigurationKeys.cs b/src/MaaWpfGui/Constants/ConfigurationKeys.cs old mode 100644 new mode 100755 index 7e4f536578..f192219dd4 --- a/src/MaaWpfGui/Constants/ConfigurationKeys.cs +++ b/src/MaaWpfGui/Constants/ConfigurationKeys.cs @@ -174,6 +174,7 @@ namespace MaaWpfGui.Constants public const string CopilotLoopTimes = "Copilot.LoopTimes"; public const string CopilotTaskList = "Copilot.CopilotTaskList"; public const string UpdateProxy = "VersionUpdate.Proxy"; + public const string ProxyType = "VersionUpdate.ProxyType"; public const string VersionType = "VersionUpdate.VersionType"; public const string UpdateCheck = "VersionUpdate.UpdateCheck"; public const string UpdateAutoCheck = "VersionUpdate.ScheduledUpdateCheck"; diff --git a/src/MaaWpfGui/Services/Web/HttpService.cs b/src/MaaWpfGui/Services/Web/HttpService.cs old mode 100644 new mode 100755 index c25cd90e52..2574b14f3b --- a/src/MaaWpfGui/Services/Web/HttpService.cs +++ b/src/MaaWpfGui/Services/Web/HttpService.cs @@ -43,7 +43,7 @@ namespace MaaWpfGui.Services.Web return string.Empty; } - return p.Contains("://") ? p : $"http://{p}"; + return p.Contains("://") ? p : ConfigurationHelper.GetGlobalValue(ConfigurationKeys.ProxyType, "http") + $"://{p}"; } } diff --git a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs old mode 100644 new mode 100755 index d420e0cf25..3895ae56cb --- a/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/SettingsViewModel.cs @@ -3555,6 +3555,24 @@ namespace MaaWpfGui.ViewModels.UI } } + public List PorxyTypeList { get; } = + [ + new() { Display = "HTTP proxy", Value = "http" }, + new() { Display = "SOCKS5 proxy", Value = "socks5" }, + ]; + + string _proxyType = "http"; + + public string ProxyType + { + get => _proxyType; + set + { + SetAndNotify(ref _proxyType, value); + ConfigurationHelper.SetGlobalValue(ConfigurationKeys.ProxyType, value); + } + } + private bool _isCheckingForUpdates; /// diff --git a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml old mode 100644 new mode 100755 index 8ce72b207b..37fea48d6b --- a/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml +++ b/src/MaaWpfGui/Views/UserControl/VersionUpdateSettingsUserControl.xaml @@ -88,11 +88,14 @@ - + Width="120" + Margin="10" + DisplayMemberPath="Display" + ItemsSource="{Binding PorxyTypeList}" + SelectedValue="{Binding ProxyType}" + SelectedValuePath="Value" />