summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/settings
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2020-06-22 20:21:31 +0200
committerGitHub <noreply@github.com>2020-06-22 14:21:31 -0400
commitfc2f2c7602c0bea8de76172f6d3303eab374a01e (patch)
treea3cbccd543b846ff5410248caf5110022bfc38ca /routers/api/v1/settings
parentb948ecb2d29bfe373d966d10a33e7c195eb47da4 (diff)
downloadgitea-fc2f2c7602c0bea8de76172f6d3303eab374a01e.tar.gz
gitea-fc2f2c7602c0bea8de76172f6d3303eab374a01e.zip
API: Move AllowedReactions endpoint into GetGenneralUI endpoint + creat new swagger section settings (#11854)
* move Setting function into its own package * swagger add&use new section "settings" * move api AllowedReactions into general UI-Settings endpoint * prepare TEST * lint
Diffstat (limited to 'routers/api/v1/settings')
-rw-r--r--routers/api/v1/settings/settings.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/routers/api/v1/settings/settings.go b/routers/api/v1/settings/settings.go
new file mode 100644
index 0000000000..8403a51d3e
--- /dev/null
+++ b/routers/api/v1/settings/settings.go
@@ -0,0 +1,44 @@
+// Copyright 2020 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package settings
+
+import (
+ "net/http"
+
+ "code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/setting"
+ api "code.gitea.io/gitea/modules/structs"
+)
+
+// GetGeneralUISettings returns instance's global settings for ui
+func GetGeneralUISettings(ctx *context.APIContext) {
+ // swagger:operation GET /settings/ui settings getGeneralUISettings
+ // ---
+ // summary: Get instance's global settings for ui
+ // produces:
+ // - application/json
+ // responses:
+ // "200":
+ // "$ref": "#/responses/GeneralUISettings"
+ ctx.JSON(http.StatusOK, api.GeneralUISettings{
+ AllowedReactions: setting.UI.Reactions,
+ })
+}
+
+// GetGeneralRepoSettings returns instance's global settings for repositories
+func GetGeneralRepoSettings(ctx *context.APIContext) {
+ // swagger:operation GET /settings/repository settings 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,
+ })
+}