summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/api.go1
-rw-r--r--routers/api/v1/misc/settings.go17
-rw-r--r--routers/api/v1/swagger/misc.go7
3 files changed, 25 insertions, 0 deletions
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index 0567c3560c..f356d7a2bc 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -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
diff --git a/routers/api/v1/misc/settings.go b/routers/api/v1/misc/settings.go
index e9493050ca..925cde835c 100644
--- a/routers/api/v1/misc/settings.go
+++ b/routers/api/v1/misc/settings.go
@@ -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,
+ })
+}
diff --git a/routers/api/v1/swagger/misc.go b/routers/api/v1/swagger/misc.go
index 1d3c257efa..50f5cbdbf5 100644
--- a/routers/api/v1/swagger/misc.go
+++ b/routers/api/v1/swagger/misc.go
@@ -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"`
+}