dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 00d45159cecca5d1702b5e17e0772633434df9ca
parent 72357ce6fed8e0be1913e3142d1c9ea5ccb7fe73
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Fri, 16 Jun 2023 21:39:21 -0700

cleanup

Diffstat:
Mpkg/web/handlers/chess.go | 4----
Mpkg/web/web.go | 2+-
2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/pkg/web/handlers/chess.go b/pkg/web/handlers/chess.go @@ -119,10 +119,6 @@ func ChessHandler(c echo.Context) error { func ChessGameAnalyseHandler(c echo.Context) error { key := c.Param("key") db := c.Get("database").(*database.DkfDB) - authUser := c.Get("authUser").(*database.User) - if !authUser.IsAdmin { - return c.Redirect(http.StatusFound, "/") - } g, err := interceptors.ChessInstance.GetGame(key) if err != nil { return c.Redirect(http.StatusFound, "/") diff --git a/pkg/web/web.go b/pkg/web/web.go @@ -100,7 +100,7 @@ func getMainServer(db *database.DkfDB, i18nBundle *i18n.Bundle, renderer *tmp.Te authGroup.POST("/chess", handlers.ChessHandler) authGroup.GET("/chess/:key", handlers.ChessGameHandler) authGroup.POST("/chess/:key", handlers.ChessGameHandler) - authGroup.GET("/chess/:key/analyse", handlers.ChessGameAnalyseHandler) + authGroup.GET("/chess/:key/analyse", handlers.ChessGameAnalyseHandler, middlewares.IsAdminMiddleware) authGroup.GET("/chess/:key/form", handlers.ChessGameFormHandler) authGroup.POST("/chess/:key/form", handlers.ChessGameFormHandler) authGroup.GET("/chess/:key/stats", handlers.ChessGameStatsHandler)