Fix: movie header use string string record

pull/21/head
zijiren233 2 years ago
parent ab7dfa5bc8
commit a3a0fff3df

@ -40,13 +40,13 @@ type Movie struct {
}
type BaseMovie struct {
Url string `json:"url"`
Name string `json:"name"`
Live bool `json:"live"`
Proxy bool `json:"proxy"`
RtmpSource bool `json:"rtmpSource"`
Type string `json:"type"`
Headers map[string][]string `json:"headers"`
Url string `json:"url"`
Name string `json:"name"`
Live bool `json:"live"`
Proxy bool `json:"proxy"`
RtmpSource bool `json:"rtmpSource"`
Type string `json:"type"`
Headers map[string]string `json:"headers"`
}
type MovieConf func(m *Movie)
@ -69,7 +69,7 @@ func WithCreator(creator *User) MovieConf {
}
}
func NewMovie(id uint64, url, name, type_ string, live, proxy, rtmpSource bool, headers map[string][]string, conf ...MovieConf) (*Movie, error) {
func NewMovie(id uint64, url, name, type_ string, live, proxy, rtmpSource bool, headers map[string]string, conf ...MovieConf) (*Movie, error) {
return NewMovieWithBaseMovie(id, BaseMovie{
Url: url,
Name: name,
@ -151,18 +151,18 @@ func (m *movies) range_(f func(e *dllist.Element[*Movie]) bool) (interrupt bool)
}
type MovieInfo struct {
Id uint64 `json:"id"`
Url string `json:"url"`
Name string `json:"name"`
Live bool `json:"live"`
Proxy bool `json:"proxy"`
RtmpSource bool `json:"rtmpSource"`
Type string `json:"type"`
Headers map[string][]string `json:"headers"`
PullKey string `json:"pullKey"`
CreateAt int64 `json:"createAt"`
LastEditAt int64 `json:"lastEditAt"`
Creator string `json:"creator"`
Id uint64 `json:"id"`
Url string `json:"url"`
Name string `json:"name"`
Live bool `json:"live"`
Proxy bool `json:"proxy"`
RtmpSource bool `json:"rtmpSource"`
Type string `json:"type"`
Headers map[string]string `json:"headers"`
PullKey string `json:"pullKey"`
CreateAt int64 `json:"createAt"`
LastEditAt int64 `json:"lastEditAt"`
Creator string `json:"creator"`
}
func (m *movies) MovieList() (movies []MovieInfo) {

@ -142,7 +142,7 @@ func (u *User) SetAdmin(admin bool) {
u.admin = admin
}
func (u *User) NewMovie(url string, name string, type_ string, live bool, proxy bool, rtmpSource bool, headers map[string][]string, conf ...MovieConf) (*Movie, error) {
func (u *User) NewMovie(url string, name string, type_ string, live bool, proxy bool, rtmpSource bool, headers map[string]string, conf ...MovieConf) (*Movie, error) {
return u.NewMovieWithBaseMovie(BaseMovie{
Url: url,
Name: name,

@ -281,11 +281,11 @@ func NewPublishKey(ctx *gin.Context) {
}
type EditMovieReq struct {
Id uint64 `json:"id"`
Url string `json:"url"`
Name string `json:"name"`
Type string `json:"type"`
Headers map[string][]string `json:"headers"`
Id uint64 `json:"id"`
Url string `json:"url"`
Name string `json:"name"`
Type string `json:"type"`
Headers map[string]string `json:"headers"`
}
func EditMovie(ctx *gin.Context) {
@ -519,7 +519,7 @@ func ProxyMovie(ctx *gin.Context) {
if cm.Headers != nil {
for k, v := range cm.Headers {
req.SetHeader(k, v[0])
req.SetHeader(k, v)
}
}

Loading…
Cancel
Save