aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Browser/BrowserLauncher.cs
blob: 05cde91e2204adf834b01ab8c42ab1c0e0af120f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using MediaBrowser.Controller;
using System;

namespace Emby.Server.Implementations.Browser
{
    /// <summary>
    /// Class BrowserLauncher
    /// </summary>
    public static class BrowserLauncher
    {
        /// <summary>
        /// Opens the dashboard page.
        /// </summary>
        /// <param name="page">The page.</param>
        /// <param name="appHost">The app host.</param>
        public static void OpenDashboardPage(string page, IServerApplicationHost appHost)
        {
            var url = appHost.GetLocalApiUrl("localhost") + "/web/" + page;

            OpenUrl(appHost, url);
        }

        /// <summary>
        /// Opens the community.
        /// </summary>
        public static void OpenCommunity(IServerApplicationHost appHost)
        {
            OpenUrl(appHost, "http://emby.media/community");
        }

        public static void OpenEmbyPremiere(IServerApplicationHost appHost)
        {
            OpenDashboardPage("supporterkey.html", appHost);
        }

        /// <summary>
        /// Opens the web client.
        /// </summary>
        /// <param name="appHost">The app host.</param>
        public static void OpenWebClient(IServerApplicationHost appHost)
        {
            OpenDashboardPage("index.html", appHost);
        }

        /// <summary>
        /// Opens the dashboard.
        /// </summary>
        /// <param name="appHost">The app host.</param>
        public static void OpenDashboard(IServerApplicationHost appHost)
        {
            OpenDashboardPage("dashboard.html", appHost);
        }

        /// <summary>
        /// Opens the URL.
        /// </summary>
        /// <param name="url">The URL.</param>
        private static void OpenUrl(IServerApplicationHost appHost, string url)
        {
            try
            {
                appHost.LaunchUrl(url);
            }
            catch (NotImplementedException)
            {
                
            }
            catch (Exception)
            {
            }
        }
    }
}