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