Add '--plugin-manifest-url' command line option and 'InstallationManager:PluginManifestUrl' config option

This commit is contained in:
Mark Monteiro 2020-04-05 13:46:36 -04:00
parent 92af81166d
commit 15dd46c25a
4 changed files with 34 additions and 9 deletions

View File

@ -1,5 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using Emby.Server.Implementations.HttpServer; using Emby.Server.Implementations.HttpServer;
using Emby.Server.Implementations.Updates;
using MediaBrowser.Providers.Music; using MediaBrowser.Providers.Music;
using static MediaBrowser.Controller.Extensions.ConfigurationExtensions; using static MediaBrowser.Controller.Extensions.ConfigurationExtensions;
@ -17,6 +18,7 @@ namespace Emby.Server.Implementations
{ {
{ HostWebClientKey, bool.TrueString }, { HostWebClientKey, bool.TrueString },
{ HttpListenerHost.DefaultRedirectKey, "web/index.html" }, { HttpListenerHost.DefaultRedirectKey, "web/index.html" },
{ InstallationManager.PluginManifestUrlKey, "https://repo.jellyfin.org/releases/plugin/manifest.json" },
{ FfmpegProbeSizeKey, "1G" }, { FfmpegProbeSizeKey, "1G" },
{ FfmpegAnalyzeDurationKey, "200M" }, { FfmpegAnalyzeDurationKey, "200M" },
{ PlaylistsAllowDuplicatesKey, bool.TrueString } { PlaylistsAllowDuplicatesKey, bool.TrueString }

View File

@ -3,33 +3,38 @@ namespace Emby.Server.Implementations
public interface IStartupOptions public interface IStartupOptions
{ {
/// <summary> /// <summary>
/// --ffmpeg /// Gets the value of the --ffmpeg command line option.
/// </summary> /// </summary>
string FFmpegPath { get; } string FFmpegPath { get; }
/// <summary> /// <summary>
/// --service /// Gets the value of the --service command line option.
/// </summary> /// </summary>
bool IsService { get; } bool IsService { get; }
/// <summary> /// <summary>
/// --noautorunwebapp /// Gets the value of the --noautorunwebapp command line option.
/// </summary> /// </summary>
bool NoAutoRunWebApp { get; } bool NoAutoRunWebApp { get; }
/// <summary> /// <summary>
/// --package-name /// Gets the value of the --package-name command line option.
/// </summary> /// </summary>
string PackageName { get; } string PackageName { get; }
/// <summary> /// <summary>
/// --restartpath /// Gets the value of the --restartpath command line option.
/// </summary> /// </summary>
string RestartPath { get; } string RestartPath { get; }
/// <summary> /// <summary>
/// --restartargs /// Gets the value of the --restartargs command line option.
/// </summary> /// </summary>
string RestartArgs { get; } string RestartArgs { get; }
/// <summary>
/// Gets the value of the --plugin-manifest-url command line option.
/// </summary>
string PluginManifestUrl { get; }
} }
} }

View File

@ -18,6 +18,7 @@ using MediaBrowser.Model.Events;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Updates; using MediaBrowser.Model.Updates;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Updates namespace Emby.Server.Implementations.Updates
@ -27,6 +28,11 @@ namespace Emby.Server.Implementations.Updates
/// </summary> /// </summary>
public class InstallationManager : IInstallationManager public class InstallationManager : IInstallationManager
{ {
/// <summary>
/// The key for a setting that specifies a URL for the plugin repository JSON manifest.
/// </summary>
public const string PluginManifestUrlKey = "InstallationManager:PluginManifestUrl";
/// <summary> /// <summary>
/// The _logger. /// The _logger.
/// </summary> /// </summary>
@ -44,6 +50,7 @@ namespace Emby.Server.Implementations.Updates
private readonly IApplicationHost _applicationHost; private readonly IApplicationHost _applicationHost;
private readonly IZipClient _zipClient; private readonly IZipClient _zipClient;
private readonly IConfiguration _appConfig;
private readonly object _currentInstallationsLock = new object(); private readonly object _currentInstallationsLock = new object();
@ -65,7 +72,8 @@ namespace Emby.Server.Implementations.Updates
IJsonSerializer jsonSerializer, IJsonSerializer jsonSerializer,
IServerConfigurationManager config, IServerConfigurationManager config,
IFileSystem fileSystem, IFileSystem fileSystem,
IZipClient zipClient) IZipClient zipClient,
IConfiguration appConfig)
{ {
if (logger == null) if (logger == null)
{ {
@ -83,6 +91,7 @@ namespace Emby.Server.Implementations.Updates
_config = config; _config = config;
_fileSystem = fileSystem; _fileSystem = fileSystem;
_zipClient = zipClient; _zipClient = zipClient;
_appConfig = appConfig;
} }
/// <inheritdoc /> /// <inheritdoc />
@ -115,7 +124,7 @@ namespace Emby.Server.Implementations.Updates
using (var response = await _httpClient.SendAsync( using (var response = await _httpClient.SendAsync(
new HttpRequestOptions new HttpRequestOptions
{ {
Url = "https://repo.jellyfin.org/releases/plugin/manifest.json", Url = _appConfig.GetValue<string>(PluginManifestUrlKey),
CancellationToken = cancellationToken, CancellationToken = cancellationToken,
CacheMode = CacheMode.Unconditional, CacheMode = CacheMode.Unconditional,
CacheLength = TimeSpan.FromMinutes(3) CacheLength = TimeSpan.FromMinutes(3)

View File

@ -1,7 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using CommandLine; using CommandLine;
using Emby.Server.Implementations; using Emby.Server.Implementations;
using Emby.Server.Implementations.Updates;
using MediaBrowser.Controller.Extensions; using MediaBrowser.Controller.Extensions;
namespace Jellyfin.Server namespace Jellyfin.Server
@ -76,6 +76,10 @@ namespace Jellyfin.Server
[Option("restartargs", Required = false, HelpText = "Arguments for restart script.")] [Option("restartargs", Required = false, HelpText = "Arguments for restart script.")]
public string? RestartArgs { get; set; } public string? RestartArgs { get; set; }
/// <inheritdoc />
[Option("plugin-manifest-url", Required = false, HelpText = "A custom URL for the plugin repository JSON manifest")]
public string? PluginManifestUrl { get; set; }
/// <summary> /// <summary>
/// Gets the command line options as a dictionary that can be used in the .NET configuration system. /// Gets the command line options as a dictionary that can be used in the .NET configuration system.
/// </summary> /// </summary>
@ -84,6 +88,11 @@ namespace Jellyfin.Server
{ {
var config = new Dictionary<string, string>(); var config = new Dictionary<string, string>();
if (PluginManifestUrl != null)
{
config.Add(InstallationManager.PluginManifestUrlKey, PluginManifestUrl);
}
if (NoWebClient) if (NoWebClient)
{ {
config.Add(ConfigurationExtensions.HostWebClientKey, bool.FalseString); config.Add(ConfigurationExtensions.HostWebClientKey, bool.FalseString);