specify plugin repo on install

This commit is contained in:
crobibero 2020-07-17 09:08:29 -06:00
parent 7e53bc5ec5
commit 2b5d515de7
3 changed files with 26 additions and 1 deletions

View File

@ -161,7 +161,12 @@ namespace Emby.Server.Implementations.Updates
var result = new List<PackageInfo>();
foreach (RepositoryInfo repository in _config.Configuration.PluginRepositories)
{
result.AddRange(await GetPackages(repository.Url, cancellationToken).ConfigureAwait(true));
foreach (var package in await GetPackages(repository.Url, cancellationToken).ConfigureAwait(true))
{
package.repositoryName = repository.Name;
package.repositoryUrl = repository.Url;
result.Add(package);
}
}
return result;

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Common.Extensions;
@ -83,6 +84,9 @@ namespace MediaBrowser.Api
/// <value>The version.</value>
[ApiMember(Name = "Version", Description = "Optional version. Defaults to latest version.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public string Version { get; set; }
[ApiMember(Name = "RepositoryUrl", Description = "Optional. Specify the repository to install from", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public string RepositoryUrl { get; set; }
}
/// <summary>
@ -167,6 +171,12 @@ namespace MediaBrowser.Api
public async Task Post(InstallPackage request)
{
var packages = await _installationManager.GetAvailablePackages().ConfigureAwait(false);
if (!string.IsNullOrEmpty(request.RepositoryUrl))
{
packages = packages.Where(p => p.repositoryUrl.Equals(request.RepositoryUrl, StringComparison.OrdinalIgnoreCase))
.ToList();
}
var package = _installationManager.GetCompatibleVersions(
packages,
request.Name,

View File

@ -52,6 +52,16 @@ namespace MediaBrowser.Model.Updates
/// <value>The versions.</value>
public IReadOnlyList<VersionInfo> versions { get; set; }
/// <summary>
/// Gets or sets the repository name.
/// </summary>
public string repositoryName { get; set; }
/// <summary>
/// Gets or sets the repository url.
/// </summary>
public string repositoryUrl { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="PackageInfo"/> class.
/// </summary>