diff --git a/MediaBrowser.Api/AlbumsService.cs b/MediaBrowser.Api/AlbumsService.cs index ffaa6139df..b8a830711a 100644 --- a/MediaBrowser.Api/AlbumsService.cs +++ b/MediaBrowser.Api/AlbumsService.cs @@ -3,7 +3,7 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Collections.Generic; using System.Linq; diff --git a/MediaBrowser.Api/AuthorizationRequestFilterAttribute.cs b/MediaBrowser.Api/AuthorizationRequestFilterAttribute.cs index 9cc62a6dc1..a8b34b8bdf 100644 --- a/MediaBrowser.Api/AuthorizationRequestFilterAttribute.cs +++ b/MediaBrowser.Api/AuthorizationRequestFilterAttribute.cs @@ -2,10 +2,10 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Session; using MediaBrowser.Model.Logging; -using ServiceStack.Common.Web; -using ServiceStack.ServiceHost; +using ServiceStack.Web; using System; using System.Collections.Generic; +using System.Net.Http.Headers; namespace MediaBrowser.Api { @@ -32,11 +32,10 @@ namespace MediaBrowser.Api /// The http request wrapper /// The http response wrapper /// The request DTO - public void RequestFilter(IHttpRequest request, IHttpResponse response, object requestDto) + public void RequestFilter(IRequest request, IResponse response, object requestDto) { //This code is executed before the service - - var auth = GetAuthorization(request); + var auth = GetAuthorizationDictionary(request); if (auth != null) { @@ -74,9 +73,9 @@ namespace MediaBrowser.Api /// /// The HTTP req. /// Dictionary{System.StringSystem.String}. - public static Dictionary GetAuthorization(IHttpRequest httpReq) + private static Dictionary GetAuthorizationDictionary(IRequest httpReq) { - var auth = httpReq.Headers[HttpHeaders.Authorization]; + var auth = httpReq.Headers["Authorization"]; return GetAuthorization(auth); } @@ -86,11 +85,9 @@ namespace MediaBrowser.Api /// /// The HTTP req. /// Dictionary{System.StringSystem.String}. - public static AuthorizationInfo GetAuthorization(IRequestContext httpReq) + public static AuthorizationInfo GetAuthorization(IRequest httpReq) { - var header = httpReq.GetHeader("Authorization"); - - var auth = GetAuthorization(header); + var auth = GetAuthorizationDictionary(httpReq); string userId; string deviceId; diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs index ee0721d5eb..ddce1ddcd1 100644 --- a/MediaBrowser.Api/BaseApiService.cs +++ b/MediaBrowser.Api/BaseApiService.cs @@ -1,12 +1,12 @@ -using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Net; using MediaBrowser.Model.Logging; -using ServiceStack.ServiceHost; using System; using System.Collections.Generic; using System.Linq; +using ServiceStack.Web; namespace MediaBrowser.Api { @@ -32,7 +32,12 @@ namespace MediaBrowser.Api /// Gets or sets the request context. /// /// The request context. - public IRequestContext RequestContext { get; set; } + public IRequest Request { get; set; } + + public string GetHeader(string name) + { + return Request.Headers[name]; + } /// /// To the optimized result. @@ -43,7 +48,7 @@ namespace MediaBrowser.Api protected object ToOptimizedResult(T result) where T : class { - return ResultFactory.GetOptimizedResult(RequestContext, result); + return ResultFactory.GetOptimizedResult(Request, result); } /// @@ -59,7 +64,7 @@ namespace MediaBrowser.Api protected object ToOptimizedResultUsingCache(Guid cacheKey, DateTime lastDateModified, TimeSpan? cacheDuration, Func factoryFn) where T : class { - return ResultFactory.GetOptimizedResultUsingCache(RequestContext, cacheKey, lastDateModified, cacheDuration, factoryFn); + return ResultFactory.GetOptimizedResultUsingCache(Request, cacheKey, lastDateModified, cacheDuration, factoryFn); } /// @@ -76,7 +81,7 @@ namespace MediaBrowser.Api protected object ToCachedResult(Guid cacheKey, DateTime lastDateModified, TimeSpan? cacheDuration, Func factoryFn, string contentType) where T : class { - return ResultFactory.GetCachedResult(RequestContext, cacheKey, lastDateModified, cacheDuration, factoryFn, contentType); + return ResultFactory.GetCachedResult(Request, cacheKey, lastDateModified, cacheDuration, factoryFn, contentType); } /// @@ -86,7 +91,7 @@ namespace MediaBrowser.Api /// System.Object. protected object ToStaticFileResult(string path) { - return ResultFactory.GetStaticFileResult(RequestContext, path); + return ResultFactory.GetStaticFileResult(Request, path); } private readonly char[] _dashReplaceChars = new[] { '?', '/' }; diff --git a/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs b/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs index 4e8864644e..75ef7e54e4 100644 --- a/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs +++ b/MediaBrowser.Api/DefaultTheme/DefaultThemeService.cs @@ -9,7 +9,7 @@ using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Querying; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Collections.Generic; using System.Linq; diff --git a/MediaBrowser.Api/DisplayPreferencesService.cs b/MediaBrowser.Api/DisplayPreferencesService.cs index b6c7434a16..39b335316b 100644 --- a/MediaBrowser.Api/DisplayPreferencesService.cs +++ b/MediaBrowser.Api/DisplayPreferencesService.cs @@ -2,7 +2,7 @@ using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Serialization; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Api/EnvironmentService.cs b/MediaBrowser.Api/EnvironmentService.cs index 067da38534..dfdd0daf0a 100644 --- a/MediaBrowser.Api/EnvironmentService.cs +++ b/MediaBrowser.Api/EnvironmentService.cs @@ -1,7 +1,7 @@ using MediaBrowser.Common.Net; using MediaBrowser.Model.IO; using MediaBrowser.Model.Net; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Collections.Generic; using System.Globalization; diff --git a/MediaBrowser.Api/GamesService.cs b/MediaBrowser.Api/GamesService.cs index 799b9d7567..ef4fed3d36 100644 --- a/MediaBrowser.Api/GamesService.cs +++ b/MediaBrowser.Api/GamesService.cs @@ -4,7 +4,7 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Dto; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Collections.Generic; using System.IO; diff --git a/MediaBrowser.Api/Images/ImageByNameService.cs b/MediaBrowser.Api/Images/ImageByNameService.cs index b17cc81de6..44a69f6dea 100644 --- a/MediaBrowser.Api/Images/ImageByNameService.cs +++ b/MediaBrowser.Api/Images/ImageByNameService.cs @@ -1,7 +1,7 @@ using MediaBrowser.Common.Extensions; using MediaBrowser.Controller; using MediaBrowser.Controller.Entities; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.IO; using System.Linq; diff --git a/MediaBrowser.Api/Images/ImageRequest.cs b/MediaBrowser.Api/Images/ImageRequest.cs index 288fd9ea63..0d4c1ff1be 100644 --- a/MediaBrowser.Api/Images/ImageRequest.cs +++ b/MediaBrowser.Api/Images/ImageRequest.cs @@ -1,6 +1,6 @@ using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Entities; -using ServiceStack.ServiceHost; +using ServiceStack; namespace MediaBrowser.Api.Images { diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs index 633d635141..2de78d75b2 100644 --- a/MediaBrowser.Api/Images/ImageService.cs +++ b/MediaBrowser.Api/Images/ImageService.cs @@ -11,8 +11,7 @@ using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; -using ServiceStack.ServiceHost; -using ServiceStack.Text.Controller; +using ServiceStack; using System; using System.Collections.Generic; using System.Drawing; @@ -20,6 +19,8 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using ServiceStack.Text.Controller; +using ServiceStack.Web; namespace MediaBrowser.Api.Images { @@ -453,7 +454,7 @@ namespace MediaBrowser.Api.Images /// Task{List{ImageInfo}}. private List GetItemByNameImageInfos(GetItemByNameImageInfos request) { - var pathInfo = PathInfo.Parse(RequestContext.PathInfo); + var pathInfo = PathInfo.Parse(Request.PathInfo); var type = pathInfo.GetArgumentValue(0); var item = GetItemByName(request.Name, type, _libraryManager); @@ -599,7 +600,7 @@ namespace MediaBrowser.Api.Images public object Get(GetItemByNameImage request) { - var pathInfo = PathInfo.Parse(RequestContext.PathInfo); + var pathInfo = PathInfo.Parse(Request.PathInfo); var type = pathInfo.GetArgumentValue(0); var item = GetItemByName(request.Name, type, _libraryManager); @@ -613,21 +614,21 @@ namespace MediaBrowser.Api.Images /// The request. public void Post(PostUserImage request) { - var pathInfo = PathInfo.Parse(RequestContext.PathInfo); + var pathInfo = PathInfo.Parse(Request.PathInfo); var id = new Guid(pathInfo.GetArgumentValue(1)); request.Type = (ImageType)Enum.Parse(typeof(ImageType), pathInfo.GetArgumentValue(3), true); var item = _userManager.Users.First(i => i.Id == id); - var task = PostImage(item, request.RequestStream, request.Type, RequestContext.ContentType); + var task = PostImage(item, request.RequestStream, request.Type, Request.ContentType); Task.WaitAll(task); } public void Post(PostItemByNameImage request) { - var pathInfo = PathInfo.Parse(RequestContext.PathInfo); + var pathInfo = PathInfo.Parse(Request.PathInfo); var type = pathInfo.GetArgumentValue(0); var name = pathInfo.GetArgumentValue(1); @@ -635,7 +636,7 @@ namespace MediaBrowser.Api.Images var item = GetItemByName(name, type, _libraryManager); - var task = PostImage(item, request.RequestStream, request.Type, RequestContext.ContentType); + var task = PostImage(item, request.RequestStream, request.Type, Request.ContentType); Task.WaitAll(task); } @@ -646,28 +647,28 @@ namespace MediaBrowser.Api.Images /// The request. public void Post(PostItemImage request) { - var pathInfo = PathInfo.Parse(RequestContext.PathInfo); + var pathInfo = PathInfo.Parse(Request.PathInfo); var id = new Guid(pathInfo.GetArgumentValue(1)); request.Type = (ImageType)Enum.Parse(typeof(ImageType), pathInfo.GetArgumentValue(3), true); var item = _libraryManager.GetItemById(id); - var task = PostImage(item, request.RequestStream, request.Type, RequestContext.ContentType); + var task = PostImage(item, request.RequestStream, request.Type, Request.ContentType); Task.WaitAll(task); } public void Post(PostChannelImage request) { - var pathInfo = PathInfo.Parse(RequestContext.PathInfo); + var pathInfo = PathInfo.Parse(Request.PathInfo); var id = pathInfo.GetArgumentValue(2); request.Type = (ImageType)Enum.Parse(typeof(ImageType), pathInfo.GetArgumentValue(4), true); var item = _liveTv.GetChannel(id); - var task = PostImage(item, request.RequestStream, request.Type, RequestContext.ContentType); + var task = PostImage(item, request.RequestStream, request.Type, Request.ContentType); Task.WaitAll(task); } @@ -713,7 +714,7 @@ namespace MediaBrowser.Api.Images /// The request. public void Delete(DeleteItemByNameImage request) { - var pathInfo = PathInfo.Parse(RequestContext.PathInfo); + var pathInfo = PathInfo.Parse(Request.PathInfo); var type = pathInfo.GetArgumentValue(0); var item = GetItemByName(request.Name, type, _libraryManager); @@ -742,7 +743,7 @@ namespace MediaBrowser.Api.Images /// The request. public void Post(UpdateItemByNameImageIndex request) { - var pathInfo = PathInfo.Parse(RequestContext.PathInfo); + var pathInfo = PathInfo.Parse(Request.PathInfo); var type = pathInfo.GetArgumentValue(0); var item = GetItemByName(request.Name, type, _libraryManager); @@ -899,22 +900,22 @@ namespace MediaBrowser.Api.Images { if (format == ImageOutputFormat.Bmp) { - return MimeTypes.GetMimeType("i.bmp"); + return Common.Net.MimeTypes.GetMimeType("i.bmp"); } if (format == ImageOutputFormat.Gif) { - return MimeTypes.GetMimeType("i.gif"); + return Common.Net.MimeTypes.GetMimeType("i.gif"); } if (format == ImageOutputFormat.Jpg) { - return MimeTypes.GetMimeType("i.jpg"); + return Common.Net.MimeTypes.GetMimeType("i.jpg"); } if (format == ImageOutputFormat.Png) { - return MimeTypes.GetMimeType("i.png"); + return Common.Net.MimeTypes.GetMimeType("i.png"); } - return MimeTypes.GetMimeType(path); + return Common.Net.MimeTypes.GetMimeType(path); } /// diff --git a/MediaBrowser.Api/Images/ImageWriter.cs b/MediaBrowser.Api/Images/ImageWriter.cs index 4c61b68024..5d1ee140db 100644 --- a/MediaBrowser.Api/Images/ImageWriter.cs +++ b/MediaBrowser.Api/Images/ImageWriter.cs @@ -2,12 +2,12 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; -using ServiceStack.Service; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; +using ServiceStack.Web; namespace MediaBrowser.Api.Images { diff --git a/MediaBrowser.Api/Images/RemoteImageService.cs b/MediaBrowser.Api/Images/RemoteImageService.cs index 1084e99d07..c18954e500 100644 --- a/MediaBrowser.Api/Images/RemoteImageService.cs +++ b/MediaBrowser.Api/Images/RemoteImageService.cs @@ -8,14 +8,14 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Providers; -using ServiceStack.ServiceHost; -using ServiceStack.Text.Controller; +using ServiceStack; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using ServiceStack.Text.Controller; namespace MediaBrowser.Api.Images { @@ -181,7 +181,7 @@ namespace MediaBrowser.Api.Images public object Get(GetItemByNameRemoteImageProviders request) { - var pathInfo = PathInfo.Parse(RequestContext.PathInfo); + var pathInfo = PathInfo.Parse(Request.PathInfo); var type = pathInfo.GetArgumentValue(0); var item = GetItemByName(request.Name, type, _libraryManager); @@ -212,7 +212,7 @@ namespace MediaBrowser.Api.Images public object Get(GetItemByNameRemoteImages request) { - var pathInfo = PathInfo.Parse(RequestContext.PathInfo); + var pathInfo = PathInfo.Parse(Request.PathInfo); var type = pathInfo.GetArgumentValue(0); var item = GetItemByName(request.Name, type, _libraryManager); @@ -264,7 +264,7 @@ namespace MediaBrowser.Api.Images public void Post(DownloadItemByNameRemoteImage request) { - var pathInfo = PathInfo.Parse(RequestContext.PathInfo); + var pathInfo = PathInfo.Parse(Request.PathInfo); var type = pathInfo.GetArgumentValue(0); var item = GetItemByName(request.Name, type, _libraryManager); diff --git a/MediaBrowser.Api/InstantMixService.cs b/MediaBrowser.Api/InstantMixService.cs index 5a8c5a985c..c11f38123d 100644 --- a/MediaBrowser.Api/InstantMixService.cs +++ b/MediaBrowser.Api/InstantMixService.cs @@ -2,7 +2,7 @@ using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Querying; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Collections.Generic; using System.Linq; diff --git a/MediaBrowser.Api/ItemRefreshService.cs b/MediaBrowser.Api/ItemRefreshService.cs index 8fca3f338f..1b8b49f98a 100644 --- a/MediaBrowser.Api/ItemRefreshService.cs +++ b/MediaBrowser.Api/ItemRefreshService.cs @@ -2,7 +2,7 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Linq; using System.Threading; diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs index 4483b74f94..9fc4bb3d04 100644 --- a/MediaBrowser.Api/ItemUpdateService.cs +++ b/MediaBrowser.Api/ItemUpdateService.cs @@ -6,7 +6,7 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Linq; using System.Threading; diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.cs index c7b4fae5f5..bef0ba1e19 100644 --- a/MediaBrowser.Api/Library/LibraryService.cs +++ b/MediaBrowser.Api/Library/LibraryService.cs @@ -1,7 +1,7 @@ using MediaBrowser.Common; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Collections.Generic; using System.Linq; diff --git a/MediaBrowser.Api/Library/LibraryStructureService.cs b/MediaBrowser.Api/Library/LibraryStructureService.cs index 198bec1a0d..c964b55171 100644 --- a/MediaBrowser.Api/Library/LibraryStructureService.cs +++ b/MediaBrowser.Api/Library/LibraryStructureService.cs @@ -4,7 +4,7 @@ using MediaBrowser.Controller.IO; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Collections.Generic; using System.IO; diff --git a/MediaBrowser.Api/LibraryService.cs b/MediaBrowser.Api/LibraryService.cs index 48037e8015..7dc8301fea 100644 --- a/MediaBrowser.Api/LibraryService.cs +++ b/MediaBrowser.Api/LibraryService.cs @@ -8,7 +8,7 @@ using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Collections; using System.Collections.Generic; diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index 409b04b413..9e83a56de7 100644 --- a/MediaBrowser.Api/LiveTv/LiveTvService.cs +++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs @@ -1,7 +1,7 @@ using MediaBrowser.Controller.LiveTv; using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.Querying; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Collections.Generic; using System.Linq; diff --git a/MediaBrowser.Api/LocalizationService.cs b/MediaBrowser.Api/LocalizationService.cs index d52f94b3c8..54ac8591ea 100644 --- a/MediaBrowser.Api/LocalizationService.cs +++ b/MediaBrowser.Api/LocalizationService.cs @@ -1,7 +1,7 @@ using MediaBrowser.Controller.Localization; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Globalization; -using ServiceStack.ServiceHost; +using ServiceStack; using System.Collections.Generic; using System.Linq; diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj index ffcc4b8383..1675929107 100644 --- a/MediaBrowser.Api/MediaBrowser.Api.csproj +++ b/MediaBrowser.Api/MediaBrowser.Api.csproj @@ -38,6 +38,14 @@ Always + + False + ..\ThirdParty\ServiceStack\ServiceStack.Interfaces.dll + + + False + ..\ThirdParty\ServiceStack\ServiceStack.Text.dll + @@ -48,15 +56,6 @@ ..\packages\morelinq.1.0.16006\lib\net35\MoreLinq.dll - - ..\packages\ServiceStack.Common.3.9.70\lib\net35\ServiceStack.Common.dll - - - ..\packages\ServiceStack.Common.3.9.70\lib\net35\ServiceStack.Interfaces.dll - - - ..\packages\ServiceStack.Text.3.9.70\lib\net35\ServiceStack.Text.dll - diff --git a/MediaBrowser.Api/MoviesService.cs b/MediaBrowser.Api/MoviesService.cs index 43fbe1f1b1..1b36ec8915 100644 --- a/MediaBrowser.Api/MoviesService.cs +++ b/MediaBrowser.Api/MoviesService.cs @@ -3,7 +3,7 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; -using ServiceStack.ServiceHost; +using ServiceStack; namespace MediaBrowser.Api { diff --git a/MediaBrowser.Api/NotificationsService.cs b/MediaBrowser.Api/NotificationsService.cs index 319cb996be..4f9ed729d9 100644 --- a/MediaBrowser.Api/NotificationsService.cs +++ b/MediaBrowser.Api/NotificationsService.cs @@ -1,10 +1,10 @@ using MediaBrowser.Controller.Notifications; using MediaBrowser.Model.Notifications; -using ServiceStack.ServiceHost; using System; using System.Linq; using System.Threading; using System.Threading.Tasks; +using ServiceStack; namespace MediaBrowser.Api { diff --git a/MediaBrowser.Api/PackageReviewService.cs b/MediaBrowser.Api/PackageReviewService.cs index e0d52ee8a8..b2de908d9f 100644 --- a/MediaBrowser.Api/PackageReviewService.cs +++ b/MediaBrowser.Api/PackageReviewService.cs @@ -7,7 +7,7 @@ using MediaBrowser.Common.Constants; using MediaBrowser.Common.Net; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Serialization; -using ServiceStack.ServiceHost; +using ServiceStack; namespace MediaBrowser.Api { diff --git a/MediaBrowser.Api/PackageService.cs b/MediaBrowser.Api/PackageService.cs index b152f02020..793b666ea0 100644 --- a/MediaBrowser.Api/PackageService.cs +++ b/MediaBrowser.Api/PackageService.cs @@ -2,7 +2,7 @@ using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Updates; using MediaBrowser.Model.Updates; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Collections.Generic; using System.Linq; diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs index e34f0888da..90996296d5 100644 --- a/MediaBrowser.Api/Playback/BaseStreamingService.cs +++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs @@ -791,7 +791,7 @@ namespace MediaBrowser.Api.Playback var media = (IHasMediaStreams)item; - var url = RequestContext.PathInfo; + var url = Request.PathInfo; if (!request.AudioCodec.HasValue) { diff --git a/MediaBrowser.Api/Playback/Hls/AudioHlsService.cs b/MediaBrowser.Api/Playback/Hls/AudioHlsService.cs index 073cd1b7fc..efcc3f07ab 100644 --- a/MediaBrowser.Api/Playback/Hls/AudioHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/AudioHlsService.cs @@ -6,7 +6,7 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Dto; using MediaBrowser.Model.IO; -using ServiceStack.ServiceHost; +using ServiceStack; using System; namespace MediaBrowser.Api.Playback.Hls diff --git a/MediaBrowser.Api/Playback/Hls/HlsSegmentResponseFilter.cs b/MediaBrowser.Api/Playback/Hls/HlsSegmentResponseFilter.cs index 44996c99f5..ed4ca86717 100644 --- a/MediaBrowser.Api/Playback/Hls/HlsSegmentResponseFilter.cs +++ b/MediaBrowser.Api/Playback/Hls/HlsSegmentResponseFilter.cs @@ -1,7 +1,7 @@ using MediaBrowser.Controller; using MediaBrowser.Model.Logging; -using ServiceStack.ServiceHost; using ServiceStack.Text.Controller; +using ServiceStack.Web; using System; using System.IO; using System.Linq; @@ -13,7 +13,7 @@ namespace MediaBrowser.Api.Playback.Hls public ILogger Logger { get; set; } public IServerApplicationPaths ApplicationPaths { get; set; } - public void ResponseFilter(IHttpRequest req, IHttpResponse res, object response) + public void ResponseFilter(IRequest req, IResponse res, object response) { var pathInfo = PathInfo.Parse(req.PathInfo); var itemId = pathInfo.GetArgumentValue(1); diff --git a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs index e9f7e48b19..02a6326945 100644 --- a/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs +++ b/MediaBrowser.Api/Playback/Hls/HlsSegmentService.cs @@ -1,5 +1,5 @@ using MediaBrowser.Controller; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.IO; using System.Linq; @@ -87,11 +87,11 @@ namespace MediaBrowser.Api.Playback.Hls { OnBeginRequest(request.PlaylistId); - var file = request.PlaylistId + Path.GetExtension(RequestContext.PathInfo); + var file = request.PlaylistId + Path.GetExtension(Request.PathInfo); file = Path.Combine(_appPaths.EncodedMediaCachePath, file); - return ResultFactory.GetStaticFileResult(RequestContext, file, FileShare.ReadWrite); + return ResultFactory.GetStaticFileResult(Request, file, FileShare.ReadWrite); } public void Delete(StopEncodingProcess request) @@ -106,13 +106,13 @@ namespace MediaBrowser.Api.Playback.Hls /// System.Object. public object Get(GetHlsVideoSegment request) { - var file = request.SegmentId + Path.GetExtension(RequestContext.PathInfo); + var file = request.SegmentId + Path.GetExtension(Request.PathInfo); file = Path.Combine(_appPaths.EncodedMediaCachePath, file); OnBeginRequest(request.PlaylistId); - return ResultFactory.GetStaticFileResult(RequestContext, file); + return ResultFactory.GetStaticFileResult(Request, file); } /// @@ -122,11 +122,11 @@ namespace MediaBrowser.Api.Playback.Hls /// System.Object. public object Get(GetHlsAudioSegment request) { - var file = request.SegmentId + Path.GetExtension(RequestContext.PathInfo); + var file = request.SegmentId + Path.GetExtension(Request.PathInfo); file = Path.Combine(_appPaths.EncodedMediaCachePath, file); - return ResultFactory.GetStaticFileResult(RequestContext, file, FileShare.ReadWrite); + return ResultFactory.GetStaticFileResult(Request, file, FileShare.ReadWrite); } /// diff --git a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs index b194a47fe1..fe863c8629 100644 --- a/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs +++ b/MediaBrowser.Api/Playback/Hls/VideoHlsService.cs @@ -5,7 +5,7 @@ using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.IO; -using ServiceStack.ServiceHost; +using ServiceStack; using System; namespace MediaBrowser.Api.Playback.Hls diff --git a/MediaBrowser.Api/Playback/Progressive/AudioService.cs b/MediaBrowser.Api/Playback/Progressive/AudioService.cs index 36a998c16d..86ab498f65 100644 --- a/MediaBrowser.Api/Playback/Progressive/AudioService.cs +++ b/MediaBrowser.Api/Playback/Progressive/AudioService.cs @@ -6,7 +6,7 @@ using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.IO; -using ServiceStack.ServiceHost; +using ServiceStack; using System.Collections.Generic; namespace MediaBrowser.Api.Playback.Progressive diff --git a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs index 2447302f50..1fea322195 100644 --- a/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs +++ b/MediaBrowser.Api/Playback/Progressive/BaseProgressiveStreamingService.cs @@ -102,7 +102,7 @@ namespace MediaBrowser.Api.Playback.Progressive /// true if XXXX, false otherwise private void AddDlnaHeaders(StreamState state, IDictionary responseHeaders, bool isStaticallyStreamed) { - var timeSeek = RequestContext.GetHeader("TimeSeekRange.dlna.org"); + var timeSeek = GetHeader("TimeSeekRange.dlna.org"); if (!string.IsNullOrEmpty(timeSeek)) { @@ -110,7 +110,7 @@ namespace MediaBrowser.Api.Playback.Progressive return; } - var transferMode = RequestContext.GetHeader("transferMode.dlna.org"); + var transferMode = GetHeader("transferMode.dlna.org"); responseHeaders["transferMode.dlna.org"] = string.IsNullOrEmpty(transferMode) ? "Streaming" : transferMode; var contentFeatures = string.Empty; @@ -210,12 +210,12 @@ namespace MediaBrowser.Api.Playback.Progressive if (request.Static) { - return ResultFactory.GetStaticFileResult(RequestContext, state.Item.Path, FileShare.Read, responseHeaders, isHeadRequest); + return ResultFactory.GetStaticFileResult(Request, state.Item.Path, FileShare.Read, responseHeaders, isHeadRequest); } if (outputPathExists && !ApiEntryPoint.Instance.HasActiveTranscodingJob(outputPath, TranscodingJobType.Progressive)) { - return ResultFactory.GetStaticFileResult(RequestContext, outputPath, FileShare.Read, responseHeaders, isHeadRequest); + return ResultFactory.GetStaticFileResult(Request, outputPath, FileShare.Read, responseHeaders, isHeadRequest); } return GetStreamResult(state, responseHeaders, isHeadRequest).Result; @@ -307,7 +307,7 @@ namespace MediaBrowser.Api.Playback.Progressive return new ImageService(UserManager, LibraryManager, ApplicationPaths, null, ItemRepository, DtoService, ImageProcessor, null) { Logger = Logger, - RequestContext = RequestContext, + Request = Request, ResultFactory = ResultFactory }.Get(request); diff --git a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs index 816cab105d..58f36a06c1 100644 --- a/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs +++ b/MediaBrowser.Api/Playback/Progressive/ProgressiveStreamWriter.cs @@ -1,7 +1,6 @@ using MediaBrowser.Common.IO; using MediaBrowser.Model.Logging; -using ServiceStack.Service; -using ServiceStack.ServiceHost; +using ServiceStack.Web; using System; using System.Collections.Generic; using System.IO; diff --git a/MediaBrowser.Api/Playback/Progressive/VideoService.cs b/MediaBrowser.Api/Playback/Progressive/VideoService.cs index 97b808b867..40c7492ffb 100644 --- a/MediaBrowser.Api/Playback/Progressive/VideoService.cs +++ b/MediaBrowser.Api/Playback/Progressive/VideoService.cs @@ -7,7 +7,7 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.IO; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.IO; diff --git a/MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs b/MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs index 8c9815134a..7820a26d86 100644 --- a/MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs +++ b/MediaBrowser.Api/Playback/StaticRemoteStreamWriter.cs @@ -1,5 +1,4 @@ -using ServiceStack.Service; -using ServiceStack.ServiceHost; +using ServiceStack.Web; using System.Collections.Generic; using System.IO; using System.Net.Http; diff --git a/MediaBrowser.Api/Playback/StreamRequest.cs b/MediaBrowser.Api/Playback/StreamRequest.cs index 339de0e6c6..1486c0de7a 100644 --- a/MediaBrowser.Api/Playback/StreamRequest.cs +++ b/MediaBrowser.Api/Playback/StreamRequest.cs @@ -1,5 +1,5 @@ using MediaBrowser.Model.Dto; -using ServiceStack.ServiceHost; +using ServiceStack; namespace MediaBrowser.Api.Playback { diff --git a/MediaBrowser.Api/PluginService.cs b/MediaBrowser.Api/PluginService.cs index 6c0face6b3..de9c89666c 100644 --- a/MediaBrowser.Api/PluginService.cs +++ b/MediaBrowser.Api/PluginService.cs @@ -5,12 +5,13 @@ using MediaBrowser.Common.Updates; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Serialization; -using ServiceStack.ServiceHost; -using ServiceStack.Text.Controller; +using ServiceStack; using System; using System.Collections.Generic; using System.IO; using System.Linq; +using ServiceStack.Text.Controller; +using ServiceStack.Web; namespace MediaBrowser.Api { @@ -79,7 +80,6 @@ namespace MediaBrowser.Api /// [Route("/Plugins/SecurityInfo", "GET")] [Api(("Gets plugin registration information"))] - [Restrict(VisibilityTo = EndpointAttributes.None)] public class GetPluginSecurityInfo : IReturn { } @@ -89,14 +89,12 @@ namespace MediaBrowser.Api /// [Route("/Plugins/SecurityInfo", "POST")] [Api("Updates plugin registration information")] - [Restrict(VisibilityTo = EndpointAttributes.None)] public class UpdatePluginSecurityInfo : PluginSecurityInfo, IReturnVoid { } [Route("/Plugins/RegistrationRecords/{Name}", "GET")] [Api("Gets registration status for a feature")] - [Restrict(VisibilityTo = EndpointAttributes.None)] public class GetRegistrationStatus { [ApiMember(Name = "Name", Description = "Feature Name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] @@ -224,7 +222,7 @@ namespace MediaBrowser.Api { // We need to parse this manually because we told service stack not to with IRequiresRequestStream // https://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Text/ServiceStack.Text/Controller/PathInfo.cs - var pathInfo = PathInfo.Parse(RequestContext.PathInfo); + var pathInfo = PathInfo.Parse(Request.PathInfo); var id = new Guid(pathInfo.GetArgumentValue(1)); var plugin = _appHost.Plugins.First(p => p.Id == id); diff --git a/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs b/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs index d17a38e073..daa735fe53 100644 --- a/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs +++ b/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs @@ -1,11 +1,11 @@ using MediaBrowser.Common.Extensions; using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Model.Tasks; -using ServiceStack.ServiceHost; -using ServiceStack.Text.Controller; +using ServiceStack; using System; using System.Collections.Generic; using System.Linq; +using ServiceStack.Text.Controller; namespace MediaBrowser.Api.ScheduledTasks { @@ -205,7 +205,7 @@ namespace MediaBrowser.Api.ScheduledTasks { // We need to parse this manually because we told service stack not to with IRequiresRequestStream // https://code.google.com/p/servicestack/source/browse/trunk/Common/ServiceStack.Text/ServiceStack.Text/Controller/PathInfo.cs - var pathInfo = PathInfo.Parse(RequestContext.PathInfo); + var pathInfo = PathInfo.Parse(Request.PathInfo); var id = new Guid(pathInfo.GetArgumentValue(1)); var task = TaskManager.ScheduledTasks.FirstOrDefault(i => i.Id == id); diff --git a/MediaBrowser.Api/SearchService.cs b/MediaBrowser.Api/SearchService.cs index 113df4e38c..25e22ab59b 100644 --- a/MediaBrowser.Api/SearchService.cs +++ b/MediaBrowser.Api/SearchService.cs @@ -7,7 +7,7 @@ using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Search; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Collections; using System.Collections.Generic; diff --git a/MediaBrowser.Api/SessionsService.cs b/MediaBrowser.Api/SessionsService.cs index a3f7e3037c..2a979888b7 100644 --- a/MediaBrowser.Api/SessionsService.cs +++ b/MediaBrowser.Api/SessionsService.cs @@ -2,7 +2,7 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Session; using MediaBrowser.Model.Session; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Collections.Generic; using System.Linq; diff --git a/MediaBrowser.Api/SimilarItemsHelper.cs b/MediaBrowser.Api/SimilarItemsHelper.cs index b0de3cf731..683e609d28 100644 --- a/MediaBrowser.Api/SimilarItemsHelper.cs +++ b/MediaBrowser.Api/SimilarItemsHelper.cs @@ -5,7 +5,7 @@ using MediaBrowser.Controller.Persistence; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Querying; -using ServiceStack.ServiceHost; +using ServiceStack; using System; using System.Collections.Generic; using System.Linq; diff --git a/MediaBrowser.Api/SystemService.cs b/MediaBrowser.Api/SystemService.cs index ae6c607954..dae603dc89 100644 --- a/MediaBrowser.Api/SystemService.cs +++ b/MediaBrowser.Api/SystemService.cs @@ -6,7 +6,7 @@ usin