mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-04-24 14:08:44 -04:00
Removed browser auto-load functionality from the server.
Added profiles in launchSettings to start either the web client or the swagger API page. Removed --noautorunwebapp as this is the default functionality.
This commit is contained in:
parent
6dd6961fd4
commit
5cca8bffea
9 changed files with 10 additions and 150 deletions
|
@ -103,6 +103,7 @@
|
||||||
- [sl1288](https://github.com/sl1288)
|
- [sl1288](https://github.com/sl1288)
|
||||||
- [sorinyo2004](https://github.com/sorinyo2004)
|
- [sorinyo2004](https://github.com/sorinyo2004)
|
||||||
- [sparky8251](https://github.com/sparky8251)
|
- [sparky8251](https://github.com/sparky8251)
|
||||||
|
- [spookbits](https://github.com/spookbits)
|
||||||
- [stanionascu](https://github.com/stanionascu)
|
- [stanionascu](https://github.com/stanionascu)
|
||||||
- [stevehayles](https://github.com/stevehayles)
|
- [stevehayles](https://github.com/stevehayles)
|
||||||
- [SuperSandro2000](https://github.com/SuperSandro2000)
|
- [SuperSandro2000](https://github.com/SuperSandro2000)
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
using System;
|
|
||||||
using MediaBrowser.Controller;
|
|
||||||
using MediaBrowser.Controller.Configuration;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.Browser
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Assists in opening application URLs in an external browser.
|
|
||||||
/// </summary>
|
|
||||||
public static class BrowserLauncher
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Opens the home page of the web client.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="appHost">The app host.</param>
|
|
||||||
public static void OpenWebApp(IServerApplicationHost appHost)
|
|
||||||
{
|
|
||||||
TryOpenUrl(appHost, "/web/index.html");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Opens the swagger API page.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="appHost">The app host.</param>
|
|
||||||
public static void OpenSwaggerPage(IServerApplicationHost appHost)
|
|
||||||
{
|
|
||||||
TryOpenUrl(appHost, "/api-docs/swagger");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Opens the specified URL in an external browser window. Any exceptions will be logged, but ignored.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="appHost">The application host.</param>
|
|
||||||
/// <param name="relativeUrl">The URL to open, relative to the server base URL.</param>
|
|
||||||
private static void TryOpenUrl(IServerApplicationHost appHost, string relativeUrl)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string baseUrl = appHost.GetLocalApiUrl("localhost");
|
|
||||||
appHost.LaunchUrl(baseUrl + relativeUrl);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
var logger = appHost.Resolve<ILogger<IServerApplicationHost>>();
|
|
||||||
logger?.LogError(ex, "Failed to open browser window with URL {URL}", relativeUrl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,83 +0,0 @@
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Emby.Server.Implementations.Browser;
|
|
||||||
using MediaBrowser.Controller;
|
|
||||||
using MediaBrowser.Controller.Configuration;
|
|
||||||
using MediaBrowser.Controller.Extensions;
|
|
||||||
using MediaBrowser.Controller.Plugins;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
|
|
||||||
namespace Emby.Server.Implementations.EntryPoints
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class StartupWizard.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class StartupWizard : IServerEntryPoint
|
|
||||||
{
|
|
||||||
private readonly IServerApplicationHost _appHost;
|
|
||||||
private readonly IConfiguration _appConfig;
|
|
||||||
private readonly IServerConfigurationManager _config;
|
|
||||||
private readonly IStartupOptions _startupOptions;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="StartupWizard"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="appHost">The application host.</param>
|
|
||||||
/// <param name="appConfig">The application configuration.</param>
|
|
||||||
/// <param name="config">The configuration manager.</param>
|
|
||||||
/// <param name="startupOptions">The application startup options.</param>
|
|
||||||
public StartupWizard(
|
|
||||||
IServerApplicationHost appHost,
|
|
||||||
IConfiguration appConfig,
|
|
||||||
IServerConfigurationManager config,
|
|
||||||
IStartupOptions startupOptions)
|
|
||||||
{
|
|
||||||
_appHost = appHost;
|
|
||||||
_appConfig = appConfig;
|
|
||||||
_config = config;
|
|
||||||
_startupOptions = startupOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public Task RunAsync()
|
|
||||||
{
|
|
||||||
Run();
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Run()
|
|
||||||
{
|
|
||||||
if (!_appHost.CanLaunchWebBrowser)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Always launch the startup wizard if possible when it has not been completed
|
|
||||||
if (!_config.Configuration.IsStartupWizardCompleted && _appConfig.HostWebClient())
|
|
||||||
{
|
|
||||||
BrowserLauncher.OpenWebApp(_appHost);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do nothing if the web app is configured to not run automatically
|
|
||||||
if (!_config.Configuration.AutoRunWebApp || _startupOptions.NoAutoRunWebApp)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Launch the swagger page if the web client is not hosted, otherwise open the web client
|
|
||||||
if (_appConfig.HostWebClient())
|
|
||||||
{
|
|
||||||
BrowserLauncher.OpenWebApp(_appHost);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BrowserLauncher.OpenSwaggerPage(_appHost);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -16,11 +16,6 @@ namespace Emby.Server.Implementations
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool IsService { get; }
|
bool IsService { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the value of the --noautorunwebapp command line option.
|
|
||||||
/// </summary>
|
|
||||||
bool NoAutoRunWebApp { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the value of the --package-name command line option.
|
/// Gets the value of the --package-name command line option.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<!-- ProjectGuid is only included as a requirement for SonarQube analysis -->
|
<!-- ProjectGuid is only included as a requirement for SonarQube analysis -->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
|
@ -2,14 +2,20 @@
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"Jellyfin.Server": {
|
"Jellyfin.Server": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "web",
|
||||||
|
"applicationUrl": "http://localhost:8096",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Jellyfin.Server (nowebclient)": {
|
"Jellyfin.Server (nowebclient)": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "api-docs/swagger",
|
||||||
|
"applicationUrl": "http://localhost:8096",
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
},
|
},
|
||||||
"commandLineArgs": "--nowebclient"
|
"commandLineArgs": "--nowebclient"
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,10 +63,6 @@ namespace Jellyfin.Server
|
||||||
[Option("service", Required = false, HelpText = "Run as headless service.")]
|
[Option("service", Required = false, HelpText = "Run as headless service.")]
|
||||||
public bool IsService { get; set; }
|
public bool IsService { get; set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
[Option("noautorunwebapp", Required = false, HelpText = "Run headless if startup wizard is complete.")]
|
|
||||||
public bool NoAutoRunWebApp { get; set; }
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
[Option("package-name", Required = false, HelpText = "Used when packaging Jellyfin (example, synology).")]
|
[Option("package-name", Required = false, HelpText = "Used when packaging Jellyfin (example, synology).")]
|
||||||
public string? PackageName { get; set; }
|
public string? PackageName { get; set; }
|
||||||
|
|
|
@ -83,8 +83,6 @@ namespace MediaBrowser.Model.Configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool QuickConnectAvailable { get; set; }
|
public bool QuickConnectAvailable { get; set; }
|
||||||
|
|
||||||
public bool AutoRunWebApp { get; set; }
|
|
||||||
|
|
||||||
public bool EnableRemoteAccess { get; set; }
|
public bool EnableRemoteAccess { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -306,7 +304,6 @@ namespace MediaBrowser.Model.Configuration
|
||||||
DisableLiveTvChannelUserDataName = true;
|
DisableLiveTvChannelUserDataName = true;
|
||||||
EnableNewOmdbSupport = true;
|
EnableNewOmdbSupport = true;
|
||||||
|
|
||||||
AutoRunWebApp = true;
|
|
||||||
EnableRemoteAccess = true;
|
EnableRemoteAccess = true;
|
||||||
QuickConnectAvailable = false;
|
QuickConnectAvailable = false;
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,7 @@ namespace Jellyfin.Api.Tests
|
||||||
// Specify the startup command line options
|
// Specify the startup command line options
|
||||||
var commandLineOpts = new StartupOptions
|
var commandLineOpts = new StartupOptions
|
||||||
{
|
{
|
||||||
NoWebClient = true,
|
NoWebClient = true
|
||||||
NoAutoRunWebApp = true
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Use a temporary directory for the application paths
|
// Use a temporary directory for the application paths
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue