some lint fixes
This commit is contained in:
parent
88ac31dcd9
commit
9f4fda3c8b
11 changed files with 36 additions and 40 deletions
|
|
@ -416,8 +416,7 @@ func deleteHandler(ctx *Context) {
|
|||
func dirHandler(ctx *Context) {
|
||||
ctx.Template("dirHandler")
|
||||
path := ctx.Path()
|
||||
switch ctx.Method() {
|
||||
case "GET":
|
||||
if ctx.Method() == "GET" {
|
||||
mode, enoent, err := ctx.Srv.FS.Mode(path)
|
||||
if !enoent && err != nil {
|
||||
ctx.Error(err)
|
||||
|
|
@ -439,7 +438,7 @@ func dirHandler(ctx *Context) {
|
|||
Title: "Document Viewer | " + path,
|
||||
}
|
||||
ctx.Template("fileHandler")
|
||||
//f := ctx.Srv.DB.IsIndexed(path)
|
||||
// f := ctx.Srv.DB.IsIndexed(path)
|
||||
id, err := ctx.Srv.DB.GetID(path)
|
||||
f := err == nil
|
||||
if id != "" {
|
||||
|
|
@ -701,8 +700,7 @@ func logsHandler(ctx *Context) {
|
|||
Title: "Logs",
|
||||
BodyTitle: "Logs",
|
||||
}
|
||||
switch ctx.Method() {
|
||||
case "GET":
|
||||
if ctx.Method() == "GET" {
|
||||
ctx.Data.Data = ctx.Srv.Log.Logs()
|
||||
ctx.Exec()
|
||||
}
|
||||
|
|
@ -714,8 +712,7 @@ func tagsHandler(ctx *Context) {
|
|||
Title: "Tags",
|
||||
BodyTitle: "Tags",
|
||||
}
|
||||
switch ctx.Method() {
|
||||
case "GET":
|
||||
if ctx.Method() == "GET" {
|
||||
t, err := ctx.Srv.DB.GetAllTags()
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
|
|
@ -828,8 +825,7 @@ func statsHandler(ctx *Context) {
|
|||
Title: "Stats",
|
||||
BodyTitle: "Stats",
|
||||
}
|
||||
switch ctx.Method() {
|
||||
case "GET":
|
||||
if ctx.Method() == "GET" {
|
||||
ctx.Data.Data = getStats(ctx.Srv.DB.Index)
|
||||
ctx.Exec()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ const (
|
|||
)
|
||||
|
||||
type HTTPServer struct {
|
||||
Config core.Config
|
||||
Config *core.Config
|
||||
|
||||
listener net.Listener
|
||||
srv *http.Server
|
||||
|
|
@ -44,7 +44,7 @@ type HTTPServer struct {
|
|||
res map[string][]byte
|
||||
}
|
||||
|
||||
func NewHTTPServer(cfg core.Config, l net.Listener, s *scan.Scanner) (srv *HTTPServer) {
|
||||
func NewHTTPServer(cfg *core.Config, l net.Listener, s *scan.Scanner) (srv *HTTPServer) {
|
||||
srv = &HTTPServer{
|
||||
Config: cfg,
|
||||
listener: l,
|
||||
|
|
@ -115,9 +115,9 @@ func (s *HTTPServer) buildRoutes() http.Handler {
|
|||
r := mux.NewRouter()
|
||||
r.NotFoundHandler = ¬FoundHandler{s}
|
||||
if s.Config.WebDav {
|
||||
fs := authdav.NewWriteOnlyOnceFileSystem(webdav.Dir(s.Config.DataDir))
|
||||
fs.Filters = []authdav.Filter{authdav.NewMacOSFilter()}
|
||||
h := authdav.NewWebdavBasicAuth(core.WebDavPrefix, fs, nil, webdavLogger, s.DB, "DocStore WebDav")
|
||||
dav := authdav.NewWriteOnlyOnceFileSystem(webdav.Dir(s.Config.DataDir))
|
||||
dav.Filters = []authdav.Filter{authdav.NewMacOSFilter()}
|
||||
h := authdav.NewWebdavBasicAuth(core.WebDavPrefix, dav, nil, webdavLogger, s.DB, "DocStore WebDav")
|
||||
r.PathPrefix(core.WebDavPrefix).Handler(h)
|
||||
}
|
||||
r.Handle("/static/{file}", http.StripPrefix("/", http.FileServer(http.FS(static))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue