mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
update auth
This commit is contained in:
@@ -138,6 +138,7 @@ func streamNoAuth(c *gin.Context) {
|
|||||||
_, preload := c.GetQuery("preload")
|
_, preload := c.GetQuery("preload")
|
||||||
title := c.Query("title")
|
title := c.Query("title")
|
||||||
poster := c.Query("poster")
|
poster := c.Query("poster")
|
||||||
|
data := ""
|
||||||
|
|
||||||
if link == "" {
|
if link == "" {
|
||||||
c.AbortWithError(http.StatusBadRequest, errors.New("link should not be empty"))
|
c.AbortWithError(http.StatusBadRequest, errors.New("link should not be empty"))
|
||||||
@@ -162,10 +163,24 @@ func streamNoAuth(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tor := torr.GetTorrent(spec.InfoHash.HexString())
|
tor := torr.GetTorrent(spec.InfoHash.HexString())
|
||||||
if tor == nil {
|
if tor != nil {
|
||||||
c.AbortWithError(http.StatusNotFound, errors.New("Torrent not found"))
|
title = tor.Title
|
||||||
|
poster = tor.Poster
|
||||||
|
data = tor.Data
|
||||||
|
}
|
||||||
|
if tor == nil || tor.Stat == state.TorrentInDB {
|
||||||
|
if title == "" {
|
||||||
|
title = c.Param("fname")
|
||||||
|
title, _ = url.PathUnescape(title)
|
||||||
|
title = strings.TrimLeft(title, "/")
|
||||||
|
}
|
||||||
|
|
||||||
|
tor, err = torr.AddTorrent(spec, title, poster, data)
|
||||||
|
if err != nil {
|
||||||
|
c.AbortWithError(http.StatusInternalServerError, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if !tor.GotInfo() {
|
if !tor.GotInfo() {
|
||||||
c.AbortWithError(http.StatusInternalServerError, errors.New("timeout connection torrent"))
|
c.AbortWithError(http.StatusInternalServerError, errors.New("timeout connection torrent"))
|
||||||
|
|||||||
Reference in New Issue
Block a user