diff options
Diffstat (limited to 'routers/api')
-rw-r--r-- | routers/api/v1/api.go | 1 | ||||
-rw-r--r-- | routers/api/v1/settings/settings.go | 18 | ||||
-rw-r--r-- | routers/api/v1/swagger/settings.go | 7 |
3 files changed, 26 insertions, 0 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 027c6abc97..5f472f3518 100644 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -522,6 +522,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Group("/settings", func() { m.Get("/ui", settings.GetGeneralUISettings) m.Get("/api", settings.GetGeneralAPISettings) + m.Get("/attachment", settings.GetGeneralAttachmentSettings) m.Get("/repository", settings.GetGeneralRepoSettings) }) diff --git a/routers/api/v1/settings/settings.go b/routers/api/v1/settings/settings.go index 7ec0d74c83..29210751d6 100644 --- a/routers/api/v1/settings/settings.go +++ b/routers/api/v1/settings/settings.go @@ -60,3 +60,21 @@ func GetGeneralRepoSettings(ctx *context.APIContext) { HTTPGitDisabled: setting.Repository.DisableHTTPGit, }) } + +// GetGeneralAttachmentSettings returns instance's global settings for Attachment +func GetGeneralAttachmentSettings(ctx *context.APIContext) { + // swagger:operation GET /settings/Attachment settings getGeneralAttachmentSettings + // --- + // summary: Get instance's global settings for Attachment + // produces: + // - application/json + // responses: + // "200": + // "$ref": "#/responses/GeneralAttachmentSettings" + ctx.JSON(http.StatusOK, api.GeneralAttachmentSettings{ + Enabled: setting.Attachment.Enabled, + AllowedTypes: setting.Attachment.AllowedTypes, + MaxFiles: setting.Attachment.MaxFiles, + MaxSize: setting.Attachment.MaxSize, + }) +} diff --git a/routers/api/v1/swagger/settings.go b/routers/api/v1/swagger/settings.go index ad0d891dde..4bf153cb9c 100644 --- a/routers/api/v1/swagger/settings.go +++ b/routers/api/v1/swagger/settings.go @@ -26,3 +26,10 @@ type swaggerResponseGeneralAPISettings struct { // in:body Body api.GeneralAPISettings `json:"body"` } + +// GeneralAttachmentSettings +// swagger:response GeneralAttachmentSettings +type swaggerResponseGeneralAttachmentSettings struct { + // in:body + Body api.GeneralAttachmentSettings `json:"body"` +} |