mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
API expose usefull General Repo settings settings (#11758)
* GeneralRepoSettings expose MirrorsDisabled, HTTPGitDisabled, MaxCreationLimit * Apply suggestions from code review Co-authored-by: proton <25139420+proton-ab@users.noreply.github.com> * lint Co-authored-by: proton <25139420+proton-ab@users.noreply.github.com>
This commit is contained in:
@@ -514,6 +514,7 @@ func RegisterRoutes(m *macaron.Macaron) {
|
||||
m.Post("/markdown/raw", misc.MarkdownRaw)
|
||||
m.Group("/settings", func() {
|
||||
m.Get("/allowed_reactions", misc.SettingGetsAllowedReactions)
|
||||
m.Get("/repository", misc.GetGeneralRepoSettings)
|
||||
})
|
||||
|
||||
// Notifications
|
||||
|
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
)
|
||||
|
||||
// SettingGetsAllowedReactions return allowed reactions
|
||||
@@ -23,3 +24,19 @@ func SettingGetsAllowedReactions(ctx *context.APIContext) {
|
||||
// "$ref": "#/responses/StringSlice"
|
||||
ctx.JSON(http.StatusOK, setting.UI.Reactions)
|
||||
}
|
||||
|
||||
// GetGeneralRepoSettings returns instance's global settings for repositories
|
||||
func GetGeneralRepoSettings(ctx *context.APIContext) {
|
||||
// swagger:operation GET /settings/repository miscellaneous getGeneralRepositorySettings
|
||||
// ---
|
||||
// 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,
|
||||
})
|
||||
}
|
||||
|
@@ -21,3 +21,10 @@ type swaggerResponseStringSlice struct {
|
||||
// in:body
|
||||
Body []string `json:"body"`
|
||||
}
|
||||
|
||||
// GeneralRepoSettings
|
||||
// swagger:response GeneralRepoSettings
|
||||
type swaggerResponseGeneralRepoSettings struct {
|
||||
// in:body
|
||||
Body api.GeneralRepoSettings `json:"body"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user