M0: remote access server - Kestrel embedded (token auth/pair/queue API/library/range streaming/web companion zero-install), QR pairing window, DownloadQueueAdapter, auto-start+palette commands. Server E2E green (102 tests)
This commit is contained in:
parent
40c1b39b70
commit
bb569acd96
15 changed files with 734 additions and 0 deletions
45
VideoDownloader.Server/ServerModels.cs
Normal file
45
VideoDownloader.Server/ServerModels.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
namespace VideoDownloader.Server;
|
||||
|
||||
/// <summary>다운로드 큐 항목 스냅shot (모바일/웹 컴패니언용).</summary>
|
||||
public sealed record QueueItemDto(string Id, string Title, string Url, string Status, double Percent);
|
||||
|
||||
/// <summary>라이브러리(저장 폴더) 미디어 항목.</summary>
|
||||
public sealed record LibraryItemDto(string Id, string FileName, long SizeBytes, DateTime Modified);
|
||||
|
||||
/// <summary>서버 구성.</summary>
|
||||
public sealed class ServerOptions
|
||||
{
|
||||
/// <summary>0 이면 사용 가능한 포트 자동 할당.</summary>
|
||||
public int Port { get; init; }
|
||||
/// <summary>페어링 토큰(Bearer). 비면 자동 생성.</summary>
|
||||
public string Token { get; init; } = "";
|
||||
/// <summary>라이브러리로 노출할 폴더.</summary>
|
||||
public string LibraryFolder { get; init; } = "";
|
||||
/// <summary>다운로드 큐 어댑터(호스트 앱이 구현 주입).</summary>
|
||||
public IQueueAdapter Queue { get; init; } = new EmptyQueueAdapter();
|
||||
/// <summary>기기 표시명(웹 컴패니언 헤더용).</summary>
|
||||
public string DeviceName { get; init; } = Environment.MachineName;
|
||||
}
|
||||
|
||||
/// <summary>호스트 앱의 다운로드 큐와 서버를 잇는 어댑터(UI 스레드 마샬링은 구현측 담당).</summary>
|
||||
public interface IQueueAdapter
|
||||
{
|
||||
Task<IReadOnlyList<QueueItemDto>> GetItemsAsync();
|
||||
Task<string> AddAsync(string url, string? title);
|
||||
Task PauseAsync(string id);
|
||||
Task ResumeAsync(string id);
|
||||
Task CancelAsync(string id);
|
||||
event Action? Changed;
|
||||
}
|
||||
|
||||
/// <summary>큐 없이 서버만 띄울 때의 기본 구현.</summary>
|
||||
public sealed class EmptyQueueAdapter : IQueueAdapter
|
||||
{
|
||||
public Task<IReadOnlyList<QueueItemDto>> GetItemsAsync() =>
|
||||
Task.FromResult<IReadOnlyList<QueueItemDto>>(Array.Empty<QueueItemDto>());
|
||||
public Task<string> AddAsync(string url, string? title) => Task.FromResult("");
|
||||
public Task PauseAsync(string id) => Task.CompletedTask;
|
||||
public Task ResumeAsync(string id) => Task.CompletedTask;
|
||||
public Task CancelAsync(string id) => Task.CompletedTask;
|
||||
public event Action? Changed { add { } remove { } }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue