fix: alist proxy movie

main v0.9.4
zijiren233 1 month ago
parent 7c69ae5c3d
commit 3587e27026

@ -17,7 +17,7 @@ var AddCmd = &cobra.Command{
Long: `add admin by user id`, Long: `add admin by user id`,
PreRunE: func(cmd *cobra.Command, _ []string) error { PreRunE: func(cmd *cobra.Command, _ []string) error {
return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add( return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
bootstrap.InitDiscardLog, bootstrap.InitStdLog,
bootstrap.InitConfig, bootstrap.InitConfig,
bootstrap.InitDatabase, bootstrap.InitDatabase,
).Run() ).Run()

@ -15,7 +15,7 @@ var RemoveCmd = &cobra.Command{
Long: `remove admin`, Long: `remove admin`,
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add( return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
bootstrap.InitDiscardLog, bootstrap.InitStdLog,
bootstrap.InitConfig, bootstrap.InitConfig,
bootstrap.InitDatabase, bootstrap.InitDatabase,
).Run() ).Run()

@ -14,7 +14,7 @@ var ShowCmd = &cobra.Command{
Long: `show admin`, Long: `show admin`,
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add( return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
bootstrap.InitDiscardLog, bootstrap.InitStdLog,
bootstrap.InitConfig, bootstrap.InitConfig,
bootstrap.InitDatabase, bootstrap.InitDatabase,
).Run() ).Run()

@ -15,7 +15,7 @@ var AddCmd = &cobra.Command{
Long: `add root by user id`, Long: `add root by user id`,
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add( return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
bootstrap.InitDiscardLog, bootstrap.InitStdLog,
bootstrap.InitConfig, bootstrap.InitConfig,
bootstrap.InitDatabase, bootstrap.InitDatabase,
).Run() ).Run()

@ -15,7 +15,7 @@ var RemoveCmd = &cobra.Command{
Long: `remove root`, Long: `remove root`,
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add( return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
bootstrap.InitDiscardLog, bootstrap.InitStdLog,
bootstrap.InitConfig, bootstrap.InitConfig,
bootstrap.InitDatabase, bootstrap.InitDatabase,
).Run() ).Run()

@ -14,7 +14,7 @@ var ShowCmd = &cobra.Command{
Long: `show root`, Long: `show root`,
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add( return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
bootstrap.InitDiscardLog, bootstrap.InitStdLog,
bootstrap.InitConfig, bootstrap.InitConfig,
bootstrap.InitDatabase, bootstrap.InitDatabase,
).Run() ).Run()

@ -15,7 +15,7 @@ var SetCmd = &cobra.Command{
Long: `set setting`, Long: `set setting`,
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add( return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
bootstrap.InitDiscardLog, bootstrap.InitStdLog,
bootstrap.InitConfig, bootstrap.InitConfig,
bootstrap.InitDatabase, bootstrap.InitDatabase,
bootstrap.InitSetting, bootstrap.InitSetting,

@ -16,7 +16,7 @@ var ShowCmd = &cobra.Command{
Long: `show setting`, Long: `show setting`,
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add( return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
bootstrap.InitDiscardLog, bootstrap.InitStdLog,
bootstrap.InitConfig, bootstrap.InitConfig,
bootstrap.InitDatabase, bootstrap.InitDatabase,
bootstrap.InitSetting, bootstrap.InitSetting,

@ -15,7 +15,7 @@ var BanCmd = &cobra.Command{
Long: "ban user with user id", Long: "ban user with user id",
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add( return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
bootstrap.InitDiscardLog, bootstrap.InitStdLog,
bootstrap.InitConfig, bootstrap.InitConfig,
bootstrap.InitDatabase, bootstrap.InitDatabase,
).Run() ).Run()

@ -15,7 +15,7 @@ var DeleteCmd = &cobra.Command{
Long: `delete user`, Long: `delete user`,
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add( return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
bootstrap.InitDiscardLog, bootstrap.InitStdLog,
bootstrap.InitConfig, bootstrap.InitConfig,
bootstrap.InitDatabase, bootstrap.InitDatabase,
).Run() ).Run()

@ -15,7 +15,7 @@ var SearchCmd = &cobra.Command{
Long: `search user by id or username`, Long: `search user by id or username`,
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add( return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
bootstrap.InitDiscardLog, bootstrap.InitStdLog,
bootstrap.InitConfig, bootstrap.InitConfig,
bootstrap.InitDatabase, bootstrap.InitDatabase,
).Run() ).Run()

@ -15,7 +15,7 @@ var UnbanCmd = &cobra.Command{
Long: "unban user with user id", Long: "unban user with user id",
PreRunE: func(cmd *cobra.Command, args []string) error { PreRunE: func(cmd *cobra.Command, args []string) error {
return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add( return bootstrap.New(bootstrap.WithContext(cmd.Context())).Add(
bootstrap.InitDiscardLog, bootstrap.InitStdLog,
bootstrap.InitConfig, bootstrap.InitConfig,
bootstrap.InitDatabase, bootstrap.InitDatabase,
).Run() ).Run()

@ -4,5 +4,5 @@ description: A Helm chart for deploying Synctv application with PostgreSQL State
type: application type: application
appVersion: 0.9.3 appVersion: 0.9.4
version: 0.9.3 version: 0.9.4

@ -101,9 +101,3 @@ func InitStdLog(ctx context.Context) error {
setLog(logrus.StandardLogger()) setLog(logrus.StandardLogger())
return nil return nil
} }
func InitDiscardLog(ctx context.Context) error {
logrus.StandardLogger().SetOutput(io.Discard)
log.SetOutput(io.Discard)
return nil
}

@ -567,12 +567,6 @@ func ChangeCurrentMovie(ctx *gin.Context) {
func ProxyMovie(ctx *gin.Context) { func ProxyMovie(ctx *gin.Context) {
log := ctx.MustGet("log").(*log.Entry) log := ctx.MustGet("log").(*log.Entry)
if !settings.MovieProxy.Get() {
log.Errorf("movie proxy is not enabled")
ctx.AbortWithStatusJSON(http.StatusBadRequest, model.NewAPIErrorStringResp("movie proxy is not enabled"))
return
}
room := ctx.MustGet("room").(*op.RoomEntry).Value() room := ctx.MustGet("room").(*op.RoomEntry).Value()
// user := ctx.MustGet("user").(*op.UserEntry).Value() // user := ctx.MustGet("user").(*op.UserEntry).Value()
@ -594,11 +588,17 @@ func ProxyMovie(ctx *gin.Context) {
return return
} }
if !m.Movie.MovieBase.Proxy { if !settings.MovieProxy.Get() {
log.Errorf("proxy is not enabled")
ctx.AbortWithStatusJSON(http.StatusBadRequest, model.NewAPIErrorStringResp("proxy is not enabled")) ctx.AbortWithStatusJSON(http.StatusBadRequest, model.NewAPIErrorStringResp("proxy is not enabled"))
return return
} }
if !m.Movie.MovieBase.Proxy {
ctx.AbortWithStatusJSON(http.StatusBadRequest, model.NewAPIErrorStringResp("movie is not proxy"))
return
}
if m.Movie.MovieBase.Live || m.Movie.MovieBase.RtmpSource { if m.Movie.MovieBase.Live || m.Movie.MovieBase.RtmpSource {
ctx.AbortWithStatusJSON(http.StatusBadRequest, model.NewAPIErrorStringResp("this movie is live or rtmp source, not support use this method proxy")) ctx.AbortWithStatusJSON(http.StatusBadRequest, model.NewAPIErrorStringResp("this movie is live or rtmp source, not support use this method proxy"))
return return
@ -649,7 +649,7 @@ func ServeM3u8(ctx *gin.Context) {
} }
if !m.Movie.MovieBase.Proxy { if !m.Movie.MovieBase.Proxy {
ctx.AbortWithStatusJSON(http.StatusBadRequest, model.NewAPIErrorStringResp("proxy is not enabled")) ctx.AbortWithStatusJSON(http.StatusBadRequest, model.NewAPIErrorStringResp("movie is not proxy"))
return return
} }

@ -1 +1 @@
Subproject commit 280a7b6c9f8a0e978796df8714502507e6fdac89 Subproject commit 241fb1f079e3ecc7e504b73960321bcc8102ae05
Loading…
Cancel
Save