diff --git a/MediaBrowser.Common.Implementations/HttpServer/SwaggerService.cs b/MediaBrowser.Common.Implementations/HttpServer/SwaggerService.cs new file mode 100644 index 000000000..a4808834d --- /dev/null +++ b/MediaBrowser.Common.Implementations/HttpServer/SwaggerService.cs @@ -0,0 +1,38 @@ +using ServiceStack.ServiceHost; +using System.Diagnostics; +using System.IO; + +namespace MediaBrowser.Common.Implementations.HttpServer +{ + /// + /// Class GetDashboardResource + /// + [Route("/swagger-ui/{ResourceName*}", "GET")] + public class GetSwaggerResource + { + /// + /// Gets or sets the name. + /// + /// The name. + public string ResourceName { get; set; } + } + + public class SwaggerService : BaseRestService + { + /// + /// Gets the specified request. + /// + /// The request. + /// System.Object. + public object Get(GetSwaggerResource request) + { + var runningDirectory = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); + + var swaggerDirectory = Path.Combine(runningDirectory, "swagger-ui"); + + var requestedFile = Path.Combine(swaggerDirectory, request.ResourceName.Replace('/', '\\')); + + return ToStaticFileResult(requestedFile); + } + } +} diff --git a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj index bbbf9490e..2f3ebdf19 100644 --- a/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj +++ b/MediaBrowser.Common.Implementations/MediaBrowser.Common.Implementations.csproj @@ -122,6 +122,7 @@ + @@ -162,22 +163,48 @@ - - - + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest - - - - - - - - - - + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + diff --git a/MediaBrowser.Common.Implementations/swagger-ui/index.html b/MediaBrowser.Common.Implementations/swagger-ui/index.html index 5d2a8d88d..0b2b02b10 100644 --- a/MediaBrowser.Common.Implementations/swagger-ui/index.html +++ b/MediaBrowser.Common.Implementations/swagger-ui/index.html @@ -42,7 +42,7 @@