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 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>
|
||||
/// 初始化HTTP视频流控制器
|
||||
/// </summary>
|
||||
|
@ -60,6 +68,40 @@ public class VideoStreamController : ControllerBase
|
|||
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>
|
||||
/// 获取 HTTP 视频流服务状态
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue