cosmetics

This commit is contained in:
nikk gitanes
2024-04-12 05:12:51 +03:00
parent ecce45695b
commit b4e6281c5c
8 changed files with 46 additions and 49 deletions

View File

@@ -43,8 +43,8 @@ import (
// @Param m3u query string false "Get torrent as M3U playlist"
// @Param fromlast query string false "Get M3U from last played file"
// @Param play query string false "Start stream torrent"
// @Param title query string true "Set title of torrent"
// @Param poster query string true "Set poster link of torrent"
// @Param title query string false "Set title of torrent"
// @Param poster query string false "Set poster link of torrent"
// @Param category query string false "Set category of torrent, used in web: movie, tv, music, other"
//
// @Produce application/octet-stream
@@ -61,9 +61,10 @@ func stream(c *gin.Context) {
_, play := c.GetQuery("play")
title := c.Query("title")
poster := c.Query("poster")
category, _ := c.GetQuery("category")
category := c.Query("category")
data := ""
notAuth := c.GetBool("auth_required") && c.GetString(gin.AuthUserKey) == ""
if notAuth && (play || m3u) {
@@ -81,9 +82,10 @@ func stream(c *gin.Context) {
return
}
title, _ = url.QueryUnescape(title)
link, _ = url.QueryUnescape(link)
title, _ = url.QueryUnescape(title)
poster, _ = url.QueryUnescape(poster)
category, _ = url.QueryUnescape(category)
spec, err := utils.ParseLink(link)
if err != nil {
@@ -172,9 +174,10 @@ func streamNoAuth(c *gin.Context) {
_, play := c.GetQuery("play")
title := c.Query("title")
poster := c.Query("poster")
data := ""
category := c.Query("category")
data := ""
if link == "" {
c.AbortWithError(http.StatusBadRequest, errors.New("link should not be empty"))
return