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) {
514
514
m .Post ("/markdown/raw" , misc .MarkdownRaw )
515
515
m .Group ("/settings" , func () {
516
516
m .Get ("/allowed_reactions" , misc .SettingGetsAllowedReactions )
517
+ m .Get ("/repository" , misc .GetGeneralRepoSettings )
517
518
})
518
519
519
520
// Notifications
Original file line number Diff line number Diff line change 9
9
10
10
"code.gitea.io/gitea/modules/context"
11
11
"code.gitea.io/gitea/modules/setting"
12
+ api "code.gitea.io/gitea/modules/structs"
12
13
)
13
14
14
15
// SettingGetsAllowedReactions return allowed reactions
@@ -23,3 +24,19 @@ func SettingGetsAllowedReactions(ctx *context.APIContext) {
23
24
// "$ref": "#/responses/StringSlice"
24
25
ctx .JSON (http .StatusOK , setting .UI .Reactions )
25
26
}
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 {
21
21
// in:body
22
22
Body []string `json:"body"`
23
23
}
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 8487
8487
}
8488
8488
}
8489
8489
},
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
+ },
8490
8507
"/signing-key.gpg": {
8491
8508
"get": {
8492
8509
"produces": [
12721
12738
},
12722
12739
"x-go-package": "code.gitea.io/gitea/modules/structs"
12723
12740
},
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
+ },
12724
12756
"GitBlobResponse": {
12725
12757
"description": "GitBlobResponse represents a git blob",
12726
12758
"type": "object",
14890
14922
}
14891
14923
}
14892
14924
},
14925
+ "GeneralRepoSettings": {
14926
+ "description": "GeneralRepoSettings",
14927
+ "schema": {
14928
+ "$ref": "#/definitions/GeneralRepoSettings"
14929
+ }
14930
+ },
14893
14931
"GitBlobResponse": {
14894
14932
"description": "GitBlobResponse",
14895
14933
"schema": {
You can’t perform that action at this time.
0 commit comments