mirror of
https://github.com/Monibuca/plugin-preview.git
synced 2025-09-27 03:15:51 +08:00
fix: lock map before read
This commit is contained in:
7
main.go
7
main.go
@@ -33,12 +33,15 @@ func (p *PreviewConfig) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
s += "<h2>pull stream on subscribe 订阅时才会触发拉流的流</h2>"
|
||||
for name, p := range Plugins {
|
||||
if pullcfg, ok := p.Config.(config.PullConfig); ok {
|
||||
if pullonsub := pullcfg.GetPullConfig().PullOnSub; pullonsub != nil {
|
||||
pullconf := pullcfg.GetPullConfig()
|
||||
pullconf.PullOnSubLocker.RLock()
|
||||
if pullconf.PullOnSub != nil {
|
||||
s += fmt.Sprintf("<h3>%s</h3>", name)
|
||||
for streamPath, url := range pullonsub {
|
||||
for streamPath, url := range pullconf.PullOnSub {
|
||||
s += fmt.Sprintf("<a href='%s'>%s</a> <-- %s<br>", streamPath, streamPath, url)
|
||||
}
|
||||
}
|
||||
pullconf.PullOnSubLocker.RUnlock()
|
||||
}
|
||||
}
|
||||
w.Write([]byte(s))
|
||||
|
Reference in New Issue
Block a user