2020-06-04 18:16:53 +09:00
|
|
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2020-06-23 03:21:31 +09:00
|
|
|
package settings
|
2020-06-04 18:16:53 +09:00
|
|
|
|
|
|
|
import (
|
2020-06-05 03:06:24 +09:00
|
|
|
"net/http"
|
|
|
|
|
2020-06-04 18:16:53 +09:00
|
|
|
"code.gitea.io/gitea/modules/context"
|
|
|
|
"code.gitea.io/gitea/modules/setting"
|
2020-06-10 21:05:46 +09:00
|
|
|
api "code.gitea.io/gitea/modules/structs"
|
2020-06-04 18:16:53 +09:00
|
|
|
)
|
|
|
|
|
2020-06-23 03:21:31 +09:00
|
|
|
// GetGeneralUISettings returns instance's global settings for ui
|
|
|
|
func GetGeneralUISettings(ctx *context.APIContext) {
|
|
|
|
// swagger:operation GET /settings/ui settings getGeneralUISettings
|
2020-06-04 18:16:53 +09:00
|
|
|
// ---
|
2020-06-23 03:21:31 +09:00
|
|
|
// summary: Get instance's global settings for ui
|
2020-06-04 18:16:53 +09:00
|
|
|
// produces:
|
|
|
|
// - application/json
|
|
|
|
// responses:
|
|
|
|
// "200":
|
2020-06-23 03:21:31 +09:00
|
|
|
// "$ref": "#/responses/GeneralUISettings"
|
|
|
|
ctx.JSON(http.StatusOK, api.GeneralUISettings{
|
2020-12-03 21:53:21 +09:00
|
|
|
DefaultTheme: setting.UI.DefaultTheme,
|
2020-06-23 03:21:31 +09:00
|
|
|
AllowedReactions: setting.UI.Reactions,
|
|
|
|
})
|
2020-06-04 18:16:53 +09:00
|
|
|
}
|
2020-06-10 21:05:46 +09:00
|
|
|
|
2020-09-05 03:10:15 +09:00
|
|
|
// GetGeneralAPISettings returns instance's global settings for api
|
|
|
|
func GetGeneralAPISettings(ctx *context.APIContext) {
|
|
|
|
// swagger:operation GET /settings/api settings getGeneralAPISettings
|
|
|
|
// ---
|
|
|
|
// summary: Get instance's global settings for api
|
|
|
|
// produces:
|
|
|
|
// - application/json
|
|
|
|
// responses:
|
|
|
|
// "200":
|
|
|
|
// "$ref": "#/responses/GeneralAPISettings"
|
|
|
|
ctx.JSON(http.StatusOK, api.GeneralAPISettings{
|
|
|
|
MaxResponseItems: setting.API.MaxResponseItems,
|
|
|
|
DefaultPagingNum: setting.API.DefaultPagingNum,
|
|
|
|
DefaultGitTreesPerPage: setting.API.DefaultGitTreesPerPage,
|
|
|
|
DefaultMaxBlobSize: setting.API.DefaultMaxBlobSize,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-06-10 21:05:46 +09:00
|
|
|
// GetGeneralRepoSettings returns instance's global settings for repositories
|
|
|
|
func GetGeneralRepoSettings(ctx *context.APIContext) {
|
2020-06-23 03:21:31 +09:00
|
|
|
// swagger:operation GET /settings/repository settings getGeneralRepositorySettings
|
2020-06-10 21:05:46 +09:00
|
|
|
// ---
|
|
|
|
// summary: Get instance's global settings for repositories
|
|
|
|
// produces:
|
|
|
|
// - application/json
|
|
|
|
// responses:
|
|
|
|
// "200":
|
|
|
|
// "$ref": "#/responses/GeneralRepoSettings"
|
|
|
|
ctx.JSON(http.StatusOK, api.GeneralRepoSettings{
|
|
|
|
MirrorsDisabled: setting.Repository.DisableMirrors,
|
|
|
|
HTTPGitDisabled: setting.Repository.DisableHTTPGit,
|
|
|
|
})
|
|
|
|
}
|
2020-09-05 16:43:06 +09:00
|
|
|
|
|
|
|
// GetGeneralAttachmentSettings returns instance's global settings for Attachment
|
|
|
|
func GetGeneralAttachmentSettings(ctx *context.APIContext) {
|
2020-10-07 01:16:16 +09:00
|
|
|
// swagger:operation GET /settings/attachment settings getGeneralAttachmentSettings
|
2020-09-05 16:43:06 +09:00
|
|
|
// ---
|
|
|
|
// 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,
|
|
|
|
})
|
|
|
|
}
|