Allow custom public files (#782)
* Allow custom public files * Gofmt code, lots of places not related to this pr
This commit is contained in:
parent
cc31a21192
commit
78535fb08e
7 changed files with 26 additions and 6 deletions
|
@ -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,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue