aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Server')
-rw-r--r--Jellyfin.Server/Jellyfin.Server.csproj10
-rw-r--r--Jellyfin.Server/Program.cs21
-rw-r--r--Jellyfin.Server/StartupOptions.cs4
3 files changed, 12 insertions, 23 deletions
diff --git a/Jellyfin.Server/Jellyfin.Server.csproj b/Jellyfin.Server/Jellyfin.Server.csproj
index 4cb83cdf0b..58b4164809 100644
--- a/Jellyfin.Server/Jellyfin.Server.csproj
+++ b/Jellyfin.Server/Jellyfin.Server.csproj
@@ -8,7 +8,7 @@
<PropertyGroup>
<AssemblyName>jellyfin</AssemblyName>
<OutputType>Exe</OutputType>
- <TargetFramework>net6.0</TargetFramework>
+ <TargetFramework>net7.0</TargetFramework>
<ServerGarbageCollection>false</ServerGarbageCollection>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
@@ -35,10 +35,10 @@
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
- <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.1" />
- <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
- <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.11" />
- <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="6.0.11" />
+ <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" />
+ <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
+ <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="7.0.0" />
+ <PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="7.0.0" />
<PackageReference Include="prometheus-net" Version="7.0.0" />
<PackageReference Include="prometheus-net.AspNetCore" Version="7.0.0" />
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 0b922f8210..46f45b9adf 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -7,6 +7,7 @@ using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -201,7 +202,7 @@ namespace Jellyfin.Server
{
await webHost.StartAsync(_tokenSource.Token).ConfigureAwait(false);
- if (startupConfig.UseUnixSocket() && Environment.OSVersion.Platform == PlatformID.Unix)
+ if (!OperatingSystem.IsWindows() && startupConfig.UseUnixSocket())
{
var socketPath = GetUnixSocketPath(startupConfig, appPaths);
@@ -691,27 +692,15 @@ namespace Jellyfin.Server
return socketPath;
}
+ [UnsupportedOSPlatform("windows")]
private static void SetUnixSocketPermissions(IConfiguration startupConfig, string socketPath)
{
var socketPerms = startupConfig.GetUnixSocketPermissions();
if (!string.IsNullOrEmpty(socketPerms))
{
- #pragma warning disable SA1300 // Entrypoint is case sensitive.
- [DllImport("libc")]
- static extern int chmod(string pathname, int mode);
- #pragma warning restore SA1300
-
- var exitCode = chmod(socketPath, Convert.ToInt32(socketPerms, 8));
-
- if (exitCode < 0)
- {
- _logger.LogError("Failed to set Kestrel unix socket permissions to {SocketPerms}, return code: {ExitCode}", socketPerms, exitCode);
- }
- else
- {
- _logger.LogInformation("Kestrel unix socket permissions set to {SocketPerms}", socketPerms);
- }
+ File.SetUnixFileMode(socketPath, (UnixFileMode)Convert.ToInt32(socketPerms, 8));
+ _logger.LogInformation("Kestrel unix socket permissions set to {SocketPerms}", socketPerms);
}
}
}
diff --git a/Jellyfin.Server/StartupOptions.cs b/Jellyfin.Server/StartupOptions.cs
index 0a6f9bd920..0d9f379e0e 100644
--- a/Jellyfin.Server/StartupOptions.cs
+++ b/Jellyfin.Server/StartupOptions.cs
@@ -79,9 +79,9 @@ namespace Jellyfin.Server
/// Gets the command line options as a dictionary that can be used in the .NET configuration system.
/// </summary>
/// <returns>The configuration dictionary.</returns>
- public Dictionary<string, string> ConvertToConfig()
+ public Dictionary<string, string?> ConvertToConfig()
{
- var config = new Dictionary<string, string>();
+ var config = new Dictionary<string, string?>();
if (NoWebClient)
{