mirror of
https://github.com/owncast/owncast.git
synced 2024-11-29 11:39:08 +03:00
35 lines
795 B
Go
35 lines
795 B
Go
package admin
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/gabek/owncast/controllers"
|
|
"github.com/gabek/owncast/core"
|
|
"github.com/gabek/owncast/models"
|
|
)
|
|
|
|
// GetInboundBroadasterDetails gets the details of the inbound broadcaster
|
|
func GetInboundBroadasterDetails(w http.ResponseWriter, r *http.Request) {
|
|
broadcaster := core.GetBroadcaster()
|
|
if broadcaster == nil {
|
|
controllers.WriteSimpleResponse(w, false, "no broadcaster connected")
|
|
return
|
|
}
|
|
|
|
response := inboundBroadasterDetailsResponse{
|
|
models.BaseAPIResponse{
|
|
true,
|
|
"",
|
|
},
|
|
broadcaster,
|
|
}
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
json.NewEncoder(w).Encode(response)
|
|
}
|
|
|
|
type inboundBroadasterDetailsResponse struct {
|
|
models.BaseAPIResponse
|
|
Broadcaster *models.Broadcaster `json:"broadcaster"`
|
|
}
|