mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-04 02:01:28 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			52 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
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>
 | 
						|
        private static void OpenDashboardPage(string page, IServerApplicationHost appHost)
 | 
						|
        {
 | 
						|
            var url = appHost.GetLocalApiUrl("localhost") + "/web/" + page;
 | 
						|
 | 
						|
            OpenUrl(appHost, url);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Opens the web client.
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="appHost">The app host.</param>
 | 
						|
        public static void OpenWebApp(IServerApplicationHost appHost)
 | 
						|
        {
 | 
						|
            OpenDashboardPage("index.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 (NotSupportedException)
 | 
						|
            {
 | 
						|
                
 | 
						|
            }
 | 
						|
            catch (Exception)
 | 
						|
            {
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |