mirror of
https://github.com/owncast/owncast.git
synced 2024-11-21 20:28:15 +03:00
0b5d7c8a4d
* WIP * fix(test): fix ap test failing * fix: fix unkeyed fields being used * chore(tests): clean up browser tests by splitting out federation UI tests
46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
package core
|
|
|
|
import (
|
|
"github.com/owncast/owncast/config"
|
|
"github.com/owncast/owncast/models"
|
|
"github.com/owncast/owncast/persistence/configrepository"
|
|
)
|
|
|
|
// GetStatus gets the status of the system.
|
|
func GetStatus() models.Status {
|
|
if _stats == nil {
|
|
return models.Status{}
|
|
}
|
|
|
|
viewerCount := 0
|
|
if IsStreamConnected() {
|
|
viewerCount = len(_stats.Viewers)
|
|
}
|
|
|
|
configRepository := configrepository.Get()
|
|
return models.Status{
|
|
Online: IsStreamConnected(),
|
|
ViewerCount: viewerCount,
|
|
OverallMaxViewerCount: _stats.OverallMaxViewerCount,
|
|
SessionMaxViewerCount: _stats.SessionMaxViewerCount,
|
|
LastDisconnectTime: _stats.LastDisconnectTime,
|
|
LastConnectTime: _stats.LastConnectTime,
|
|
VersionNumber: config.VersionNumber,
|
|
StreamTitle: configRepository.GetStreamTitle(),
|
|
}
|
|
}
|
|
|
|
// GetCurrentBroadcast will return the currently active broadcast.
|
|
func GetCurrentBroadcast() *models.CurrentBroadcast {
|
|
return _currentBroadcast
|
|
}
|
|
|
|
// setBroadcaster will store the current inbound broadcasting details.
|
|
func setBroadcaster(broadcaster models.Broadcaster) {
|
|
_broadcaster = &broadcaster
|
|
}
|
|
|
|
// GetBroadcaster will return the details of the currently active broadcaster.
|
|
func GetBroadcaster() *models.Broadcaster {
|
|
return _broadcaster
|
|
}
|