< Summary - Jellyfin

Information
Class: Jellyfin.Api.Controllers.BrandingController
Assembly: Jellyfin.Api
File(s): /srv/git/jellyfin/Jellyfin.Api/Controllers/BrandingController.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 56
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
GetBrandingOptions()100%11100%
GetBrandingCss()100%22100%

File(s)

/srv/git/jellyfin/Jellyfin.Api/Controllers/BrandingController.cs

#LineLine coverage
 1using MediaBrowser.Common.Configuration;
 2using MediaBrowser.Controller.Configuration;
 3using MediaBrowser.Model.Branding;
 4using Microsoft.AspNetCore.Http;
 5using Microsoft.AspNetCore.Mvc;
 6
 7namespace Jellyfin.Api.Controllers;
 8
 9/// <summary>
 10/// Branding controller.
 11/// </summary>
 12public class BrandingController : BaseJellyfinApiController
 13{
 14    private readonly IServerConfigurationManager _serverConfigurationManager;
 15
 16    /// <summary>
 17    /// Initializes a new instance of the <see cref="BrandingController"/> class.
 18    /// </summary>
 19    /// <param name="serverConfigurationManager">Instance of the <see cref="IServerConfigurationManager"/> interface.</p
 320    public BrandingController(IServerConfigurationManager serverConfigurationManager)
 21    {
 322        _serverConfigurationManager = serverConfigurationManager;
 323    }
 24
 25    /// <summary>
 26    /// Gets branding configuration.
 27    /// </summary>
 28    /// <response code="200">Branding configuration returned.</response>
 29    /// <returns>An <see cref="OkResult"/> containing the branding configuration.</returns>
 30    [HttpGet("Configuration")]
 31    [ProducesResponseType(StatusCodes.Status200OK)]
 32    public ActionResult<BrandingOptions> GetBrandingOptions()
 33    {
 134        return _serverConfigurationManager.GetConfiguration<BrandingOptions>("branding");
 35    }
 36
 37    /// <summary>
 38    /// Gets branding css.
 39    /// </summary>
 40    /// <response code="200">Branding css returned.</response>
 41    /// <response code="204">No branding css configured.</response>
 42    /// <returns>
 43    /// An <see cref="OkResult"/> containing the branding css if exist,
 44    /// or a <see cref="NoContentResult"/> if the css is not configured.
 45    /// </returns>
 46    [HttpGet("Css")]
 47    [HttpGet("Css.css", Name = "GetBrandingCss_2")]
 48    [Produces("text/css")]
 49    [ProducesResponseType(StatusCodes.Status200OK)]
 50    [ProducesResponseType(StatusCodes.Status204NoContent)]
 51    public ActionResult<string> GetBrandingCss()
 52    {
 253        var options = _serverConfigurationManager.GetConfiguration<BrandingOptions>("branding");
 254        return options.CustomCss ?? string.Empty;
 55    }
 56}