Use GeneralCommandType in SessionController parameters
This commit is contained in:
parent
3459655bb4
commit
891c538f81
|
@ -215,17 +215,12 @@ namespace Jellyfin.Api.Controllers
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
public ActionResult SendSystemCommand(
|
public ActionResult SendSystemCommand(
|
||||||
[FromRoute, Required] string sessionId,
|
[FromRoute, Required] string sessionId,
|
||||||
[FromRoute, Required] string command)
|
[FromRoute, Required] GeneralCommandType command)
|
||||||
{
|
{
|
||||||
if (!Enum.TryParse(command, true, out GeneralCommandType commandType))
|
|
||||||
{
|
|
||||||
return BadRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request);
|
var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request);
|
||||||
var generalCommand = new GeneralCommand
|
var generalCommand = new GeneralCommand
|
||||||
{
|
{
|
||||||
Name = commandType,
|
Name = command,
|
||||||
ControllingUserId = currentSession.UserId
|
ControllingUserId = currentSession.UserId
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -246,18 +241,13 @@ namespace Jellyfin.Api.Controllers
|
||||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||||
public ActionResult SendGeneralCommand(
|
public ActionResult SendGeneralCommand(
|
||||||
[FromRoute, Required] string sessionId,
|
[FromRoute, Required] string sessionId,
|
||||||
[FromRoute, Required] string command)
|
[FromRoute, Required] GeneralCommandType command)
|
||||||
{
|
{
|
||||||
if (!Enum.TryParse(command, true, out GeneralCommandType commandType))
|
|
||||||
{
|
|
||||||
return BadRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request);
|
var currentSession = RequestHelpers.GetSession(_sessionManager, _authContext, Request);
|
||||||
|
|
||||||
var generalCommand = new GeneralCommand
|
var generalCommand = new GeneralCommand
|
||||||
{
|
{
|
||||||
Name = commandType,
|
Name = command,
|
||||||
ControllingUserId = currentSession.UserId
|
ControllingUserId = currentSession.UserId
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user