mirror of
https://github.com/pierre-emmanuelJ/iptv-proxy.git
synced 2026-03-14 07:09:06 +01:00
Forward user-agent
Signed-off-by: Pierre-Emmanuel Jacquier <15922119+pierre-emmanuelJ@users.noreply.github.com>
This commit is contained in:
@@ -57,7 +57,17 @@ func (c *Config) stream(ctx *gin.Context, oriURL *url.URL) {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := http.Get(oriURL.String())
|
||||
client := &http.Client{}
|
||||
|
||||
req, err := http.NewRequest("GET", oriURL.String(), nil)
|
||||
if err != nil {
|
||||
ctx.AbortWithError(http.StatusInternalServerError, err) // nolint: errcheck
|
||||
return
|
||||
}
|
||||
|
||||
req.Header.Set("User-Agent", ctx.Request.UserAgent())
|
||||
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
ctx.AbortWithError(http.StatusInternalServerError, err) // nolint: errcheck
|
||||
return
|
||||
@@ -79,7 +89,15 @@ func (c *Config) hlsStream(ctx *gin.Context, oriURL *url.URL) {
|
||||
},
|
||||
}
|
||||
|
||||
resp, err := client.Get(oriURL.String())
|
||||
req, err := http.NewRequest("GET", oriURL.String(), nil)
|
||||
if err != nil {
|
||||
ctx.AbortWithError(http.StatusInternalServerError, err) // nolint: errcheck
|
||||
return
|
||||
}
|
||||
|
||||
req.Header.Set("User-Agent", ctx.Request.UserAgent())
|
||||
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
ctx.AbortWithError(http.StatusInternalServerError, err) // nolint: errcheck
|
||||
return
|
||||
@@ -98,7 +116,15 @@ func (c *Config) hlsStream(ctx *gin.Context, oriURL *url.URL) {
|
||||
hlsChannelsRedirectURL[id] = *location
|
||||
hlsChannelsRedirectURLLock.Unlock()
|
||||
|
||||
hlsResp, err := http.Get(location.String())
|
||||
hlsReq, err := http.NewRequest("GET", location.String(), nil)
|
||||
if err != nil {
|
||||
ctx.AbortWithError(http.StatusInternalServerError, err) // nolint: errcheck
|
||||
return
|
||||
}
|
||||
|
||||
hlsReq.Header.Set("User-Agent", ctx.Request.UserAgent())
|
||||
|
||||
hlsResp, err := client.Do(hlsReq)
|
||||
if err != nil {
|
||||
ctx.AbortWithError(http.StatusInternalServerError, err) // nolint: errcheck
|
||||
return
|
||||
|
||||
@@ -160,7 +160,7 @@ func (c *Config) xtreamPlayerAPI(ctx *gin.Context, q url.Values) {
|
||||
action = q["action"][0]
|
||||
}
|
||||
|
||||
client, err := xtreamapi.New(c.XtreamUser.String(), c.XtreamPassword.String(), c.XtreamBaseURL)
|
||||
client, err := xtreamapi.New(c.XtreamUser.String(), c.XtreamPassword.String(), c.XtreamBaseURL, ctx.Request.UserAgent())
|
||||
if err != nil {
|
||||
ctx.AbortWithError(http.StatusInternalServerError, err) // nolint: errcheck
|
||||
return
|
||||
@@ -183,7 +183,7 @@ func (c *Config) xtreamPlayerAPI(ctx *gin.Context, q url.Values) {
|
||||
}
|
||||
|
||||
func (c *Config) xtreamXMLTV(ctx *gin.Context) {
|
||||
client, err := xtreamapi.New(c.XtreamUser.String(), c.XtreamPassword.String(), c.XtreamBaseURL)
|
||||
client, err := xtreamapi.New(c.XtreamUser.String(), c.XtreamPassword.String(), c.XtreamBaseURL, ctx.Request.UserAgent())
|
||||
if err != nil {
|
||||
ctx.AbortWithError(http.StatusInternalServerError, err) // nolint: errcheck
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user