requesthandler: Fix oopsies in OpenVideoMixProjector

This commit is contained in:
tt2468 2022-07-02 08:26:58 -07:00
parent 798eebf638
commit 2524dc47cf

View File

@ -219,7 +219,7 @@ RequestResult RequestHandler::OpenVideoMixProjector(const Request &request)
{ {
RequestStatus::RequestStatus statusCode; RequestStatus::RequestStatus statusCode;
std::string comment; std::string comment;
if (!request.ValidateString("mixType", statusCode, comment)) if (!request.ValidateString("videoMixType", statusCode, comment))
return RequestResult::Error(statusCode, comment); return RequestResult::Error(statusCode, comment);
std::string videoMixType = request.RequestData["videoMixType"]; std::string videoMixType = request.RequestData["videoMixType"];
@ -231,8 +231,7 @@ RequestResult RequestHandler::OpenVideoMixProjector(const Request &request)
else if (videoMixType == "OBS_WEBSOCKET_VIDEO_MIX_TYPE_MULTIVIEW") else if (videoMixType == "OBS_WEBSOCKET_VIDEO_MIX_TYPE_MULTIVIEW")
projectorType = "Multiview"; projectorType = "Multiview";
else else
return RequestResult::Error(RequestStatus::InvalidRequestField, return RequestResult::Error(RequestStatus::InvalidRequestField, "The field `videoMixType` has an invalid enum value.");
"The field `videoMixType` has an invalid enum value.");
int monitorIndex = -1; int monitorIndex = -1;
if (request.Contains("monitorIndex")) { if (request.Contains("monitorIndex")) {
@ -246,8 +245,7 @@ RequestResult RequestHandler::OpenVideoMixProjector(const Request &request)
if (!request.ValidateOptionalString("projectorGeometry", statusCode, comment)) if (!request.ValidateOptionalString("projectorGeometry", statusCode, comment))
return RequestResult::Error(statusCode, comment); return RequestResult::Error(statusCode, comment);
if (monitorIndex != -1) if (monitorIndex != -1)
return RequestResult::Error(RequestStatus::TooManyRequestFields, return RequestResult::Error(RequestStatus::TooManyRequestFields, "`monitorIndex` and `projectorGeometry` are mutually exclusive.");
"`monitorIndex` and `projectorGeometry` are mutually exclusive.");
projectorGeometry = request.RequestData["projectorGeometry"]; projectorGeometry = request.RequestData["projectorGeometry"];
} }
@ -292,8 +290,7 @@ RequestResult RequestHandler::OpenSourceProjector(const Request &request)
if (!request.ValidateOptionalString("projectorGeometry", statusCode, comment)) if (!request.ValidateOptionalString("projectorGeometry", statusCode, comment))
return RequestResult::Error(statusCode, comment); return RequestResult::Error(statusCode, comment);
if (monitorIndex != -1) if (monitorIndex != -1)
return RequestResult::Error(RequestStatus::TooManyRequestFields, return RequestResult::Error(RequestStatus::TooManyRequestFields, "`monitorIndex` and `projectorGeometry` are mutually exclusive.");
"`monitorIndex` and `projectorGeometry` are mutually exclusive.");
projectorGeometry = request.RequestData["projectorGeometry"]; projectorGeometry = request.RequestData["projectorGeometry"];
} }