mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
return missing "/search" and "/site.webmanifest" router
This commit is contained in:
@@ -87,7 +87,7 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RouteWebPages(route *gin.RouterGroup) {
|
func RouteWebPages(route gin.IRouter) {
|
||||||
route.GET("/", func(c *gin.Context) {
|
route.GET("/", func(c *gin.Context) {
|
||||||
etag := fmt.Sprintf("%x", md5.Sum(Indexhtml))
|
etag := fmt.Sprintf("%x", md5.Sum(Indexhtml))
|
||||||
c.Header("Cache-Control", "public, max-age=31536000")
|
c.Header("Cache-Control", "public, max-age=31536000")
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
config "server/settings"
|
||||||
"server/web/auth"
|
"server/web/auth"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -39,7 +40,11 @@ func SetupRoute(route gin.IRouter) {
|
|||||||
|
|
||||||
authorized.GET("/download/:size", download)
|
authorized.GET("/download/:size", download)
|
||||||
|
|
||||||
|
if config.SearchWA {
|
||||||
|
route.GET("/search/*query", rutorSearch)
|
||||||
|
} else {
|
||||||
authorized.GET("/search/*query", rutorSearch)
|
authorized.GET("/search/*query", rutorSearch)
|
||||||
|
}
|
||||||
|
|
||||||
authorized.GET("/ffp/:hash/:id", ffp)
|
authorized.GET("/ffp/:hash/:id", ffp)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"slices"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
@@ -68,12 +69,16 @@ func BasicAuth(accounts gin.Accounts) gin.HandlerFunc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func CheckAuth() gin.HandlerFunc {
|
func CheckAuth(exclude ...string) gin.HandlerFunc {
|
||||||
return func(c *gin.Context) {
|
return func(c *gin.Context) {
|
||||||
if !settings.HttpAuth {
|
if !settings.HttpAuth {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if slices.Contains(exclude, c.FullPath()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if _, ok := c.Get(gin.AuthUserKey); ok {
|
if _, ok := c.Get(gin.AuthUserKey); ok {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func SetupRoute(route gin.IRouter) {
|
func SetupRoute(route gin.IRouter) {
|
||||||
authorized := route.Group("/", auth.CheckAuth())
|
authorized := route.Group("/", auth.CheckAuth("/site.webmanifest"))
|
||||||
|
|
||||||
template.RouteWebPages(authorized)
|
template.RouteWebPages(authorized)
|
||||||
authorized.GET("/stat", statPage)
|
authorized.GET("/stat", statPage)
|
||||||
|
|||||||
Reference in New Issue
Block a user