go1.16 and embed
This commit is contained in:
parent
f0add04396
commit
8e7bcfc21b
37 changed files with 98 additions and 1134 deletions
|
|
@ -5,6 +5,7 @@ package server
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"embed"
|
||||
"errors"
|
||||
"git.giftfish.de/ston1th/authdav"
|
||||
"git.giftfish.de/ston1th/docstore/pkg/core"
|
||||
|
|
@ -100,12 +101,16 @@ func (s *HTTPServer) Stop() error {
|
|||
func (s *HTTPServer) register() http.Handler {
|
||||
r := mux.NewRouter()
|
||||
r.NotFoundHandler = ®isterNotFoundHandler{s}
|
||||
r.Handle("/static/{file}", http.StripPrefix("/", http.FileServer(http.FS(static))))
|
||||
for _, v := range registerRoutes {
|
||||
r.HandleFunc(v.Path, s.contextWrapper(v.Handler)).Methods(v.Methods...)
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
//go:embed static/*
|
||||
var static embed.FS
|
||||
|
||||
func (s *HTTPServer) buildRoutes() http.Handler {
|
||||
r := mux.NewRouter()
|
||||
r.NotFoundHandler = ¬FoundHandler{s}
|
||||
|
|
@ -115,6 +120,7 @@ func (s *HTTPServer) buildRoutes() http.Handler {
|
|||
h := authdav.NewWebdavBasicAuth(core.WebDavPrefix, fs, nil, webdavLogger, s.DB, "DocStore WebDav")
|
||||
r.PathPrefix(core.WebDavPrefix).Handler(h)
|
||||
}
|
||||
r.Handle("/static/{file}", http.StripPrefix("/", http.FileServer(http.FS(static))))
|
||||
for _, v := range routes {
|
||||
r.HandleFunc(v.Path, s.contextWrapper(v.Handler)).Methods(v.Methods...)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue