Preserve SplashscreenLocation when updating branding config (#13756)

* add BrandingOptionsDto and add branding endpoints

* refactor new HttpGet Configuration Branding into existing API calls

* Add BrandingOptions to _ignoredConfigurations for openAPI

* rename BrandOptionsDto to BrandingOptionsDto
This commit is contained in:
KGT1
2025-04-01 01:46:01 +02:00
committed by GitHub
parent 940c4e8ba8
commit 14b785d188
5 changed files with 62 additions and 10 deletions

View File

@@ -9,6 +9,7 @@ using Jellyfin.Extensions.Json;
using MediaBrowser.Common.Api;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Branding;
using MediaBrowser.Model.Configuration;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
@@ -119,6 +120,30 @@ public class ConfigurationController : BaseJellyfinApiController
return new MetadataOptions();
}
/// <summary>
/// Updates branding configuration.
/// </summary>
/// <param name="configuration">Branding configuration.</param>
/// <response code="204">Branding configuration updated.</response>
/// <returns>Update status.</returns>
[HttpPost("Configuration/Branding")]
[Authorize(Policy = Policies.RequiresElevation)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult UpdateBrandingConfiguration([FromBody, Required] BrandingOptionsDto configuration)
{
// Get the current branding configuration to preserve SplashscreenLocation
var currentBranding = (BrandingOptions)_configurationManager.GetConfiguration("branding");
// Update only the properties from BrandingOptionsDto
currentBranding.LoginDisclaimer = configuration.LoginDisclaimer;
currentBranding.CustomCss = configuration.CustomCss;
currentBranding.SplashscreenEnabled = configuration.SplashscreenEnabled;
_configurationManager.SaveConfiguration("branding", currentBranding);
return NoContent();
}
/// <summary>
/// Updates the path to the media encoder.
/// </summary>