]> code.octet-stream.net Git - broadcaster/blobdiff - server/radio_sync.go
Require authentication consistently
[broadcaster] / server / radio_sync.go
index 9fd9a658a834622b8b4a02b560e963b01a231445..66521f8b5a132b304519cb0cce835e5d8241c53a 100644 (file)
@@ -1,7 +1,7 @@
 package main
 
 import (
 package main
 
 import (
-       "code.octet-stream.net/broadcaster/protocol"
+       "code.octet-stream.net/broadcaster/internal/protocol"
        "encoding/json"
        "golang.org/x/net/websocket"
        "log"
        "encoding/json"
        "golang.org/x/net/websocket"
        "log"
@@ -53,6 +53,8 @@ func RadioSync(ws *websocket.Conn) {
                        radio = r
                        log.Println("Radio authenticated:", radio.Name)
                        isAuthenticated = true
                        radio = r
                        log.Println("Radio authenticated:", radio.Name)
                        isAuthenticated = true
+                       commandRouter.AddWebsocket(r.Id, ws)
+                       defer commandRouter.RemoveWebsocket(ws)
 
                        go KeepFilesUpdated(ws)
                        go KeepPlaylistsUpdated(ws)
 
                        go KeepFilesUpdated(ws)
                        go KeepPlaylistsUpdated(ws)