Add config options for task attachments (#125)
Add config options for task attachments Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/api/pulls/125
This commit is contained in:
parent
b2b1546a8f
commit
fc65052ba0
5 changed files with 41 additions and 31 deletions
|
@ -24,6 +24,8 @@ service:
|
|||
enablelinksharing: true
|
||||
# Whether to let new users registering themselves or not
|
||||
enableregistration: true
|
||||
# Whether to enable task attachments or not
|
||||
enabletaskattachments: true
|
||||
|
||||
database:
|
||||
# Database type to use. Supported types are mysql and sqlite.
|
||||
|
|
|
@ -67,6 +67,8 @@ service:
|
|||
enablelinksharing: true
|
||||
# Whether to let new users registering themselves or not
|
||||
enableregistration: true
|
||||
# Whether to enable task attachments or not
|
||||
enabletaskattachments: true
|
||||
|
||||
database:
|
||||
# Database type to use. Supported types are mysql and sqlite.
|
||||
|
|
|
@ -43,6 +43,7 @@ const (
|
|||
ServiceMotd Key = `service.motd`
|
||||
ServiceEnableLinkSharing Key = `service.enablelinksharing`
|
||||
ServiceEnableRegistration Key = `service.enableregistration`
|
||||
ServiceEnableTaskAttachments Key = `service.enabletaskattachments`
|
||||
|
||||
DatabaseType Key = `database.type`
|
||||
DatabaseHost Key = `database.host`
|
||||
|
@ -166,6 +167,7 @@ func InitDefaultConfig() {
|
|||
ServiceMotd.setDefault("")
|
||||
ServiceEnableLinkSharing.setDefault(true)
|
||||
ServiceEnableRegistration.setDefault(true)
|
||||
ServiceEnableTaskAttachments.setDefault(true)
|
||||
|
||||
// Database
|
||||
DatabaseType.setDefault("sqlite")
|
||||
|
|
|
@ -31,6 +31,7 @@ type vikunjaInfos struct {
|
|||
MaxFileSize string `json:"max_file_size"`
|
||||
RegistrationEnabled bool `json:"registration_enabled"`
|
||||
AvailableMigrators []string `json:"available_migrators"`
|
||||
TaskAttachmentsEnabled bool `json:"task_attachments_enabled"`
|
||||
}
|
||||
|
||||
// Info is the handler to get infos about this vikunja instance
|
||||
|
@ -48,6 +49,7 @@ func Info(c echo.Context) error {
|
|||
LinkSharingEnabled: config.ServiceEnableLinkSharing.GetBool(),
|
||||
MaxFileSize: config.FilesMaxSize.GetString(),
|
||||
RegistrationEnabled: config.ServiceEnableRegistration.GetBool(),
|
||||
TaskAttachmentsEnabled: config.ServiceEnableTaskAttachments.GetBool(),
|
||||
}
|
||||
if config.MigrationWunderlistEnable.GetBool() {
|
||||
infos.AvailableMigrators = append(infos.AvailableMigrators, "wunderlist")
|
||||
|
|
|
@ -288,6 +288,7 @@ func registerAPIRoutes(a *echo.Group) {
|
|||
a.PUT("/tasks/:task/relations", taskRelationHandler.CreateWeb)
|
||||
a.DELETE("/tasks/:task/relations", taskRelationHandler.DeleteWeb)
|
||||
|
||||
if config.ServiceEnableTaskAttachments.GetBool() {
|
||||
taskAttachmentHandler := &handler.WebHandler{
|
||||
EmptyStruct: func() handler.CObject {
|
||||
return &models.TaskAttachment{}
|
||||
|
@ -297,6 +298,7 @@ func registerAPIRoutes(a *echo.Group) {
|
|||
a.DELETE("/tasks/:task/attachments/:attachment", taskAttachmentHandler.DeleteWeb)
|
||||
a.PUT("/tasks/:task/attachments", apiv1.UploadTaskAttachment)
|
||||
a.GET("/tasks/:task/attachments/:attachment", apiv1.GetTaskAttachment)
|
||||
}
|
||||
|
||||
labelHandler := &handler.WebHandler{
|
||||
EmptyStruct: func() handler.CObject {
|
||||
|
|
Loading…
Reference in a new issue