2019-01-13 13:01:16 -07:00
|
|
|
using MediaBrowser.Common.Configuration;
|
2019-11-17 15:05:39 -07:00
|
|
|
using MediaBrowser.Controller.Configuration;
|
|
|
|
using MediaBrowser.Controller.Net;
|
2014-07-03 19:22:57 -07:00
|
|
|
using MediaBrowser.Model.Branding;
|
2016-10-25 12:02:04 -07:00
|
|
|
using MediaBrowser.Model.Services;
|
2019-11-17 15:05:39 -07:00
|
|
|
using Microsoft.Extensions.Logging;
|
2014-07-03 19:22:57 -07:00
|
|
|
|
|
|
|
namespace MediaBrowser.Api
|
|
|
|
{
|
|
|
|
[Route("/Branding/Configuration", "GET", Summary = "Gets branding configuration")]
|
|
|
|
public class GetBrandingOptions : IReturn<BrandingOptions>
|
|
|
|
{
|
|
|
|
}
|
2015-01-18 22:41:56 -07:00
|
|
|
|
|
|
|
[Route("/Branding/Css", "GET", Summary = "Gets custom css")]
|
2016-04-18 11:01:50 -07:00
|
|
|
[Route("/Branding/Css.css", "GET", Summary = "Gets custom css")]
|
2015-01-18 22:41:56 -07:00
|
|
|
public class GetBrandingCss
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-07-03 19:22:57 -07:00
|
|
|
public class BrandingService : BaseApiService
|
|
|
|
{
|
2019-11-17 15:05:39 -07:00
|
|
|
public BrandingService(
|
|
|
|
ILogger<BrandingService> logger,
|
|
|
|
IServerConfigurationManager serverConfigurationManager,
|
|
|
|
IHttpResultFactory httpResultFactory)
|
|
|
|
: base(logger, serverConfigurationManager, httpResultFactory)
|
2014-07-03 19:22:57 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public object Get(GetBrandingOptions request)
|
|
|
|
{
|
2019-11-17 15:05:39 -07:00
|
|
|
return ServerConfigurationManager.GetConfiguration<BrandingOptions>("branding");
|
2014-07-03 19:22:57 -07:00
|
|
|
}
|
2015-01-18 22:41:56 -07:00
|
|
|
|
|
|
|
public object Get(GetBrandingCss request)
|
|
|
|
{
|
2019-11-17 15:05:39 -07:00
|
|
|
var result = ServerConfigurationManager.GetConfiguration<BrandingOptions>("branding");
|
2015-01-18 22:41:56 -07:00
|
|
|
|
2018-09-12 10:26:21 -07:00
|
|
|
// 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");
|
2015-01-18 22:41:56 -07:00
|
|
|
}
|
2014-07-03 19:22:57 -07:00
|
|
|
}
|
|
|
|
}
|