From 3dfe3ae2524d00af7f7f36e44208a78a0e47a9e3 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 1 Apr 2021 12:47:01 +0800 Subject: [PATCH] feature: add settings for avatar server --- src/App.preference.cs | 4 +++ src/Helpers/Avatar.cs | 2 +- src/Resources/Locales/en_US.xaml | 1 + src/Resources/Locales/zh_CN.xaml | 1 + src/UI/SettingDialog.xaml | 51 +++++++++++++++++++------------- src/UI/SettingDialog.xaml.cs | 35 ++++++++++++++++++++++ 6 files changed, 73 insertions(+), 21 deletions(-) diff --git a/src/App.preference.cs b/src/App.preference.cs index 29ed49e5..5263ce23 100644 --- a/src/App.preference.cs +++ b/src/App.preference.cs @@ -53,6 +53,10 @@ namespace SourceGit { /// public string Locale { get; set; } = "en_US"; /// + /// Base URL to get avatar + /// + public string AvatarServer { get; set; } = "https://www.gravatar.com/avatar"; + /// /// Main window width /// public double WindowWidth { get; set; } diff --git a/src/Helpers/Avatar.cs b/src/Helpers/Avatar.cs index 3ae7901a..c2bf1eba 100644 --- a/src/Helpers/Avatar.cs +++ b/src/Helpers/Avatar.cs @@ -157,7 +157,7 @@ namespace SourceGit.Helpers { Action job = () => { try { - HttpWebRequest req = WebRequest.CreateHttp("https://www.gravatar.com/avatar/" + md5 + "?d=404"); + HttpWebRequest req = WebRequest.CreateHttp(App.Setting.UI.AvatarServer + md5 + "?d=404"); req.Timeout = 2000; req.Method = "GET"; diff --git a/src/Resources/Locales/en_US.xaml b/src/Resources/Locales/en_US.xaml index 904bf9f1..cdc851ea 100644 --- a/src/Resources/Locales/en_US.xaml +++ b/src/Resources/Locales/en_US.xaml @@ -348,6 +348,7 @@ Display Language : Light Theme : Check for Update : + Avatar Server : GIT INSTANCE Install Path : Input path for git.exe diff --git a/src/Resources/Locales/zh_CN.xaml b/src/Resources/Locales/zh_CN.xaml index b0121cec..bc2f6903 100644 --- a/src/Resources/Locales/zh_CN.xaml +++ b/src/Resources/Locales/zh_CN.xaml @@ -348,6 +348,7 @@ 显示语言 : 启用浅色主题 : 检测更新 : + 头像服务 : GIT配置 安装路径 : 填写git.exe所在位置 diff --git a/src/UI/SettingDialog.xaml b/src/UI/SettingDialog.xaml index eac27771..98cd44ea 100644 --- a/src/UI/SettingDialog.xaml +++ b/src/UI/SettingDialog.xaml @@ -8,7 +8,7 @@ xmlns:app="clr-namespace:SourceGit" xmlns:git="clr-namespace:SourceGit.Git" mc:Ignorable="d" - Height="560" Width="500" + Height="588" Width="500" Title="{StaticResource Text.Preference}" WindowStartupLocation="CenterOwner" ResizeMode="NoResize"> @@ -63,6 +63,7 @@ + @@ -112,10 +113,20 @@ IsChecked="{Binding Source={x:Static app:App.Setting}, Path=CheckUpdate, Mode=TwoWay}" TextElement.FontStyle="Italic"/> +