mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
fix play without auth
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"server/torr"
|
"server/torr"
|
||||||
"server/torr/state"
|
"server/torr/state"
|
||||||
@@ -144,16 +143,7 @@ func streamNoAuth(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if title == "" {
|
|
||||||
title = c.Param("fname")
|
|
||||||
title, _ = url.PathUnescape(title)
|
|
||||||
title = strings.TrimLeft(title, "/")
|
|
||||||
} else {
|
|
||||||
title, _ = url.QueryUnescape(title)
|
|
||||||
}
|
|
||||||
|
|
||||||
link, _ = url.QueryUnescape(link)
|
link, _ = url.QueryUnescape(link)
|
||||||
poster, _ = url.QueryUnescape(poster)
|
|
||||||
|
|
||||||
spec, err := utils.ParseLink(link)
|
spec, err := utils.ParseLink(link)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -162,12 +152,16 @@ func streamNoAuth(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tor := torr.GetTorrent(spec.InfoHash.HexString())
|
tor := torr.GetTorrent(spec.InfoHash.HexString())
|
||||||
if tor != nil {
|
if tor == nil {
|
||||||
|
c.AbortWithStatus(http.StatusForbidden)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
title = tor.Title
|
title = tor.Title
|
||||||
poster = tor.Poster
|
poster = tor.Poster
|
||||||
data = tor.Data
|
data = tor.Data
|
||||||
}
|
|
||||||
if tor == nil || tor.Stat == state.TorrentInDB {
|
if tor.Stat == state.TorrentInDB {
|
||||||
tor, err = torr.AddTorrent(spec, title, poster, data)
|
tor, err = torr.AddTorrent(spec, title, poster, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.AbortWithError(http.StatusInternalServerError, err)
|
c.AbortWithError(http.StatusInternalServerError, err)
|
||||||
@@ -180,10 +174,6 @@ func streamNoAuth(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if tor.Title == "" {
|
|
||||||
tor.Title = tor.Name()
|
|
||||||
}
|
|
||||||
|
|
||||||
// find file
|
// find file
|
||||||
index := -1
|
index := -1
|
||||||
if len(tor.Files()) == 1 {
|
if len(tor.Files()) == 1 {
|
||||||
|
|||||||
Reference in New Issue
Block a user