diff options
author | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-10-07 03:45:49 +0300 |
---|---|---|
committer | Alexander Neonxp Kiryukhin <i@neonxp.ru> | 2024-10-07 03:47:56 +0300 |
commit | ffcc9eeb1746971d7d009822ae65a1201c54e289 (patch) | |
tree | d8d347f638f5d98c83db36f9dcb2b45c569b03fc /cmd | |
parent | 420e049415c8ec7f7a209a03110eecbe0c83e9e0 (diff) |
Мелкие правки админки
Diffstat (limited to 'cmd')
-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) |