@ -62,6 +62,7 @@ const (
|
||||
ServiceTestingtoken Key = `service.testingtoken`
|
||||
ServiceEnableEmailReminders Key = `service.enableemailreminders`
|
||||
ServiceEnableUserDeletion Key = `service.enableuserdeletion`
|
||||
ServiceMaxAvatarSize Key = `service.maxavatarsize`
|
||||
|
||||
AuthLocalEnabled Key = `auth.local.enabled`
|
||||
AuthOpenIDEnabled Key = `auth.openid.enabled`
|
||||
@ -287,6 +288,7 @@ func InitDefaultConfig() {
|
||||
ServiceEnableTotp.setDefault(true)
|
||||
ServiceEnableEmailReminders.setDefault(true)
|
||||
ServiceEnableUserDeletion.setDefault(true)
|
||||
ServiceMaxAvatarSize.setDefault(1024)
|
||||
|
||||
// Auth
|
||||
AuthLocalEnabled.setDefault(true)
|
||||
|
@ -17,6 +17,7 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"code.vikunja.io/api/pkg/config"
|
||||
"code.vikunja.io/api/pkg/db"
|
||||
"code.vikunja.io/api/pkg/files"
|
||||
"code.vikunja.io/api/pkg/log"
|
||||
@ -49,7 +50,7 @@ import (
|
||||
// @tags user
|
||||
// @Produce octet-stream
|
||||
// @Param username path string true "The username of the user who's avatar you want to get"
|
||||
// @Param size query int false "The size of the avatar you want to get"
|
||||
// @Param size query int false "The size of the avatar you want to get. If bigger than the max configured size this will be adjusted to the maximum size."
|
||||
// @Success 200 {} blob "The avatar"
|
||||
// @Failure 404 {object} models.Message "The user does not exist."
|
||||
// @Failure 500 {object} models.Message "Internal error"
|
||||
@ -97,6 +98,9 @@ func GetAvatar(c echo.Context) error {
|
||||
return handler.HandleHTTPError(err, c)
|
||||
}
|
||||
}
|
||||
if sizeInt > config.ServiceMaxAvatarSize.GetInt64() {
|
||||
sizeInt = config.ServiceMaxAvatarSize.GetInt64()
|
||||
}
|
||||
|
||||
// Get the avatar
|
||||
a, mimeType, err := avatarProvider.GetAvatar(u, sizeInt)
|
||||
|
@ -7537,7 +7537,7 @@ const docTemplate = `{
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "The size of the avatar you want to get",
|
||||
"description": "The size of the avatar you want to get. If bigger than the max configured size this will be adjusted to the maximum size.",
|
||||
"name": "size",
|
||||
"in": "query"
|
||||
}
|
||||
|
@ -7528,7 +7528,7 @@
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "The size of the avatar you want to get",
|
||||
"description": "The size of the avatar you want to get. If bigger than the max configured size this will be adjusted to the maximum size.",
|
||||
"name": "size",
|
||||
"in": "query"
|
||||
}
|
||||
|
@ -1433,7 +1433,8 @@ paths:
|
||||
name: username
|
||||
required: true
|
||||
type: string
|
||||
- description: The size of the avatar you want to get
|
||||
- description: The size of the avatar you want to get. If bigger than the max
|
||||
configured size this will be adjusted to the maximum size.
|
||||
in: query
|
||||
name: size
|
||||
type: integer
|
||||
|
Reference in New Issue
Block a user