mirror of
https://github.com/pierre-emmanuelJ/iptv-proxy.git
synced 2026-03-16 01:16:03 +01:00
Fix playlist credentials on non Xtream playlist (#75)
Signed-off-by: Pierre-Emmanuel Jacquier <15922119+pierre-emmanuelJ@users.noreply.github.com>
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"log"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/jamesnetherton/m3u"
|
||||
@@ -135,15 +136,17 @@ func (c *Config) replaceURL(uri string, xtream bool) (string, error) {
|
||||
protocol = "https"
|
||||
}
|
||||
|
||||
customEnd := c.CustomEndpoint
|
||||
customEnd := strings.Trim(c.CustomEndpoint, "/")
|
||||
if customEnd != "" {
|
||||
customEnd = fmt.Sprintf("/%s", customEnd)
|
||||
}
|
||||
|
||||
path := oriURL.EscapedPath()
|
||||
uriPath := oriURL.EscapedPath()
|
||||
if xtream {
|
||||
path = strings.ReplaceAll(path, c.XtreamUser.PathEscape(), c.User.PathEscape())
|
||||
path = strings.ReplaceAll(path, c.XtreamPassword.PathEscape(), c.Password.PathEscape())
|
||||
uriPath = strings.ReplaceAll(uriPath, c.XtreamUser.PathEscape(), c.User.PathEscape())
|
||||
uriPath = strings.ReplaceAll(uriPath, c.XtreamPassword.PathEscape(), c.Password.PathEscape())
|
||||
} else {
|
||||
uriPath = path.Join("/", c.User.PathEscape(), c.Password.PathEscape(), uriPath)
|
||||
}
|
||||
|
||||
basicAuth := oriURL.User.String()
|
||||
@@ -158,7 +161,7 @@ func (c *Config) replaceURL(uri string, xtream bool) (string, error) {
|
||||
c.HostConfig.Hostname,
|
||||
c.HostConfig.Port,
|
||||
customEnd,
|
||||
path,
|
||||
uriPath,
|
||||
)
|
||||
|
||||
newURL, err := url.Parse(newURI)
|
||||
|
||||
Reference in New Issue
Block a user