using MediaBrowser.Common.Configuration; using MediaBrowser.Controller.Configuration; using MediaBrowser.Model.Branding; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; namespace Jellyfin.Api.Controllers; /// /// Branding controller. /// public class BrandingController : BaseJellyfinApiController { private readonly IServerConfigurationManager _serverConfigurationManager; /// /// Initializes a new instance of the class. /// /// Instance of the interface. public BrandingController(IServerConfigurationManager serverConfigurationManager) { _serverConfigurationManager = serverConfigurationManager; } /// /// Gets branding configuration. /// /// Branding configuration returned. /// An containing the branding configuration. [HttpGet("Configuration")] [ProducesResponseType(StatusCodes.Status200OK)] public ActionResult GetBrandingOptions() { return _serverConfigurationManager.GetConfiguration("branding"); } /// /// Gets branding css. /// /// Branding css returned. /// No branding css configured. /// /// An containing the branding css if exist, /// or a if the css is not configured. /// [HttpGet("Css")] [HttpGet("Css.css", Name = "GetBrandingCss_2")] [Produces("text/css")] [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult GetBrandingCss() { var options = _serverConfigurationManager.GetConfiguration("branding"); return options.CustomCss ?? string.Empty; } }