File tree Expand file tree Collapse file tree 5 files changed +74
-0
lines changed Expand file tree Collapse file tree 5 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright 2020 The Gitea Authors. All rights reserved.
2+ // Use of this source code is governed by a MIT-style
3+ // license that can be found in the LICENSE file.
4+
5+ package structs
6+
7+ // GeneralRepoSettings contains global repository settings exposed by API
8+ type GeneralRepoSettings struct {
9+ MirrorsDisabled bool `json:"mirrors_disabled"`
10+ HTTPGitDisabled bool `json:"http_git_disabled"`
11+ }
Original file line number Diff line number Diff line change @@ -514,6 +514,7 @@ func RegisterRoutes(m *macaron.Macaron) {
514514 m .Post ("/markdown/raw" , misc .MarkdownRaw )
515515 m .Group ("/settings" , func () {
516516 m .Get ("/allowed_reactions" , misc .SettingGetsAllowedReactions )
517+ m .Get ("/repository" , misc .GetGeneralRepoSettings )
517518 })
518519
519520 // Notifications
Original file line number Diff line number Diff line change 99
1010 "code.gitea.io/gitea/modules/context"
1111 "code.gitea.io/gitea/modules/setting"
12+ api "code.gitea.io/gitea/modules/structs"
1213)
1314
1415// SettingGetsAllowedReactions return allowed reactions
@@ -23,3 +24,19 @@ func SettingGetsAllowedReactions(ctx *context.APIContext) {
2324 // "$ref": "#/responses/StringSlice"
2425 ctx .JSON (http .StatusOK , setting .UI .Reactions )
2526}
27+
28+ // GetGeneralRepoSettings returns instance's global settings for repositories
29+ func GetGeneralRepoSettings (ctx * context.APIContext ) {
30+ // swagger:operation GET /settings/repository miscellaneous getGeneralRepositorySettings
31+ // ---
32+ // summary: Get instance's global settings for repositories
33+ // produces:
34+ // - application/json
35+ // responses:
36+ // "200":
37+ // "$ref": "#/responses/GeneralRepoSettings"
38+ ctx .JSON (http .StatusOK , api.GeneralRepoSettings {
39+ MirrorsDisabled : setting .Repository .DisableMirrors ,
40+ HTTPGitDisabled : setting .Repository .DisableHTTPGit ,
41+ })
42+ }
Original file line number Diff line number Diff line change @@ -21,3 +21,10 @@ type swaggerResponseStringSlice struct {
2121 // in:body
2222 Body []string `json:"body"`
2323}
24+
25+ // GeneralRepoSettings
26+ // swagger:response GeneralRepoSettings
27+ type swaggerResponseGeneralRepoSettings struct {
28+ // in:body
29+ Body api.GeneralRepoSettings `json:"body"`
30+ }
Original file line number Diff line number Diff line change 84878487 }
84888488 }
84898489 },
8490+ "/settings/repository": {
8491+ "get": {
8492+ "produces": [
8493+ "application/json"
8494+ ],
8495+ "tags": [
8496+ "miscellaneous"
8497+ ],
8498+ "summary": "Get instance's global settings for repositories",
8499+ "operationId": "getGeneralRepositorySettings",
8500+ "responses": {
8501+ "200": {
8502+ "$ref": "#/responses/GeneralRepoSettings"
8503+ }
8504+ }
8505+ }
8506+ },
84908507 "/signing-key.gpg": {
84918508 "get": {
84928509 "produces": [
1272112738 },
1272212739 "x-go-package": "code.gitea.io/gitea/modules/structs"
1272312740 },
12741+ "GeneralRepoSettings": {
12742+ "description": "GeneralRepoSettings contains global repository settings exposed by API",
12743+ "type": "object",
12744+ "properties": {
12745+ "http_git_disabled": {
12746+ "type": "boolean",
12747+ "x-go-name": "HTTPGitDisabled"
12748+ },
12749+ "mirrors_disabled": {
12750+ "type": "boolean",
12751+ "x-go-name": "MirrorsDisabled"
12752+ }
12753+ },
12754+ "x-go-package": "code.gitea.io/gitea/modules/structs"
12755+ },
1272412756 "GitBlobResponse": {
1272512757 "description": "GitBlobResponse represents a git blob",
1272612758 "type": "object",
1489014922 }
1489114923 }
1489214924 },
14925+ "GeneralRepoSettings": {
14926+ "description": "GeneralRepoSettings",
14927+ "schema": {
14928+ "$ref": "#/definitions/GeneralRepoSettings"
14929+ }
14930+ },
1489314931 "GitBlobResponse": {
1489414932 "description": "GitBlobResponse",
1489514933 "schema": {
You can’t perform that action at this time.
0 commit comments