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"/>
+
+
+
-
-
-
+
+
+
@@ -130,8 +141,8 @@
-
-
+
+
@@ -148,13 +159,13 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
-
-
+
+
@@ -198,8 +209,8 @@
-
-
+
diff --git a/src/UI/SettingDialog.xaml.cs b/src/UI/SettingDialog.xaml.cs
index edf551a3..65aaf767 100644
--- a/src/UI/SettingDialog.xaml.cs
+++ b/src/UI/SettingDialog.xaml.cs
@@ -63,6 +63,19 @@ namespace SourceGit.UI {
}
}
+ ///
+ /// Avatar server
+ ///
+ public class AvatarServer {
+ public string Value { get; set; }
+ public string Desc { get; set; }
+
+ public AvatarServer(string v, string d) {
+ Value = v;
+ Desc = d;
+ }
+ }
+
///
/// Constructor.
///
@@ -81,6 +94,13 @@ namespace SourceGit.UI {
cmbLang.ItemsSource = locales;
cmbLang.SelectedItem = locales.Find(o => o.Value == App.Setting.UI.Locale);
+ var avatarServers = new List() {
+ new AvatarServer("https://www.gravatar.com/avatar/", "Gravatar官网"),
+ new AvatarServer("https://cdn.s.loli.top/avatar/", "Gravatar中国CDN"),
+ };
+ cmbAvatarServer.ItemsSource = avatarServers;
+ cmbAvatarServer.SelectedItem = avatarServers.Find(o => o.Value == App.Setting.UI.AvatarServer);
+
int mergeType = App.Setting.Tools.MergeTool;
var merger = Git.MergeTool.Supported[mergeType];
txtMergePath.IsReadOnly = !merger.IsConfigured;
@@ -126,6 +146,21 @@ namespace SourceGit.UI {
App.SaveSetting();
}
+ ///
+ /// Set avatar server.
+ ///
+ ///
+ ///
+ private void ChangeAvatarServer(object sender, SelectionChangedEventArgs e) {
+ if (e.AddedItems.Count != 1) return;
+
+ var s = e.AddedItems[0] as AvatarServer;
+ if (s == null) return;
+
+ App.Setting.UI.AvatarServer = s.Value;
+ App.SaveSetting();
+ }
+
///
/// Select git executable file path.
///