jellyfin-server/MediaBrowser.Api/BrandingService.cs
Bond_009 3221e837f9 * Add support for multi segment base urls
* Make baseurl case-insensitive
2019-11-25 11:55:24 +01:00

45 lines
1.4 KiB
C#

using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Branding;
using MediaBrowser.Model.Services;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api
{
[Route("/Branding/Configuration", "GET", Summary = "Gets branding configuration")]
public class GetBrandingOptions : IReturn<BrandingOptions>
{
}
[Route("/Branding/Css", "GET", Summary = "Gets custom css")]
[Route("/Branding/Css.css", "GET", Summary = "Gets custom css")]
public class GetBrandingCss
{
}
public class BrandingService : BaseApiService
{
public BrandingService(
ILogger<BrandingService> logger,
IServerConfigurationManager serverConfigurationManager,
IHttpResultFactory httpResultFactory)
: base(logger, serverConfigurationManager, httpResultFactory)
{
}
public object Get(GetBrandingOptions request)
{
return ServerConfigurationManager.GetConfiguration<BrandingOptions>("branding");
}
public object Get(GetBrandingCss request)
{
var result = ServerConfigurationManager.GetConfiguration<BrandingOptions>("branding");
// When null this throws a 405 error under Mono OSX, so default to empty string
return ResultFactory.GetResult(Request, result.CustomCss ?? string.Empty, "text/css");
}
}
}