mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-04-25 06:35:32 +00:00
feat: add configurable gravatar-compatible base URL (#2083)
This adds the ability to set a base URL for a Gravatar-compatible avatar service (Gravatar itself, or Libravatar, for instance). The default will be www.gravatar.com, so nothing will change from current behaviour unless the user explicitly configures another URL. Resolves #2082
This commit is contained in:
@@ -187,6 +187,7 @@ const (
|
||||
CorsMaxAge Key = `cors.maxage`
|
||||
|
||||
AvatarGravaterExpiration Key = `avatar.gravatarexpiration`
|
||||
AvatarGravatarBaseURL Key = `avatar.gravatarbaseurl`
|
||||
|
||||
BackgroundsEnabled Key = `backgrounds.enabled`
|
||||
BackgroundsUploadEnabled Key = `backgrounds.providers.upload.enabled`
|
||||
@@ -456,6 +457,7 @@ func InitDefaultConfig() {
|
||||
MigrationMicrosoftTodoEnable.setDefault(false)
|
||||
// Avatar
|
||||
AvatarGravaterExpiration.setDefault(3600)
|
||||
AvatarGravatarBaseURL.setDefault("https://www.gravatar.com")
|
||||
// Project Backgrounds
|
||||
BackgroundsEnabled.setDefault(true)
|
||||
BackgroundsUploadEnabled.setDefault(true)
|
||||
@@ -605,6 +607,12 @@ func InitConfig() {
|
||||
|
||||
readConfigValuesFromFiles()
|
||||
|
||||
if _, err := url.ParseRequestURI(AvatarGravatarBaseURL.GetString()); err != nil {
|
||||
log.Fatalf("Could not parse gravatarbaseurl: %s", err)
|
||||
}
|
||||
|
||||
AvatarGravatarBaseURL.Set(strings.TrimRight(AvatarGravatarBaseURL.GetString(), "/"))
|
||||
|
||||
if RateLimitStore.GetString() == "keyvalue" {
|
||||
RateLimitStore.Set(KeyvalueType.GetString())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user