create single method to form api url

This commit is contained in:
Luke Pulverenti
2015-02-10 00:54:58 -05:00
parent 3d7089a7db
commit 0052f0a09d
71 changed files with 22672 additions and 22657 deletions

View File

@@ -1044,15 +1044,20 @@ namespace MediaBrowser.Server.Startup.Common
if (!string.IsNullOrWhiteSpace(address))
{
address = string.Format("http://{0}:{1}",
address,
HttpPort.ToString(CultureInfo.InvariantCulture));
address = GetLocalApiUrl(address);
}
return address;
}
}
public string GetLocalApiUrl(string host)
{
return string.Format("http://{0}:{1}",
host,
HttpPort.ToString(CultureInfo.InvariantCulture));
}
public string LocalIpAddress
{
get

View File

@@ -18,7 +18,7 @@ namespace MediaBrowser.Server.Startup.Common.Browser
/// <param name="logger">The logger.</param>
public static void OpenDashboardPage(string page, IServerApplicationHost appHost, ILogger logger)
{
var url = "http://localhost:" + appHost.HttpPort + "/web/" + page;
var url = appHost.GetLocalApiUrl("localhost") + "/web/" + page;
OpenUrl(url, logger);
}
@@ -68,7 +68,9 @@ namespace MediaBrowser.Server.Startup.Common.Browser
/// <param name="logger">The logger.</param>
public static void OpenSwagger(IServerApplicationHost appHost, ILogger logger)
{
OpenUrl("http://localhost:" + appHost.HttpPort + "/swagger-ui/index.html", logger);
var url = appHost.GetLocalApiUrl("localhost") + "/swagger-ui/index.html";
OpenUrl(url, logger);
}
/// <summary>
@@ -98,7 +100,7 @@ namespace MediaBrowser.Server.Startup.Common.Browser
{
logger.ErrorException("Error launching url: {0}", ex, url);
Console.WriteLine(string.Format("Error launching url: {0}", ex));
Console.WriteLine("Error launching url: {0}", ex.Message);
Console.WriteLine(ex.Message);
//#if !__MonoCS__