aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs18
-rw-r--r--Emby.Server.Implementations/HttpServer/HttpListenerHost.cs17
-rw-r--r--Emby.Server.Implementations/Localization/Core/cs.json26
-rw-r--r--Emby.Server.Implementations/Services/ServiceController.cs20
-rw-r--r--Jellyfin.Drawing.Skia/SkiaEncoder.cs3
-rw-r--r--Jellyfin.Server/Program.cs18
-rw-r--r--MediaBrowser.Common/Net/HttpResponseInfo.cs1
-rw-r--r--MediaBrowser.Common/System/OperatingSystem.cs10
-rw-r--r--MediaBrowser.Controller/Net/IHttpServer.cs2
9 files changed, 77 insertions, 38 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 4fbc933a8..c959cc974 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -43,6 +43,7 @@ using Emby.Server.Implementations.Playlists;
using Emby.Server.Implementations.ScheduledTasks;
using Emby.Server.Implementations.Security;
using Emby.Server.Implementations.Serialization;
+using Emby.Server.Implementations.Services;
using Emby.Server.Implementations.Session;
using Emby.Server.Implementations.SocketSharp;
using Emby.Server.Implementations.TV;
@@ -758,6 +759,7 @@ namespace Emby.Server.Implementations
CertificateInfo = GetCertificateInfo(true);
Certificate = GetCertificate(CertificateInfo);
+ serviceCollection.AddSingleton<ServiceController>();
serviceCollection.AddSingleton<IHttpListener, WebSocketSharpListener>();
serviceCollection.AddSingleton<IHttpServer, HttpListenerHost>();
@@ -1063,7 +1065,7 @@ namespace Emby.Server.Implementations
.Where(i => i != null)
.ToArray();
- HttpServer.Init(GetExports<IService>(false), GetExports<IWebSocketListener>(), GetUrlPrefixes());
+ HttpServer.Init(GetExportTypes<IService>(), GetExports<IWebSocketListener>(), GetUrlPrefixes());
LibraryManager.AddParts(
GetExports<IResolverIgnoreRule>(),
@@ -1507,18 +1509,10 @@ namespace Emby.Server.Implementations
public string GetLocalApiUrl(ReadOnlySpan<char> host)
{
var url = new StringBuilder(64);
- if (EnableHttps)
- {
- url.Append("https://");
- }
- else
- {
- url.Append("http://");
- }
-
- url.Append(host)
+ url.Append(EnableHttps ? "https://" : "http://")
+ .Append(host)
.Append(':')
- .Append(HttpPort);
+ .Append(EnableHttps ? HttpsPort : HttpPort);
string baseUrl = ServerConfigurationManager.Configuration.BaseUrl;
if (baseUrl.Length != 0)
diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
index e8ea8d033..62735b7cf 100644
--- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
+++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs
@@ -64,6 +64,7 @@ namespace Emby.Server.Implementations.HttpServer
IXmlSerializer xmlSerializer,
IHttpListener socketListener,
ILocalizationManager localizationManager,
+ ServiceController serviceController,
IHostEnvironment hostEnvironment)
{
_appHost = applicationHost;
@@ -75,6 +76,8 @@ namespace Emby.Server.Implementations.HttpServer
_jsonSerializer = jsonSerializer;
_xmlSerializer = xmlSerializer;
_socketListener = socketListener;
+ ServiceController = serviceController;
+
_socketListener.WebSocketConnected = OnWebSocketConnected;
_hostEnvironment = hostEnvironment;
@@ -95,7 +98,7 @@ namespace Emby.Server.Implementations.HttpServer
public string GlobalResponse { get; set; }
- public ServiceController ServiceController { get; private set; }
+ public ServiceController ServiceController { get; }
public object CreateInstance(Type type)
{
@@ -602,17 +605,15 @@ namespace Emby.Server.Implementations.HttpServer
/// <summary>
/// Adds the rest handlers.
/// </summary>
- /// <param name="services">The services.</param>
- /// <param name="listeners"></param>
- /// <param name="urlPrefixes"></param>
- public void Init(IEnumerable<IService> services, IEnumerable<IWebSocketListener> listeners, IEnumerable<string> urlPrefixes)
+ /// <param name="serviceTypes">The service types to register with the <see cref="ServiceController"/>.</param>
+ /// <param name="listeners">The web socket listeners.</param>
+ /// <param name="urlPrefixes">The URL prefixes. See <see cref="UrlPrefixes"/>.</param>
+ public void Init(IEnumerable<Type> serviceTypes, IEnumerable<IWebSocketListener> listeners, IEnumerable<string> urlPrefixes)
{
_webSocketListeners = listeners.ToArray();
UrlPrefixes = urlPrefixes.ToArray();
- ServiceController = new ServiceController();
- var types = services.Select(r => r.GetType());
- ServiceController.Init(this, types);
+ ServiceController.Init(this, serviceTypes);
ResponseFilters = new Action<IRequest, HttpResponse, object>[]
{
diff --git a/Emby.Server.Implementations/Localization/Core/cs.json b/Emby.Server.Implementations/Localization/Core/cs.json
index f3136c032..992bb9df3 100644
--- a/Emby.Server.Implementations/Localization/Core/cs.json
+++ b/Emby.Server.Implementations/Localization/Core/cs.json
@@ -5,7 +5,7 @@
"Artists": "Umělci",
"AuthenticationSucceededWithUserName": "{0} úspěšně ověřen",
"Books": "Knihy",
- "CameraImageUploadedFrom": "Z {0} byla nahrána nová fotografie",
+ "CameraImageUploadedFrom": "Z {0} byla nahrána nová fotografie z fotoaparátu",
"Channels": "Kanály",
"ChapterNameValue": "Kapitola {0}",
"Collections": "Kolekce",
@@ -92,5 +92,27 @@
"UserStoppedPlayingItemWithValues": "{0} zastavil přehrávání {1}",
"ValueHasBeenAddedToLibrary": "{0} byl přidán do vaší knihovny médií",
"ValueSpecialEpisodeName": "Speciál - {0}",
- "VersionNumber": "Verze {0}"
+ "VersionNumber": "Verze {0}",
+ "TaskDownloadMissingSubtitlesDescription": "Vyhledá na internetu chybějící titulky na základě nastavení metadat.",
+ "TaskDownloadMissingSubtitles": "Stáhnout chybějící titulky",
+ "TaskRefreshChannelsDescription": "Obnoví informace o internetových kanálech.",
+ "TaskRefreshChannels": "Obnovit kanály",
+ "TaskCleanTranscodeDescription": "Odstraní více než 1 den staré transkódované soubory.",
+ "TaskCleanTranscode": "Vyčistit adresář s transkódovaným obsahem",
+ "TaskUpdatePluginsDescription": "Stáhne a nainstaluje aktualizace zásuvných modulů, které mají nastavenou automatickou aktualizaci.",
+ "TaskUpdatePlugins": "Aktualizovat zásuvné moduly",
+ "TaskRefreshPeopleDescription": "Aktualizuje metadata umělců a režisérů ve Vaší knihovně médií.",
+ "TaskRefreshPeople": "Obnovit umělce",
+ "TaskCleanLogsDescription": "Odstraní soubory protokolu, které jsou starší více než {0} dní.",
+ "TaskCleanLogs": "Vyčistit adresář se souborem protokolu",
+ "TaskRefreshLibraryDescription": "Prohledá Vaši knihovnu médií zda neobsahuje nové soubory a obnoví metadatada.",
+ "TaskRefreshLibrary": "Prohledat knihovnu médií",
+ "TaskRefreshChapterImagesDescription": "Vytvoří náhledy videí, které obsahují kapitoly.",
+ "TaskRefreshChapterImages": "Extrahovat obrázky kapitol",
+ "TaskCleanCacheDescription": "Odstraní soubory mezipaměti, které systém již nebude potřebovat.",
+ "TaskCleanCache": "Vyčistit složku s mezipamětí",
+ "TasksChannelsCategory": "Internetové kanály",
+ "TasksApplicationCategory": "Aplikace",
+ "TasksLibraryCategory": "Knihovna",
+ "TasksMaintenanceCategory": "Údržba"
}
diff --git a/Emby.Server.Implementations/Services/ServiceController.cs b/Emby.Server.Implementations/Services/ServiceController.cs
index d963f9043..e24a95dbb 100644
--- a/Emby.Server.Implementations/Services/ServiceController.cs
+++ b/Emby.Server.Implementations/Services/ServiceController.cs
@@ -3,14 +3,27 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Emby.Server.Implementations.HttpServer;
using MediaBrowser.Model.Services;
+using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Services
{
public delegate object ActionInvokerFn(object intance, object request);
+
public delegate void VoidActionInvokerFn(object intance, object request);
public class ServiceController
{
+ private readonly ILogger _logger;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ServiceController"/> class.
+ /// </summary>
+ /// <param name="logger">The <see cref="ServiceController"/> logger.</param>
+ public ServiceController(ILogger<ServiceController> logger)
+ {
+ _logger = logger;
+ }
+
public void Init(HttpListenerHost appHost, IEnumerable<Type> serviceTypes)
{
foreach (var serviceType in serviceTypes)
@@ -21,6 +34,13 @@ namespace Emby.Server.Implementations.Services
public void RegisterService(HttpListenerHost appHost, Type serviceType)
{
+ // Make sure the provided type implements IService
+ if (!typeof(IService).IsAssignableFrom(serviceType))
+ {
+ _logger.LogWarning("Tried to register a service that does not implement IService: {ServiceType}", serviceType);
+ return;
+ }
+
var processedReqs = new HashSet<Type>();
var actions = ServiceExecGeneral.Reset(serviceType);
diff --git a/Jellyfin.Drawing.Skia/SkiaEncoder.cs b/Jellyfin.Drawing.Skia/SkiaEncoder.cs
index 2ea690650..a67118f18 100644
--- a/Jellyfin.Drawing.Skia/SkiaEncoder.cs
+++ b/Jellyfin.Drawing.Skia/SkiaEncoder.cs
@@ -308,8 +308,7 @@ namespace Jellyfin.Drawing.Skia
if (requiresTransparencyHack || forceCleanBitmap)
{
- using (var stream = new SKFileStream(NormalizePath(path)))
- using (var codec = SKCodec.Create(stream))
+ using (var codec = SKCodec.Create(NormalizePath(path)))
{
if (codec == null)
{
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs
index 5766a9dc3..4abdd59aa 100644
--- a/Jellyfin.Server/Program.cs
+++ b/Jellyfin.Server/Program.cs
@@ -21,6 +21,7 @@ using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.WebDashboard.Api;
using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
@@ -275,10 +276,11 @@ namespace Jellyfin.Server
if (appHost.EnableHttps && appHost.Certificate != null)
{
- options.Listen(
- address,
- appHost.HttpsPort,
- listenOptions => listenOptions.UseHttps(appHost.Certificate));
+ options.Listen(address, appHost.HttpsPort, listenOptions =>
+ {
+ listenOptions.UseHttps(appHost.Certificate);
+ listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
+ });
}
}
}
@@ -289,9 +291,11 @@ namespace Jellyfin.Server
if (appHost.EnableHttps && appHost.Certificate != null)
{
- options.ListenAnyIP(
- appHost.HttpsPort,
- listenOptions => listenOptions.UseHttps(appHost.Certificate));
+ options.ListenAnyIP(appHost.HttpsPort, listenOptions =>
+ {
+ listenOptions.UseHttps(appHost.Certificate);
+ listenOptions.Protocols = HttpProtocols.Http1AndHttp2;
+ });
}
}
})
diff --git a/MediaBrowser.Common/Net/HttpResponseInfo.cs b/MediaBrowser.Common/Net/HttpResponseInfo.cs
index d7f7a5622..56a951ebf 100644
--- a/MediaBrowser.Common/Net/HttpResponseInfo.cs
+++ b/MediaBrowser.Common/Net/HttpResponseInfo.cs
@@ -22,7 +22,6 @@ namespace MediaBrowser.Common.Net
}
#pragma warning restore CS1591
-#pragma warning restore SA1600
/// <summary>
/// Gets or sets the type of the content.
diff --git a/MediaBrowser.Common/System/OperatingSystem.cs b/MediaBrowser.Common/System/OperatingSystem.cs
index 7d38ddb6e..5f673d320 100644
--- a/MediaBrowser.Common/System/OperatingSystem.cs
+++ b/MediaBrowser.Common/System/OperatingSystem.cs
@@ -35,7 +35,7 @@ namespace MediaBrowser.Common.System
case OperatingSystemId.Linux: return "Linux";
case OperatingSystemId.Darwin: return "macOS";
case OperatingSystemId.Windows: return "Windows";
- default: throw new Exception($"Unknown OS {Id}");
+ default: throw new PlatformNotSupportedException($"Unknown OS {Id}");
}
}
}
@@ -53,20 +53,20 @@ namespace MediaBrowser.Common.System
default:
{
string osDescription = RuntimeInformation.OSDescription;
- if (osDescription.IndexOf("linux", StringComparison.OrdinalIgnoreCase) != -1)
+ if (osDescription.Contains("linux", StringComparison.OrdinalIgnoreCase))
{
return OperatingSystemId.Linux;
}
- else if (osDescription.IndexOf("darwin", StringComparison.OrdinalIgnoreCase) != -1)
+ else if (osDescription.Contains("darwin", StringComparison.OrdinalIgnoreCase))
{
return OperatingSystemId.Darwin;
}
- else if (osDescription.IndexOf("bsd", StringComparison.OrdinalIgnoreCase) != -1)
+ else if (osDescription.Contains("bsd", StringComparison.OrdinalIgnoreCase))
{
return OperatingSystemId.BSD;
}
- throw new Exception($"Can't resolve OS with description: '{osDescription}'");
+ throw new PlatformNotSupportedException($"Can't resolve OS with description: '{osDescription}'");
}
}
}
diff --git a/MediaBrowser.Controller/Net/IHttpServer.cs b/MediaBrowser.Controller/Net/IHttpServer.cs
index 46933c046..806478864 100644
--- a/MediaBrowser.Controller/Net/IHttpServer.cs
+++ b/MediaBrowser.Controller/Net/IHttpServer.cs
@@ -32,7 +32,7 @@ namespace MediaBrowser.Controller.Net
/// <summary>
/// Inits this instance.
/// </summary>
- void Init(IEnumerable<IService> services, IEnumerable<IWebSocketListener> listener, IEnumerable<string> urlPrefixes);
+ void Init(IEnumerable<Type> serviceTypes, IEnumerable<IWebSocketListener> listener, IEnumerable<string> urlPrefixes);
/// <summary>
/// If set, all requests will respond with this message