|
|
|
@ -103,12 +103,12 @@ namespace Emby.Server.Implementations.Updates
|
|
|
|
|
public IEnumerable<InstallationInfo> CompletedInstallations => _completedInstallationsInternal;
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public async Task<IList<PackageInfo>> GetPackages(string manifestName, string manifest, bool filterIncompatible, CancellationToken cancellationToken = default)
|
|
|
|
|
public async Task<PackageInfo[]> GetPackages(string manifestName, string manifest, bool filterIncompatible, CancellationToken cancellationToken = default)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
List<PackageInfo>? packages = await _httpClientFactory.CreateClient(NamedClient.Default)
|
|
|
|
|
.GetFromJsonAsync<List<PackageInfo>>(new Uri(manifest), _jsonSerializerOptions, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
PackageInfo[]? packages = await _httpClientFactory.CreateClient(NamedClient.Default)
|
|
|
|
|
.GetFromJsonAsync<PackageInfo[]>(new Uri(manifest), _jsonSerializerOptions, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
if (packages == null)
|
|
|
|
|
{
|
|
|
|
@ -181,20 +181,14 @@ namespace Emby.Server.Implementations.Updates
|
|
|
|
|
// Where repositories have the same content, the details from the first is taken.
|
|
|
|
|
foreach (var package in await GetPackages(repository.Name ?? "Unnamed Repo", repository.Url, true, cancellationToken).ConfigureAwait(true))
|
|
|
|
|
{
|
|
|
|
|
if (!Guid.TryParse(package.Id, out var packageGuid))
|
|
|
|
|
{
|
|
|
|
|
// Package doesn't have a valid GUID, skip.
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var existing = FilterPackages(result, package.Name, packageGuid).FirstOrDefault();
|
|
|
|
|
var existing = FilterPackages(result, package.Name, package.Id).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
// Remove invalid versions from the valid package.
|
|
|
|
|
for (var i = package.Versions.Count - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
var version = package.Versions[i];
|
|
|
|
|
|
|
|
|
|
var plugin = _pluginManager.GetPlugin(packageGuid, version.VersionNumber);
|
|
|
|
|
var plugin = _pluginManager.GetPlugin(package.Id, version.VersionNumber);
|
|
|
|
|
if (plugin != null)
|
|
|
|
|
{
|
|
|
|
|
await _pluginManager.GenerateManifest(package, version.VersionNumber, plugin.Path, plugin.Manifest.Status).ConfigureAwait(false);
|
|
|
|
@ -233,7 +227,7 @@ namespace Emby.Server.Implementations.Updates
|
|
|
|
|
public IEnumerable<PackageInfo> FilterPackages(
|
|
|
|
|
IEnumerable<PackageInfo> availablePackages,
|
|
|
|
|
string? name = null,
|
|
|
|
|
Guid? id = default,
|
|
|
|
|
Guid id = default,
|
|
|
|
|
Version? specificVersion = null)
|
|
|
|
|
{
|
|
|
|
|
if (name != null)
|
|
|
|
@ -241,9 +235,9 @@ namespace Emby.Server.Implementations.Updates
|
|
|
|
|
availablePackages = availablePackages.Where(x => x.Name.Equals(name, StringComparison.OrdinalIgnoreCase));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (id != Guid.Empty)
|
|
|
|
|
if (id != default)
|
|
|
|
|
{
|
|
|
|
|
availablePackages = availablePackages.Where(x => Guid.Parse(x.Id) == id);
|
|
|
|
|
availablePackages = availablePackages.Where(x => x.Id == id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (specificVersion != null)
|
|
|
|
@ -258,7 +252,7 @@ namespace Emby.Server.Implementations.Updates
|
|
|
|
|
public IEnumerable<InstallationInfo> GetCompatibleVersions(
|
|
|
|
|
IEnumerable<PackageInfo> availablePackages,
|
|
|
|
|
string? name = null,
|
|
|
|
|
Guid? id = default,
|
|
|
|
|
Guid id = default,
|
|
|
|
|
Version? minVersion = null,
|
|
|
|
|
Version? specificVersion = null)
|
|
|
|
|
{
|
|
|
|
@ -288,7 +282,7 @@ namespace Emby.Server.Implementations.Updates
|
|
|
|
|
yield return new InstallationInfo
|
|
|
|
|
{
|
|
|
|
|
Changelog = v.Changelog,
|
|
|
|
|
Id = new Guid(package.Id),
|
|
|
|
|
Id = package.Id,
|
|
|
|
|
Name = package.Name,
|
|
|
|
|
Version = v.VersionNumber,
|
|
|
|
|
SourceUrl = v.SourceUrl,
|
|
|
|
|