aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Services/SwaggerService.cs
diff options
context:
space:
mode:
authorJoshua M. Boniface <joshua@boniface.me>2019-04-17 22:12:17 -0400
committerGitHub <noreply@github.com>2019-04-17 22:12:17 -0400
commitc3532b92f7bd3e2bdba8c9a2aaf9ebf06016b322 (patch)
treeb6391e1834bf41a9b22e738f673f3cf9666c1ee7 /Emby.Server.Implementations/Services/SwaggerService.cs
parent0539861dc038b53cb23f353e0f68885aa0133bab (diff)
parent157a86d0f139d149083036e6ea962e0fd7d77057 (diff)
Merge pull request #1158 from Bond-009/httpclean
Reduce complexity http routes
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;
}