2013-09-24 20:54:51 -04:00
|
|
|
|
using MediaBrowser.Controller;
|
|
|
|
|
using System;
|
|
|
|
|
|
2016-11-11 00:43:57 -05:00
|
|
|
|
namespace Emby.Server.Core.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>
|
2016-04-23 23:03:49 -04:00
|
|
|
|
public 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 community.
|
|
|
|
|
/// </summary>
|
2016-04-23 23:03:49 -04:00
|
|
|
|
public static void OpenCommunity(IServerApplicationHost appHost)
|
2013-09-27 13:04:35 -04:00
|
|
|
|
{
|
2016-04-23 23:03:49 -04:00
|
|
|
|
OpenUrl(appHost, "http://emby.media/community");
|
2013-09-27 13:04:35 -04:00
|
|
|
|
}
|
|
|
|
|
|
2016-08-31 15:17:11 -04:00
|
|
|
|
public static void OpenEmbyPremiere(IServerApplicationHost appHost)
|
|
|
|
|
{
|
|
|
|
|
OpenDashboardPage("supporterkey.html", appHost);
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-27 13:04:35 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Opens the web client.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="appHost">The app host.</param>
|
2016-04-23 23:03:49 -04:00
|
|
|
|
public static void OpenWebClient(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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Opens the dashboard.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="appHost">The app host.</param>
|
2016-04-23 23:03:49 -04:00
|
|
|
|
public static void OpenDashboard(IServerApplicationHost appHost)
|
2013-09-27 13:04:35 -04:00
|
|
|
|
{
|
2016-04-23 23:03:49 -04:00
|
|
|
|
OpenDashboardPage("dashboard.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);
|
|
|
|
|
}
|
|
|
|
|
catch (NotImplementedException)
|
|
|
|
|
{
|
|
|
|
|
|
2013-09-24 20:54:51 -04:00
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
2016-04-23 23:03:49 -04:00
|
|
|
|
Console.WriteLine("Error launching url: " + url);
|
2013-12-05 11:50:21 -05:00
|
|
|
|
Console.WriteLine(ex.Message);
|
2013-09-24 20:54:51 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|