aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Services/SwaggerService.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2019-06-01 17:06:01 +0200
committerGitHub <noreply@github.com>2019-06-01 17:06:01 +0200
commitce1fa42f9d39add8467bfed186730c4a9545344d (patch)
tree8c2aafa3a3552174d15208551da1c34449a13b18 /Emby.Server.Implementations/Services/SwaggerService.cs
parent2696ac5eacfb4702d629bc06a8b42b868c316116 (diff)
parentb1f764984f7098ee1164efee77f1bcb3de9fd08a (diff)
Merge branch 'master' into tasks
Diffstat (limited to 'Emby.Server.Implementations/Services/SwaggerService.cs')
-rw-r--r--Emby.Server.Implementations/Services/SwaggerService.cs20
1 files changed, 12 insertions, 8 deletions
diff --git a/Emby.Server.Implementations/Services/SwaggerService.cs b/Emby.Server.Implementations/Services/SwaggerService.cs
index 3e6970eef..d22386436 100644
--- a/Emby.Server.Implementations/Services/SwaggerService.cs
+++ b/Emby.Server.Implementations/Services/SwaggerService.cs
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Services;
+using Emby.Server.Implementations.HttpServer;
namespace Emby.Server.Implementations.Services
{
@@ -109,10 +109,16 @@ namespace Emby.Server.Implementations.Services
public class SwaggerService : IService, IRequiresRequest
{
+ private readonly IHttpServer _httpServer;
private SwaggerSpec _spec;
public IRequest Request { get; set; }
+ public SwaggerService(IHttpServer httpServer)
+ {
+ _httpServer = httpServer;
+ }
+
public object Get(GetSwaggerSpec request)
{
return _spec ?? (_spec = GetSpec());
@@ -181,7 +187,8 @@ namespace Emby.Server.Implementations.Services
{
var paths = new SortedDictionary<string, Dictionary<string, SwaggerMethod>>();
- var all = ServiceController.Instance.RestPathMap.OrderBy(i => i.Key, StringComparer.OrdinalIgnoreCase).ToList();
+ // REVIEW: this can be done better
+ var all = ((HttpListenerHost)_httpServer).ServiceController.RestPathMap.OrderBy(i => i.Key, StringComparer.OrdinalIgnoreCase).ToList();
foreach (var current in all)
{
@@ -192,11 +199,8 @@ namespace Emby.Server.Implementations.Services
continue;
}
- if (info.Path.StartsWith("/mediabrowser", StringComparison.OrdinalIgnoreCase))
- {
- continue;
- }
- if (info.Path.StartsWith("/jellyfin", StringComparison.OrdinalIgnoreCase))
+ if (info.Path.StartsWith("/mediabrowser", StringComparison.OrdinalIgnoreCase)
+ || info.Path.StartsWith("/jellyfin", StringComparison.OrdinalIgnoreCase))
{
continue;
}