diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs index 93bfcbbab..160397e7c 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs @@ -21,6 +21,7 @@ using System.Threading; using System.Threading.Tasks; using MediaBrowser.Common.Net; using MediaBrowser.Common.Security; +using MediaBrowser.Model.Extensions; namespace MediaBrowser.Server.Implementations.HttpServer { @@ -342,16 +343,26 @@ namespace MediaBrowser.Server.Implementations.HttpServer urlToLog = GetUrlToLog(urlString); LoggerUtils.LogRequest(_logger, urlToLog, httpReq.HttpMethod, httpReq.UserAgent); } - + if (string.Equals(localPath, "/mediabrowser/", StringComparison.OrdinalIgnoreCase) || - string.Equals(localPath, "/emby/", StringComparison.OrdinalIgnoreCase)) + string.Equals(localPath, "/mediabrowser", StringComparison.OrdinalIgnoreCase) || + localPath.IndexOf("mediabrowser/web", StringComparison.OrdinalIgnoreCase) != -1 || + localPath.IndexOf("dashboard/", StringComparison.OrdinalIgnoreCase) != -1) { - httpRes.RedirectToUrl(DefaultRedirectPath); + httpRes.StatusCode = 200; + httpRes.ContentType = "text/plain"; + var newUrl = urlString.Replace("mediabrowser", "emby", StringComparison.OrdinalIgnoreCase) + .Replace("/dashboard/", "/web/", StringComparison.OrdinalIgnoreCase); + + httpRes.Write("Please update your Emby bookmark to " + newUrl); + + httpRes.Close(); return Task.FromResult(true); } - if (string.Equals(localPath, "/mediabrowser", StringComparison.OrdinalIgnoreCase)) + + if (string.Equals(localPath, "/emby/", StringComparison.OrdinalIgnoreCase)) { - httpRes.RedirectToUrl("mediabrowser/" + DefaultRedirectPath); + httpRes.RedirectToUrl(DefaultRedirectPath); return Task.FromResult(true); } if (string.Equals(localPath, "/emby", StringComparison.OrdinalIgnoreCase)) @@ -461,6 +472,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer Priority = route.Priority, Summary = route.Summary }); + routes.Add(new RouteAttribute(NormalizeRoutePath(route.Path), route.Verbs) { Notes = route.Notes, @@ -468,13 +480,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer Summary = route.Summary }); - // TODO: This is a hack for iOS. Remove it asap. - routes.Add(new RouteAttribute(DoubleNormalizeRoutePath(route.Path), route.Verbs) - { - Notes = route.Notes, - Priority = route.Priority, - Summary = route.Summary - }); routes.Add(new RouteAttribute(DoubleNormalizeEmbyRoutePath(route.Path), route.Verbs) { Notes = route.Notes, @@ -516,16 +521,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer return "mediabrowser/" + path; } - private string DoubleNormalizeRoutePath(string path) - { - if (path.StartsWith("/", StringComparison.OrdinalIgnoreCase)) - { - return "/mediabrowser/mediabrowser" + path; - } - - return "mediabrowser/mediabrowser/" + path; - } - /// /// Releases the specified instance. /// diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index a5bfebea9..ab9ff8e6f 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -25,7 +25,6 @@ namespace MediaBrowser.WebDashboard.Api /// /// Class GetDashboardConfigurationPages /// - [Route("/dashboard/ConfigurationPages", "GET")] [Route("/web/ConfigurationPages", "GET")] public class GetDashboardConfigurationPages : IReturn> { @@ -39,7 +38,6 @@ namespace MediaBrowser.WebDashboard.Api /// /// Class GetDashboardConfigurationPage /// - [Route("/dashboard/ConfigurationPage", "GET")] [Route("/web/ConfigurationPage", "GET")] public class GetDashboardConfigurationPage { @@ -51,7 +49,6 @@ namespace MediaBrowser.WebDashboard.Api } [Route("/web/Package", "GET")] - [Route("/dashboard/Package", "GET")] public class GetDashboardPackage { public string Mode { get; set; } @@ -66,7 +63,6 @@ namespace MediaBrowser.WebDashboard.Api /// Class GetDashboardResource /// [Route("/web/{ResourceName*}", "GET")] - [Route("/dashboard/{ResourceName*}", "GET")] public class GetDashboardResource { /// @@ -142,7 +138,7 @@ namespace MediaBrowser.WebDashboard.Api { var page = ServerEntryPoint.Instance.PluginConfigurationPages.First(p => p.Name.Equals(request.Name, StringComparison.OrdinalIgnoreCase)); - return ResultFactory.GetStaticResult(Request, page.Plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator().ModifyHtml(null, page.GetHtmlStream(), null, _appHost.ApplicationVersion.ToString(), null, false)); + return ResultFactory.GetStaticResult(Request, page.Plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator().ModifyHtml("dummy.html", page.GetHtmlStream(), null, _appHost.ApplicationVersion.ToString(), null, false)); } ///