Add numeric avatars
|
@ -262,7 +262,7 @@ func (c *Collection) ForPublic() {
|
||||||
c.URL = c.CanonicalURL()
|
c.URL = c.CanonicalURL()
|
||||||
}
|
}
|
||||||
|
|
||||||
var isLowerLetter = regexp.MustCompile("[a-z]").MatchString
|
var isAvatarChar = regexp.MustCompile("[a-z0-9]").MatchString
|
||||||
|
|
||||||
func (c *Collection) PersonObject(ids ...int64) *activitystreams.Person {
|
func (c *Collection) PersonObject(ids ...int64) *activitystreams.Person {
|
||||||
accountRoot := c.FederatedAccount()
|
accountRoot := c.FederatedAccount()
|
||||||
|
@ -297,7 +297,7 @@ func (c *Collection) PersonObject(ids ...int64) *activitystreams.Person {
|
||||||
|
|
||||||
func (c *Collection) AvatarURL() string {
|
func (c *Collection) AvatarURL() string {
|
||||||
fl := string(unicode.ToLower([]rune(c.DisplayTitle())[0]))
|
fl := string(unicode.ToLower([]rune(c.DisplayTitle())[0]))
|
||||||
if !isLowerLetter(fl) {
|
if !isAvatarChar(fl) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return hostName + "/img/avatars/" + fl + ".png"
|
return hostName + "/img/avatars/" + fl + ".png"
|
||||||
|
|
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 7.7 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 9.2 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 16 KiB |