summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-12-11 04:55:08 -0500
committerUnknwon <u@gogs.io>2015-12-11 04:55:08 -0500
commit40f3142264aa20103ba2c6375b344e491cff27f5 (patch)
tree2d17476fae2baf5e80aa56d596f83d37b141bcf7 /routers
parentb21160a13aeab088bdee14ea5444321214adbd05 (diff)
downloadgitea-40f3142264aa20103ba2c6375b344e491cff27f5.tar.gz
gitea-40f3142264aa20103ba2c6375b344e491cff27f5.zip
#2114 External URL for wiki
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/http.go1
-rw-r--r--routers/repo/setting.go2
-rw-r--r--routers/repo/wiki.go6
3 files changed, 9 insertions, 0 deletions
diff --git a/routers/repo/http.go b/routers/repo/http.go
index e6390bc7c5..8164f80962 100644
--- a/routers/repo/http.go
+++ b/routers/repo/http.go
@@ -496,6 +496,7 @@ func updateServerInfo(gitBinPath, dir string) []byte {
return gitCommand(gitBinPath, dir, args...)
}
+// FIXME: use process module
func gitCommand(gitBinPath, dir string, args ...string) []byte {
command := exec.Command(gitBinPath, args...)
command.Dir = dir
diff --git a/routers/repo/setting.go b/routers/repo/setting.go
index d393472ee2..2c57d936f9 100644
--- a/routers/repo/setting.go
+++ b/routers/repo/setting.go
@@ -125,6 +125,8 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
case "advanced":
repo.EnableWiki = form.EnableWiki
+ repo.EnableExternalWiki = form.EnableExternalWiki
+ repo.ExternalWikiURL = form.ExternalWikiURL
repo.EnableIssues = form.EnableIssues
repo.EnableExternalTracker = form.EnableExternalTracker
repo.ExternalTrackerFormat = form.TrackerURLFormat
diff --git a/routers/repo/wiki.go b/routers/repo/wiki.go
index 6b3f2e3413..77aa1c370a 100644
--- a/routers/repo/wiki.go
+++ b/routers/repo/wiki.go
@@ -27,6 +27,12 @@ const (
func MustEnableWiki(ctx *middleware.Context) {
if !ctx.Repo.Repository.EnableWiki {
ctx.Handle(404, "MustEnableWiki", nil)
+ return
+ }
+
+ if ctx.Repo.Repository.EnableExternalWiki {
+ ctx.Redirect(ctx.Repo.Repository.ExternalWikiURL)
+ return
}
}