mirror of
https://github.com/langhuihui/monibuca.git
synced 2025-09-27 01:15:52 +08:00
fix: cors add Authorization
This commit is contained in:
20
README_CN.md
20
README_CN.md
@@ -41,9 +41,23 @@ import (
|
||||
"context"
|
||||
|
||||
"m7s.live/v5"
|
||||
_ "m7s.live/v5/plugin/debug" // 调试插件
|
||||
_ "m7s.live/v5/plugin/flv" // FLV插件
|
||||
_ "m7s.live/v5/plugin/rtmp" // RTMP插件
|
||||
_ "m7s.live/v5/plugin/cascade"
|
||||
_ "m7s.live/v5/plugin/debug"
|
||||
_ "m7s.live/v5/plugin/flv"
|
||||
_ "m7s.live/v5/plugin/gb28181"
|
||||
_ "m7s.live/v5/plugin/hls"
|
||||
_ "m7s.live/v5/plugin/logrotate"
|
||||
_ "m7s.live/v5/plugin/monitor"
|
||||
_ "m7s.live/v5/plugin/mp4"
|
||||
_ "m7s.live/v5/plugin/preview"
|
||||
_ "m7s.live/v5/plugin/rtmp"
|
||||
_ "m7s.live/v5/plugin/rtsp"
|
||||
_ "m7s.live/v5/plugin/sei"
|
||||
_ "m7s.live/v5/plugin/snap"
|
||||
_ "m7s.live/v5/plugin/srt"
|
||||
_ "m7s.live/v5/plugin/stress"
|
||||
_ "m7s.live/v5/plugin/transcode"
|
||||
_ "m7s.live/v5/plugin/webrtc"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
10
api.go
10
api.go
@@ -654,6 +654,16 @@ func (s *Server) Api_Stream_Position_SSE(rw http.ResponseWriter, r *http.Request
|
||||
}, rw, r)
|
||||
}
|
||||
|
||||
// func (s *Server) Api_Vod_Position(rw http.ResponseWriter, r *http.Request) {
|
||||
// streamPath := r.URL.Query().Get("streamPath")
|
||||
// s.Streams.Call(func() error {
|
||||
// if pub, ok := s.Streams.Get(streamPath); ok {
|
||||
// t = pub.GetPosition()
|
||||
// }
|
||||
// return nil
|
||||
// })
|
||||
// }
|
||||
|
||||
func (s *Server) Summary(context.Context, *emptypb.Empty) (res *pb.SummaryResponse, err error) {
|
||||
dur := time.Since(s.lastSummaryTime)
|
||||
if dur < time.Second {
|
||||
|
@@ -109,7 +109,7 @@ func CORS(next http.Handler) http.Handler {
|
||||
header := w.Header()
|
||||
header.Set("Access-Control-Allow-Credentials", "true")
|
||||
header.Set("Cross-Origin-Resource-Policy", "cross-origin")
|
||||
header.Set("Access-Control-Allow-Headers", "Content-Type,Access-Token")
|
||||
header.Set("Access-Control-Allow-Headers", "Content-Type,Access-Token,Authorization")
|
||||
header.Set("Access-Control-Allow-Private-Network", "true")
|
||||
origin := r.Header["Origin"]
|
||||
if len(origin) == 0 {
|
||||
|
Reference in New Issue
Block a user