also for stream

This commit is contained in:
nikk gitanes
2023-10-13 17:38:41 +03:00
parent 0d413b2917
commit 64ae3b8f1c
2 changed files with 9 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ import (
"net/http"
"net/url"
"strconv"
"strings"
"server/torr"
"server/torr/state"
@@ -120,8 +121,14 @@ func stream(c *gin.Context) {
} else
// return m3u if query
if m3u {
name := strings.ReplaceAll(c.Param("fname"), `/`, "") // strip starting / from param
if name == "" {
name = tor.Name() + ".m3u"
} else {
name += ".m3u"
}
m3ulist := "#EXTM3U\n" + getM3uList(tor.Status(), utils2.GetScheme(c)+"://"+c.Request.Host, fromlast)
sendM3U(c, tor.Name()+".m3u", tor.Hash().HexString(), m3ulist)
sendM3U(c, name, tor.Hash().HexString(), m3ulist)
return
} else
// return play if query