You've already forked filebrowser
mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-11-26 14:25:26 +08:00
updates
This commit is contained in:
18
hugo.go
18
hugo.go
@@ -2,12 +2,13 @@ package hugo
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/hugo/commands"
|
||||
|
||||
"github.com/mholt/caddy/config/setup"
|
||||
"github.com/mholt/caddy/middleware"
|
||||
|
||||
"github.com/hacdias/caddy-hugo/routing"
|
||||
)
|
||||
|
||||
// Setup function
|
||||
@@ -23,20 +24,7 @@ type handler struct{ Next middleware.Handler }
|
||||
|
||||
func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
|
||||
if middleware.Path(r.URL.Path).Matches("/admin") {
|
||||
|
||||
if middleware.Path(r.URL.Path).Matches("/admin/new") {
|
||||
w.Write([]byte("New"))
|
||||
} else if middleware.Path(r.URL.Path).Matches("/admin/edit") {
|
||||
var fileName string
|
||||
|
||||
fileName = strings.Replace(r.URL.Path, "/admin/edit", "", 1)
|
||||
|
||||
w.Write([]byte("Edit " + fileName))
|
||||
} else {
|
||||
w.Write([]byte("Admin"))
|
||||
}
|
||||
|
||||
return 200, nil
|
||||
return routing.Route(w, r)
|
||||
}
|
||||
|
||||
return h.Next.ServeHTTP(w, r)
|
||||
|
||||
Reference in New Issue
Block a user