luoqian a68bb6c4b3 feat: 新增文件库功能,支持局域网文件浏览与媒体播放
后端:
- 新增 ManagedLibraryRoot / ManagedFileRecord 数据模型及 SQLite 迁移
- 新增文件库服务、端点服务及定时扫描后台任务
- 新增 REST API: drives、directories、roots CRUD、files 分页搜索、文本预览
- 新增文件流端点支持视频/音频流式传输
- 数据库切换为 SQLite,Kestrel 绑定 0.0.0.0 支持局域网访问

前端:
- 管理端:磁盘浏览、目录选择、根目录添加/启用/删除/扫描
- 客户端:根目录选择、文件搜索/筛选/分页、音视频播放、文本预览
- 全新响应式 UI(桌面+移动端),CSS 变量设计系统
- HTTP 客户端支持 Vite 开发代理与生产同源自动切换
- 移除 HTTPS 强制重定向以提升移动端视频流兼容性
2026-05-21 16:45:56 +08:00

65 lines
1.8 KiB
C#

using System.Text.Json.Serialization;
namespace Avalonia_Services.Services.FileLibrary
{
public sealed record AddLibraryRootRequest(
[property: JsonPropertyName("path")] string? Path,
[property: JsonPropertyName("displayName")] string? DisplayName = null,
[property: JsonPropertyName("scanIntervalMinutes")] int? ScanIntervalMinutes = null);
public sealed record UpdateLibraryRootRequest(
[property: JsonPropertyName("id")] int Id,
[property: JsonPropertyName("isEnabled")] bool IsEnabled);
public sealed record ScanLibraryRootRequest(
[property: JsonPropertyName("id")] int Id);
public sealed record DeleteLibraryRootRequest(
[property: JsonPropertyName("id")] int Id);
public sealed record DriveDto(
string Name,
string DisplayName,
string RootDirectory,
string DriveType,
long? TotalSize,
long? AvailableFreeSpace,
bool IsReady);
public sealed record DirectoryDto(
string Name,
string FullPath);
public sealed record LibraryRootDto(
int Id,
string Path,
string DisplayName,
bool IsEnabled,
bool IsAvailable,
int ScanIntervalMinutes,
DateTime? LastScanStartedAt,
DateTime? LastScanCompletedAt,
string? LastScanError,
int FileCount);
public sealed record FileRecordDto(
int Id,
int LibraryRootId,
string FileName,
string RelativePath,
string Extension,
long SizeBytes,
DateTime LastWriteTimeUtc,
string MediaType,
string ContentType,
string StreamUrl,
string? TextUrl,
bool BrowserPlayable);
public sealed record TextPreviewDto(
int Id,
string FileName,
string Content,
bool Truncated);
}