Skip to content

Commit 8c213aa

Browse files
authored
feat: support optional custom Referer per-channel (PR: #46)
* feat: support optional custom Referer per-channel * Fixed minor formatting in config/channels.go
1 parent f30ada2 commit 8c213aa

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

config/channels.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ type Channel struct {
2525

2626
// UserAgent is a custom UA string that will be used by FFMPEG to make requests to the stream URL.
2727
UserAgent *string `json:"userAgent,omitempty"`
28-
Icon *string `json:"icon,omitempty"`
28+
Referer *string `json:"referer,omitempty"`
29+
Icon *string `json:"icon,omitempty"`
2930
}
3031

3132
var (

routes/stream.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ func Stream(c *gin.Context) {
4747
)
4848
}
4949

50+
if channel.Referer != nil {
51+
ffmpegArgs = append(
52+
ffmpegArgs,
53+
"-headers",
54+
fmt.Sprintf("Referer: %s", *channel.Referer),
55+
)
56+
}
57+
5058
switch config.Cfg.GetEncoderProfile() {
5159
case config.EncoderProfileVAAPI:
5260
ffmpegArgs = append(

0 commit comments

Comments
 (0)