aboutsummaryrefslogtreecommitdiffstats
path: root/modules/public/public.go
diff options
context:
space:
mode:
authorThomas Boerger <thomas@webhippie.de>2017-01-28 23:14:56 +0100
committerGitHub <noreply@github.com>2017-01-28 23:14:56 +0100
commit78535fb08ebe667f27da6b44a9af52aae1148434 (patch)
treefa4f539811b8e66ae7aa7f177702180642844bc3 /modules/public/public.go
parentcc31a21192cba31cc2ede74b44f1c4e19621d4f7 (diff)
downloadgitea-78535fb08ebe667f27da6b44a9af52aae1148434.tar.gz
gitea-78535fb08ebe667f27da6b44a9af52aae1148434.zip
Allow custom public files (#782)
* Allow custom public files * Gofmt code, lots of places not related to this pr
Diffstat (limited to 'modules/public/public.go')
-rw-r--r--modules/public/public.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/public/public.go b/modules/public/public.go
index 9c9e9d533d..6f28ebc032 100644
--- a/modules/public/public.go
+++ b/modules/public/public.go
@@ -4,6 +4,13 @@
package public
+import (
+ "path"
+
+ "code.gitea.io/gitea/modules/setting"
+ "gopkg.in/macaron.v1"
+)
+
//go:generate go-bindata -tags "bindata" -ignore "\\.go|\\.less" -pkg "public" -o "bindata.go" ../../public/...
//go:generate go fmt bindata.go
//go:generate sed -i.bak s/..\/..\/public\/// bindata.go
@@ -14,3 +21,13 @@ type Options struct {
Directory string
SkipLogging bool
}
+
+// Custom implements the macaron static handler for serving custom assets.
+func Custom(opts *Options) macaron.Handler {
+ return macaron.Static(
+ path.Join(setting.CustomPath, "public"),
+ macaron.StaticOptions{
+ SkipLogging: opts.SkipLogging,
+ },
+ )
+}