Refactor auth code

This commit is contained in:
Viacheslav Evseev
2024-02-22 01:50:03 +03:00
parent af14dbbeb8
commit c3f89042f9
11 changed files with 68 additions and 98 deletions

View File

@@ -6,13 +6,16 @@ import (
"server/settings"
"server/torr"
"server/web/auth"
"server/web/pages/template"
)
func SetupRoute(route *gin.RouterGroup) {
template.RouteWebPages(route)
route.GET("/stat", statPage)
route.GET("/magnets", getTorrents)
func SetupRoute(route gin.IRouter) {
authorized := route.Group("/", auth.CheckAuth())
template.RouteWebPages(authorized)
authorized.GET("/stat", statPage)
authorized.GET("/magnets", getTorrents)
}
// stat godoc