diff options
Diffstat (limited to 'cmd/shorg/serve')
-rw-r--r-- | cmd/shorg/serve/serve.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cmd/shorg/serve/serve.go b/cmd/shorg/serve/serve.go index 13354b7..73a7c68 100644 --- a/cmd/shorg/serve/serve.go +++ b/cmd/shorg/serve/serve.go @@ -26,7 +26,6 @@ func Run(c *cli.Context) error { e := echo.New() e.HTTPErrorHandler = handler.ErrorHandler - e.Use( middleware.Recover(), middleware.Logger(), @@ -41,13 +40,15 @@ func Run(c *cli.Context) error { e.GET("/add/success", h.AddQuoteSuccess) e.GET("/captcha/*", echo.WrapHandler(captcha.Server(400, 65))) + adminMW := middleware.BasicAuth(func(u, p string, ctx echo.Context) (bool, error) { + return cfg.Admins[u] == p, nil + }) + func(g *echo.Group) { g.GET("/", h.Admin) g.POST("/action", h.AdminAction) g.GET("/export", h.AdminExport) - }(e.Group("/admin", middleware.BasicAuth(func(u, p string, ctx echo.Context) (bool, error) { - return cfg.Admins[u] == p, nil - }))) + }(e.Group("/admin", adminMW)) e.StaticFS("/", static.FS) |