diff --git a/Jellyfin.Api/Controllers/ConfigurationController.cs b/Jellyfin.Api/Controllers/ConfigurationController.cs
index 019703dae..20fb0ec87 100644
--- a/Jellyfin.Api/Controllers/ConfigurationController.cs
+++ b/Jellyfin.Api/Controllers/ConfigurationController.cs
@@ -117,7 +117,7 @@ namespace Jellyfin.Api.Controllers
[HttpPost("MediaEncoder/Path")]
[Authorize(Policy = Policies.FirstTimeSetupOrElevated)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
- public ActionResult UpdateMediaEncoderPath([FromForm, Required] MediaEncoderPathDto mediaEncoderPath)
+ public ActionResult UpdateMediaEncoderPath([FromBody, Required] MediaEncoderPathDto mediaEncoderPath)
{
_mediaEncoder.UpdateEncoderPath(mediaEncoderPath.Path, mediaEncoderPath.PathType);
return NoContent();
diff --git a/Jellyfin.Api/Controllers/StartupController.cs b/Jellyfin.Api/Controllers/StartupController.cs
index c8e3cc4f5..9c259cc19 100644
--- a/Jellyfin.Api/Controllers/StartupController.cs
+++ b/Jellyfin.Api/Controllers/StartupController.cs
@@ -1,3 +1,4 @@
+using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Jellyfin.Api.Constants;
@@ -64,21 +65,16 @@ namespace Jellyfin.Api.Controllers
///
/// Sets the initial startup wizard configuration.
///
- /// The UI language culture.
- /// The metadata country code.
- /// The preferred language for metadata.
+ /// The updated startup configuration.
/// Configuration saved.
/// A indicating success.
[HttpPost("Configuration")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
- public ActionResult UpdateInitialConfiguration(
- [FromForm] string? uiCulture,
- [FromForm] string? metadataCountryCode,
- [FromForm] string? preferredMetadataLanguage)
+ public ActionResult UpdateInitialConfiguration([FromBody, Required] StartupConfigurationDto startupConfiguration)
{
- _config.Configuration.UICulture = uiCulture;
- _config.Configuration.MetadataCountryCode = metadataCountryCode;
- _config.Configuration.PreferredMetadataLanguage = preferredMetadataLanguage;
+ _config.Configuration.UICulture = startupConfiguration.UICulture;
+ _config.Configuration.MetadataCountryCode = startupConfiguration.MetadataCountryCode;
+ _config.Configuration.PreferredMetadataLanguage = startupConfiguration.PreferredMetadataLanguage;
_config.SaveConfiguration();
return NoContent();
}
@@ -86,16 +82,15 @@ namespace Jellyfin.Api.Controllers
///
/// Sets remote access and UPnP.
///
- /// Enable remote access.
- /// Enable UPnP.
+ /// The startup remote access dto.
/// Configuration saved.
/// A indicating success.
[HttpPost("RemoteAccess")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
- public ActionResult SetRemoteAccess([FromForm] bool enableRemoteAccess, [FromForm] bool enableAutomaticPortMapping)
+ public ActionResult SetRemoteAccess([FromBody, Required] StartupRemoteAccessDto startupRemoteAccessDto)
{
- _config.Configuration.EnableRemoteAccess = enableRemoteAccess;
- _config.Configuration.EnableUPnP = enableAutomaticPortMapping;
+ _config.Configuration.EnableRemoteAccess = startupRemoteAccessDto.EnableRemoteAccess;
+ _config.Configuration.EnableUPnP = startupRemoteAccessDto.EnableAutomaticPortMapping;
_config.SaveConfiguration();
return NoContent();
}
@@ -131,7 +126,7 @@ namespace Jellyfin.Api.Controllers
///
[HttpPost("User")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
- public async Task UpdateStartupUser([FromForm] StartupUserDto startupUserDto)
+ public async Task UpdateStartupUser([FromBody] StartupUserDto startupUserDto)
{
var user = _userManager.Users.First();
diff --git a/Jellyfin.Api/Models/StartupDtos/StartupRemoteAccessDto.cs b/Jellyfin.Api/Models/StartupDtos/StartupRemoteAccessDto.cs
new file mode 100644
index 000000000..4027ba41a
--- /dev/null
+++ b/Jellyfin.Api/Models/StartupDtos/StartupRemoteAccessDto.cs
@@ -0,0 +1,22 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Jellyfin.Api.Models.StartupDtos
+{
+ ///
+ /// Startup remote access dto.
+ ///
+ public class StartupRemoteAccessDto
+ {
+ ///
+ /// Gets or sets a value indicating whether enable remote access.
+ ///
+ [Required]
+ public bool EnableRemoteAccess { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether enable automatic port mapping.
+ ///
+ [Required]
+ public bool EnableAutomaticPortMapping { get; set; }
+ }
+}