Add support for active viewer details API. Closes #1477 (#1747)

This commit is contained in:
Gabe Kangas
2022-03-06 17:31:47 -08:00
committed by GitHub
parent 92041c4c23
commit 98fce01b52
7 changed files with 96 additions and 23 deletions

View File

@@ -4,11 +4,11 @@ import (
"net/http"
"github.com/owncast/owncast/core"
"github.com/owncast/owncast/utils"
"github.com/owncast/owncast/models"
)
// Ping is fired by a client to show they are still an active viewer.
func Ping(w http.ResponseWriter, r *http.Request) {
id := utils.GenerateClientIDFromRequest(r)
core.SetViewerIDActive(id)
viewer := models.GenerateViewerFromRequest(r)
core.SetViewerActive(&viewer)
}