File tree Expand file tree Collapse file tree 5 files changed +81
-0
lines changed Expand file tree Collapse file tree 5 files changed +81
-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 general repo settings exposed by api
8
+ type GeneralRepoSettings struct {
9
+ MirrorsDisabled bool `json:"mirrors_disabled"`
10
+ HTTPGitDisabled bool `json:"http_git_disabled"`
11
+ MaxCreationLimit int `json:"max_creation_limit"`
12
+ }
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,20 @@ func SettingGetsAllowedReactions(ctx *context.APIContext) {
23
24
// "$ref": "#/responses/StringSlice"
24
25
ctx .JSON (http .StatusOK , setting .UI .Reactions )
25
26
}
27
+
28
+ // GetGeneralRepoSettings return general repo settings
29
+ func GetGeneralRepoSettings (ctx * context.APIContext ) {
30
+ // swagger:operation GET /settings/repository miscellaneous getGeneralRepositorySettings
31
+ // ---
32
+ // summary: get general repo settings
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
+ MaxCreationLimit : setting .Repository .MaxCreationLimit ,
42
+ })
43
+ }
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 general repo settings",
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": [
12713
12730
},
12714
12731
"x-go-package": "code.gitea.io/gitea/modules/structs"
12715
12732
},
12733
+ "GeneralRepoSettings": {
12734
+ "description": "GeneralRepoSettings contains general repo settings exposed by api",
12735
+ "type": "object",
12736
+ "properties": {
12737
+ "http_git_disabled": {
12738
+ "type": "boolean",
12739
+ "x-go-name": "HTTPGitDisabled"
12740
+ },
12741
+ "max_creation_limit": {
12742
+ "type": "integer",
12743
+ "format": "int64",
12744
+ "x-go-name": "MaxCreationLimit"
12745
+ },
12746
+ "mirrors_disabled": {
12747
+ "type": "boolean",
12748
+ "x-go-name": "MirrorsDisabled"
12749
+ }
12750
+ },
12751
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
12752
+ },
12716
12753
"GitBlobResponse": {
12717
12754
"description": "GitBlobResponse represents a git blob",
12718
12755
"type": "object",
14882
14919
}
14883
14920
}
14884
14921
},
14922
+ "GeneralRepoSettings": {
14923
+ "description": "GeneralRepoSettings",
14924
+ "schema": {
14925
+ "$ref": "#/definitions/GeneralRepoSettings"
14926
+ }
14927
+ },
14885
14928
"GitBlobResponse": {
14886
14929
"description": "GitBlobResponse",
14887
14930
"schema": {
You can’t perform that action at this time.
0 commit comments