Add JSON config, DB-backed library options, and docs

- Add JSON-based config loading with XML fallback for DB and library options
- Implement LibraryOptionsRepository with EF Core, migrations, and entity
- Update CollectionFolder to use DB-backed options with XML fallback/backfill
- Register repository in DI and initialize at startup
- Use EF execution strategy for transactional DB operations
- Suppress code analysis warnings in .csproj and test files
- Add DATABASE_MIGRATION.md, LIBRARY_OPTIONS_DB_DESIGN.md, and WEBSOCKET_AUTHENTICATION.md
- Add database.json.example and improve migration docs
- Add tests for JSON config loader and update test naming warnings
This commit is contained in:
2026-04-30 12:25:24 -04:00
parent bad167656a
commit e81c127514
80 changed files with 2039 additions and 140 deletions
@@ -22,6 +22,15 @@ namespace Emby.Server.Implementations.HttpServer
/// <summary>
/// Class WebSocketConnection.
/// Represents an authenticated WebSocket connection to a Jellyfin client.
///
/// Authentication is performed during connection establishment in WebSocketManager.
/// The client must provide a valid API token via one of these methods:
/// - Query parameter: ws://server:8096/socket?api_key=TOKEN
/// - Authorization header: MediaBrowser Token="..."
/// - Legacy headers: X-Emby-Token or X-MediaBrowser-Token
///
/// Once established, AuthorizationInfo contains the authenticated user/device information.
/// </summary>
public class WebSocketConnection : IWebSocketConnection
{
@@ -47,7 +56,7 @@ namespace Emby.Server.Implementations.HttpServer
/// </summary>
/// <param name="logger">The logger.</param>
/// <param name="socket">The socket.</param>
/// <param name="authorizationInfo">The authorization information.</param>
/// <param name="authorizationInfo">The authorization information containing authenticated user/device details.</param>
/// <param name="remoteEndPoint">The remote end point.</param>
public WebSocketConnection(
ILogger<WebSocketConnection> logger,
@@ -18,6 +18,25 @@ using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.HttpServer
{
/// <summary>
/// Manages WebSocket connections with authentication support.
///
/// Clients should authenticate when connecting to WebSocket endpoints by providing an API token
/// through one of these methods:
///
/// 1. Query String Parameter (Recommended):
/// - URL: ws://jellyfin-server:8096/socket?api_key=YOUR_API_TOKEN
/// - JavaScript: const ws = new WebSocket(`ws://jellyfin-server:8096/socket?api_key=${token}`);
///
/// 2. Query String Parameter (Legacy):
/// - URL: ws://jellyfin-server:8096/socket?ApiKey=YOUR_API_TOKEN
///
/// 3. Authorization Header:
/// - Header: MediaBrowser Device="...", Token="YOUR_API_TOKEN"
///
/// The API token can be obtained from the server's API key management interface or
/// generated for specific clients/devices.
/// </summary>
public class WebSocketManager : IWebSocketManager
{
private readonly IWebSocketListener[] _webSocketListeners;