remove web client aliases

pull/702/head
Luke Pulverenti 9 years ago
parent 623fd6ff92
commit 687c17c4c6

@ -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;
}
/// <summary>
/// Releases the specified instance.
/// </summary>

@ -25,7 +25,6 @@ namespace MediaBrowser.WebDashboard.Api
/// <summary>
/// Class GetDashboardConfigurationPages
/// </summary>
[Route("/dashboard/ConfigurationPages", "GET")]
[Route("/web/ConfigurationPages", "GET")]
public class GetDashboardConfigurationPages : IReturn<List<ConfigurationPageInfo>>
{
@ -39,7 +38,6 @@ namespace MediaBrowser.WebDashboard.Api
/// <summary>
/// Class GetDashboardConfigurationPage
/// </summary>
[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
/// </summary>
[Route("/web/{ResourceName*}", "GET")]
[Route("/dashboard/{ResourceName*}", "GET")]
public class GetDashboardResource
{
/// <summary>
@ -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));
}
/// <summary>

Loading…
Cancel
Save