diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/setting/setting.go | 24 | ||||
-rw-r--r-- | modules/structs/repo.go | 1 |
2 files changed, 17 insertions, 8 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go index de89c67d04..9e96105788 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -250,14 +250,16 @@ var ( } // Picture settings - AvatarUploadPath string - AvatarMaxWidth int - AvatarMaxHeight int - GravatarSource string - GravatarSourceURL *url.URL - DisableGravatar bool - EnableFederatedAvatar bool - LibravatarService *libravatar.Libravatar + AvatarUploadPath string + AvatarMaxWidth int + AvatarMaxHeight int + GravatarSource string + GravatarSourceURL *url.URL + DisableGravatar bool + EnableFederatedAvatar bool + LibravatarService *libravatar.Libravatar + AvatarMaxFileSize int64 + RepositoryAvatarUploadPath string // Log settings LogLevel string @@ -835,8 +837,14 @@ func NewContext() { if !filepath.IsAbs(AvatarUploadPath) { AvatarUploadPath = path.Join(AppWorkPath, AvatarUploadPath) } + RepositoryAvatarUploadPath = sec.Key("REPOSITORY_AVATAR_UPLOAD_PATH").MustString(path.Join(AppDataPath, "repo-avatars")) + forcePathSeparator(RepositoryAvatarUploadPath) + if !filepath.IsAbs(RepositoryAvatarUploadPath) { + RepositoryAvatarUploadPath = path.Join(AppWorkPath, RepositoryAvatarUploadPath) + } AvatarMaxWidth = sec.Key("AVATAR_MAX_WIDTH").MustInt(4096) AvatarMaxHeight = sec.Key("AVATAR_MAX_HEIGHT").MustInt(3072) + AvatarMaxFileSize = sec.Key("AVATAR_MAX_FILE_SIZE").MustInt64(1048576) switch source := sec.Key("GRAVATAR_SOURCE").MustString("gravatar"); source { case "duoshuo": GravatarSource = "http://gravatar.duoshuo.com/avatar/" diff --git a/modules/structs/repo.go b/modules/structs/repo.go index b5283beeaa..19f5ff8afe 100644 --- a/modules/structs/repo.go +++ b/modules/structs/repo.go @@ -43,6 +43,7 @@ type Repository struct { // swagger:strfmt date-time Updated time.Time `json:"updated_at"` Permissions *Permission `json:"permissions,omitempty"` + AvatarURL string `json:"avatar_url"` } // CreateRepoOption options when creating repository |