@@ -35,23 +35,24 @@ public static AvatarManager Instance
3535
3636 private static AvatarManager _instance = null ;
3737
38- [ GeneratedRegex ( @"^(?:(\d+)\+)?(.+?)@users\.noreply \.github\.com$" ) ]
38+ [ GeneratedRegex ( @"^(?:(\d+)\+)?(.+?)@.+ \.github\.com$" ) ]
3939 private static partial Regex REG_GITHUB_USER_EMAIL ( ) ;
4040
4141 private object _synclock = new object ( ) ;
4242 private string _storePath ;
4343 private List < IAvatarHost > _avatars = new List < IAvatarHost > ( ) ;
4444 private Dictionary < string , Bitmap > _resources = new Dictionary < string , Bitmap > ( ) ;
4545 private HashSet < string > _requesting = new HashSet < string > ( ) ;
46+ private HashSet < string > _defaultAvatars = new HashSet < string > ( ) ;
4647
4748 public void Start ( )
4849 {
4950 _storePath = Path . Combine ( Native . OS . DataDir , "avatars" ) ;
5051 if ( ! Directory . Exists ( _storePath ) )
5152 Directory . CreateDirectory ( _storePath ) ;
5253
53- var icon = AssetLoader . Open ( new Uri ( $ "avares://SourceGit/Resources/Images/ github.png ", UriKind . RelativeOrAbsolute ) ) ;
54- _resources . Add ( "noreply@github .com", new Bitmap ( icon ) ) ;
54+ LoadDefaultAvatar ( "noreply@ github.com ", "github.png" ) ;
55+ LoadDefaultAvatar ( "unrealbot@epicgames .com", "unreal.png" ) ;
5556
5657 Task . Run ( ( ) =>
5758 {
@@ -140,7 +141,7 @@ public Bitmap Request(string email, bool forceRefetch)
140141 {
141142 if ( forceRefetch )
142143 {
143- if ( email . Equals ( "noreply@github.com" , StringComparison . Ordinal ) )
144+ if ( _defaultAvatars . Contains ( email ) )
144145 return null ;
145146
146147 if ( _resources . ContainsKey ( email ) )
@@ -185,6 +186,13 @@ public Bitmap Request(string email, bool forceRefetch)
185186 return null ;
186187 }
187188
189+ private void LoadDefaultAvatar ( string key , string img )
190+ {
191+ var icon = AssetLoader . Open ( new Uri ( $ "avares://SourceGit/Resources/Images/{ img } ", UriKind . RelativeOrAbsolute ) ) ;
192+ _resources . Add ( key , new Bitmap ( icon ) ) ;
193+ _defaultAvatars . Add ( key ) ;
194+ }
195+
188196 private string GetEmailHash ( string email )
189197 {
190198 var lowered = email . ToLower ( CultureInfo . CurrentCulture ) . Trim ( ) ;
0 commit comments