Compare commits
3 Commits
9af4546a11
...
4b2afe13db
Author | SHA1 | Date |
---|---|---|
|
4b2afe13db | |
|
0547bb5a02 | |
|
771f5e8e9f |
|
@ -20,6 +20,14 @@ public class VideoStreamController : ControllerBase
|
||||||
private readonly HttpVideoStreamService _videoStreamService;
|
private readonly HttpVideoStreamService _videoStreamService;
|
||||||
private readonly Database.UserManager _userManager;
|
private readonly Database.UserManager _userManager;
|
||||||
|
|
||||||
|
public class AvailableResolutionsResponse
|
||||||
|
{
|
||||||
|
public int Width { get; set; }
|
||||||
|
public int Height { get; set; }
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
public string Value => $"{Width}x{Height}";
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 初始化HTTP视频流控制器
|
/// 初始化HTTP视频流控制器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -60,6 +68,40 @@ public class VideoStreamController : ControllerBase
|
||||||
return boardId.ToString();
|
return boardId.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Optional<string> TryGetBoardId()
|
||||||
|
{
|
||||||
|
var userName = User.FindFirstValue(ClaimTypes.Name);
|
||||||
|
if (string.IsNullOrEmpty(userName))
|
||||||
|
{
|
||||||
|
logger.Error("User name not found in claims.");
|
||||||
|
return Optional<string>.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
var db = new AppDataConnection();
|
||||||
|
if (db == null)
|
||||||
|
{
|
||||||
|
logger.Error("Database connection failed.");
|
||||||
|
return Optional<string>.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
var userRet = db.GetUserByName(userName);
|
||||||
|
if (!userRet.IsSuccessful || !userRet.Value.HasValue)
|
||||||
|
{
|
||||||
|
logger.Error("User not found.");
|
||||||
|
return Optional<string>.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
var user = userRet.Value.Value;
|
||||||
|
var boardId = user.BoardID;
|
||||||
|
if (boardId == Guid.Empty)
|
||||||
|
{
|
||||||
|
logger.Error("No board bound to this user.");
|
||||||
|
return Optional<string>.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
return boardId.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取 HTTP 视频流服务状态
|
/// 获取 HTTP 视频流服务状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue