2019-01-13 14:54:44 -05:00
|
|
|
using System;
|
2019-01-13 14:20:16 -05:00
|
|
|
using MediaBrowser.Controller;
|
2013-09-24 20:54:51 -04:00
|
|
|
|
2016-11-19 00:52:49 -05:00
|
|
|
namespace Emby.Server.Implementations.Browser
|
2013-09-24 20:54:51 -04:00
|
|
|
{
|
2013-09-27 13:04:35 -04:00
|
|
|
/// <summary>
|
|
|
|
/// Class BrowserLauncher
|
|
|
|
/// </summary>
|
2013-09-24 20:54:51 -04:00
|
|
|
public static class BrowserLauncher
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Opens the dashboard page.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="page">The page.</param>
|
|
|
|
/// <param name="appHost">The app host.</param>
|
2018-09-12 13:26:21 -04:00
|
|
|
private static void OpenDashboardPage(string page, IServerApplicationHost appHost)
|
2013-09-24 20:54:51 -04:00
|
|
|
{
|
2015-02-10 00:54:58 -05:00
|
|
|
var url = appHost.GetLocalApiUrl("localhost") + "/web/" + page;
|
2013-09-24 20:54:51 -04:00
|
|
|
|
2016-04-23 23:03:49 -04:00
|
|
|
OpenUrl(appHost, url);
|
2013-09-24 20:54:51 -04:00
|
|
|
}
|
|
|
|
|
2013-09-27 13:04:35 -04:00
|
|
|
/// <summary>
|
|
|
|
/// Opens the web client.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="appHost">The app host.</param>
|
2018-09-12 13:26:21 -04:00
|
|
|
public static void OpenWebApp(IServerApplicationHost appHost)
|
2013-09-27 13:04:35 -04:00
|
|
|
{
|
2016-04-23 23:03:49 -04:00
|
|
|
OpenDashboardPage("index.html", appHost);
|
2013-09-27 13:04:35 -04:00
|
|
|
}
|
|
|
|
|
2013-09-24 20:54:51 -04:00
|
|
|
/// <summary>
|
|
|
|
/// Opens the URL.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="url">The URL.</param>
|
2016-04-23 23:03:49 -04:00
|
|
|
private static void OpenUrl(IServerApplicationHost appHost, string url)
|
2013-09-24 20:54:51 -04:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2016-04-23 23:03:49 -04:00
|
|
|
appHost.LaunchUrl(url);
|
|
|
|
}
|
2017-11-21 17:14:56 -05:00
|
|
|
catch (NotSupportedException)
|
2016-04-23 23:03:49 -04:00
|
|
|
{
|
2019-01-07 18:27:46 -05:00
|
|
|
|
2013-09-24 20:54:51 -04:00
|
|
|
}
|
2016-11-19 00:52:49 -05:00
|
|
|
catch (Exception)
|
2013-09-24 20:54:51 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|