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

@@ -7,6 +7,7 @@ import (
"sync"
"server/version"
"server/web/auth"
"github.com/gin-gonic/gin"
)
@@ -30,10 +31,12 @@ func asset(c *gin.Context, t string, d []byte) {
c.Data(200, t+"; charset=UTF-8", d)
}
func SetupRoute(r *gin.RouterGroup) {
r.GET("/msx/:pth", msxPTH)
r.GET("/msx/imdb", msxIMDB)
r.GET("/msx/imdb/:id", msxIMDBID)
func SetupRoute(r gin.IRouter) {
authorized := r.Group("/", auth.CheckAuth())
authorized.GET("/msx/:pth", msxPTH)
authorized.GET("/msx/imdb", msxIMDB)
authorized.GET("/msx/imdb/:id", msxIMDBID)
}
// msxPTH godoc