summaryrefslogtreecommitdiffstats
path: root/routers/private
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2018-12-12 02:37:32 +0800
committertechknowlogick <hello@techknowlogick.com>2018-12-11 13:37:32 -0500
commitba75319157f23031cfca55b5a286f86d36065f35 (patch)
tree450a6e1ffd17b89fd00fea664c59cb31f7cbc351 /routers/private
parentccea91652f8d23bd65494f5c04275506118aaa27 (diff)
downloadgitea-ba75319157f23031cfca55b5a286f86d36065f35.tar.gz
gitea-ba75319157f23031cfca55b5a286f86d36065f35.zip
fix clone wiki failed via ssh (#5503)
Diffstat (limited to 'routers/private')
-rw-r--r--routers/private/internal.go1
-rw-r--r--routers/private/wiki.go34
2 files changed, 35 insertions, 0 deletions
diff --git a/routers/private/internal.go b/routers/private/internal.go
index 0221b1fee8..ec2281c5c5 100644
--- a/routers/private/internal.go
+++ b/routers/private/internal.go
@@ -82,6 +82,7 @@ func RegisterRoutes(m *macaron.Macaron) {
m.Post("/repositories/:repoid/keys/:keyid/update", UpdateDeployKey)
m.Get("/repositories/:repoid/user/:userid/checkunituser", CheckUnitUser)
m.Get("/repositories/:repoid/has-keys/:keyid", HasDeployKey)
+ m.Get("/repositories/:repoid/wiki/init", InitWiki)
m.Post("/push/update", PushUpdate)
m.Get("/protectedbranch/:pbid/:userid", CanUserPush)
m.Get("/repo/:owner/:repo", GetRepositoryByOwnerAndName)
diff --git a/routers/private/wiki.go b/routers/private/wiki.go
new file mode 100644
index 0000000000..33bcbaf17e
--- /dev/null
+++ b/routers/private/wiki.go
@@ -0,0 +1,34 @@
+// Copyright 2017 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 private
+
+import (
+ "code.gitea.io/gitea/models"
+
+ macaron "gopkg.in/macaron.v1"
+)
+
+// InitWiki initilizes wiki via repo id
+func InitWiki(ctx *macaron.Context) {
+ repoID := ctx.ParamsInt64("repoid")
+
+ repo, err := models.GetRepositoryByID(repoID)
+ if err != nil {
+ ctx.JSON(500, map[string]interface{}{
+ "err": err.Error(),
+ })
+ return
+ }
+
+ err = repo.InitWiki()
+ if err != nil {
+ ctx.JSON(500, map[string]interface{}{
+ "err": err.Error(),
+ })
+ return
+ }
+
+ ctx.Status(202)
+}