BrowserLauncher.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using MediaBrowser.Controller;
  2. using System;
  3. namespace Emby.Server.Implementations.Browser
  4. {
  5. /// <summary>
  6. /// Class BrowserLauncher
  7. /// </summary>
  8. public static class BrowserLauncher
  9. {
  10. /// <summary>
  11. /// Opens the dashboard page.
  12. /// </summary>
  13. /// <param name="page">The page.</param>
  14. /// <param name="appHost">The app host.</param>
  15. public static void OpenDashboardPage(string page, IServerApplicationHost appHost)
  16. {
  17. var url = appHost.GetLocalApiUrl("localhost") + "/web/" + page;
  18. OpenUrl(appHost, url);
  19. }
  20. /// <summary>
  21. /// Opens the community.
  22. /// </summary>
  23. public static void OpenCommunity(IServerApplicationHost appHost)
  24. {
  25. OpenUrl(appHost, "http://emby.media/community");
  26. }
  27. public static void OpenEmbyPremiere(IServerApplicationHost appHost)
  28. {
  29. OpenDashboardPage("supporterkey.html", appHost);
  30. }
  31. /// <summary>
  32. /// Opens the web client.
  33. /// </summary>
  34. /// <param name="appHost">The app host.</param>
  35. public static void OpenWebClient(IServerApplicationHost appHost)
  36. {
  37. OpenDashboardPage("index.html", appHost);
  38. }
  39. /// <summary>
  40. /// Opens the dashboard.
  41. /// </summary>
  42. /// <param name="appHost">The app host.</param>
  43. public static void OpenDashboard(IServerApplicationHost appHost)
  44. {
  45. OpenDashboardPage("dashboard.html", appHost);
  46. }
  47. /// <summary>
  48. /// Opens the URL.
  49. /// </summary>
  50. /// <param name="url">The URL.</param>
  51. private static void OpenUrl(IServerApplicationHost appHost, string url)
  52. {
  53. try
  54. {
  55. appHost.LaunchUrl(url);
  56. }
  57. catch (NotImplementedException)
  58. {
  59. }
  60. catch (Exception)
  61. {
  62. }
  63. }
  64. }
  65. }