mirror of
https://github.com/owncast/owncast.git
synced 2024-12-25 18:48:31 +03:00
25 lines
724 B
Go
25 lines
724 B
Go
package admin
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/owncast/owncast/controllers"
|
|
"github.com/owncast/owncast/core/chat"
|
|
"github.com/owncast/owncast/core/user"
|
|
)
|
|
|
|
// GetConnectedChatClients returns currently connected clients.
|
|
func GetConnectedChatClients(w http.ResponseWriter, r *http.Request) {
|
|
clients := chat.GetClients()
|
|
w.Header().Set("Content-Type", "application/json")
|
|
|
|
if err := json.NewEncoder(w).Encode(clients); err != nil {
|
|
controllers.InternalErrorHandler(w, err)
|
|
}
|
|
}
|
|
|
|
// ExternalGetConnectedChatClients returns currently connected clients.
|
|
func ExternalGetConnectedChatClients(integration user.ExternalAPIUser, w http.ResponseWriter, r *http.Request) {
|
|
GetConnectedChatClients(w, r)
|
|
}
|