fixes lol
All checks were successful
Build and Push / build-all (push) Successful in 9m27s

This commit is contained in:
doomtube 2026-01-11 10:57:46 -05:00
parent 9e985d05f1
commit 33c20bf59d
11 changed files with 107 additions and 45 deletions

View file

@ -211,20 +211,22 @@ void StreamController::issueViewerToken(const HttpRequestPtr &,
void StreamController::heartbeat(const HttpRequestPtr &req,
std::function<void(const HttpResponsePtr &)> &&callback,
const std::string &realmId,
const std::string &streamKey) {
auto token = req->getCookie("viewer_token");
// Use realm-specific cookie to support multi-stream viewing
auto token = req->getCookie("viewer_token_" + realmId);
if (token.empty()) {
callback(jsonResp({}, k403Forbidden));
return;
}
RedisHelper::getKeyAsync("viewer_token:" + token,
RedisHelper::getKeyAsync("viewer_token:" + token,
[callback, streamKey, token](const std::string& storedStreamKey) {
if (storedStreamKey != streamKey) {
callback(jsonResp({}, k403Forbidden));
return;
}
// Refresh token TTL to 5 minutes on heartbeat
services::RedisHelper::instance().expireAsync("viewer_token:" + token, 300,
[callback](bool success) {
@ -232,7 +234,7 @@ void StreamController::heartbeat(const HttpRequestPtr &req,
callback(jsonResp({}, k500InternalServerError));
return;
}
callback(jsonOk(json({
{"success", true},
{"renewed", true}