pull/12460/merge
Kilian von Pflugk 3 weeks ago committed by GitHub
commit 6d72f3d7e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -427,7 +427,8 @@ namespace Emby.Server.Implementations.Plugins
Version = versionInfo.Version,
Status = status == PluginStatus.Disabled ? PluginStatus.Disabled : PluginStatus.Active, // Keep disabled state.
AutoUpdate = true,
ImagePath = imagePath
ImagePath = imagePath,
MaximumAbi = versionInfo.MaximumAbi ?? string.Empty,
};
if (!await ReconcileManifest(manifest, path).ConfigureAwait(false))
@ -494,6 +495,7 @@ namespace Emby.Server.Implementations.Plugins
manifest.Timestamp = localManifest.Timestamp.Equals(default) ? manifest.Timestamp : localManifest.Timestamp;
manifest.ImagePath = string.IsNullOrEmpty(localManifest.ImagePath) ? manifest.ImagePath : localManifest.ImagePath;
manifest.Assemblies = localManifest.Assemblies;
manifest.MaximumAbi = string.IsNullOrEmpty(localManifest.MaximumAbi) ? manifest.MaximumAbi : localManifest.MaximumAbi;
return true;
}

@ -123,15 +123,20 @@ namespace Emby.Server.Implementations.Updates
continue;
}
if (!Version.TryParse(ver.TargetAbi, out var targetAbi))
// Only show plugins that are less than or equal to maximumAbi.
if (!Version.TryParse(ver.MaximumAbi, out var maximumAbi) || _applicationHost.ApplicationVersion <= maximumAbi)
{
targetAbi = minimumVersion;
}
// Check the targetAbi as well
if (!Version.TryParse(ver.TargetAbi, out var targetAbi))
{
targetAbi = minimumVersion;
}
// Only show plugins that are greater than or equal to targetAbi.
if (_applicationHost.ApplicationVersion >= targetAbi)
{
continue;
// Only show plugins that are greater than or equal to targetAbi.
if (_applicationHost.ApplicationVersion >= targetAbi)
{
continue;
}
}
// Not compatible with this version so remove it.
@ -187,6 +192,13 @@ namespace Emby.Server.Implementations.Updates
await _pluginManager.PopulateManifest(package, version.VersionNumber, plugin.Path, plugin.Manifest.Status).ConfigureAwait(false);
}
// Remove versions with a maximum ABI greater than the current application version.
if (Version.TryParse(version.MaximumAbi, out var maximumAbi) && _applicationHost.ApplicationVersion > maximumAbi)
{
package.Versions.RemoveAt(i);
continue;
}
// Remove versions with a target ABI greater than the current application version.
if (Version.TryParse(version.TargetAbi, out var targetAbi) && _applicationHost.ApplicationVersion < targetAbi)
{
@ -259,7 +271,8 @@ namespace Emby.Server.Implementations.Updates
var appVer = _applicationHost.ApplicationVersion;
var availableVersions = package.Versions
.Where(x => string.IsNullOrEmpty(x.TargetAbi) || Version.Parse(x.TargetAbi) <= appVer);
.Where(x => string.IsNullOrEmpty(x.TargetAbi) || Version.Parse(x.TargetAbi) <= appVer)
.Where(x => string.IsNullOrEmpty(x.MaximumAbi) || Version.Parse(x.MaximumAbi) >= appVer);
if (specificVersion is not null)
{

@ -25,6 +25,7 @@ namespace MediaBrowser.Common.Plugins
TargetAbi = string.Empty;
Version = string.Empty;
Assemblies = Array.Empty<string>();
MaximumAbi = string.Empty;
}
/// <summary>
@ -113,5 +114,11 @@ namespace MediaBrowser.Common.Plugins
/// </summary>
[JsonPropertyName("assemblies")]
public IReadOnlyList<string> Assemblies { get; set; }
/// <summary>
/// Gets or sets the maximum compatibility version of the plugin.
/// </summary>
[JsonPropertyName("maximumAbi")]
public string MaximumAbi { get; set; }
}
}

@ -73,5 +73,12 @@ namespace MediaBrowser.Model.Updates
/// </summary>
[JsonPropertyName("repositoryUrl")]
public string RepositoryUrl { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the maximum ABI that this version was built against.
/// </summary>
/// <value>The target maximum ABI version.</value>
[JsonPropertyName("maximumAbi")]
public string? MaximumAbi { get; set; }
}
}

@ -187,7 +187,8 @@ namespace Jellyfin.Server.Implementations.Tests.Plugins
Timestamp = DateTime.Parse(packageInfo.Versions[0].Timestamp!, CultureInfo.InvariantCulture),
Changelog = packageInfo.Versions[0].Changelog!,
Version = new Version(1, 0).ToString(),
ImagePath = string.Empty
ImagePath = string.Empty,
MaximumAbi = packageInfo.Versions[0].MaximumAbi!
};
var metafilePath = Path.Combine(_pluginPath, "meta.json");
@ -223,7 +224,8 @@ namespace Jellyfin.Server.Implementations.Tests.Plugins
Timestamp = DateTime.Parse(packageInfo.Versions[0].Timestamp!, CultureInfo.InvariantCulture),
Changelog = packageInfo.Versions[0].Changelog!,
Version = packageInfo.Versions[0].Version,
ImagePath = string.Empty
ImagePath = string.Empty,
MaximumAbi = packageInfo.Versions[0].MaximumAbi!
};
var pluginManager = new PluginManager(new NullLogger<PluginManager>(), null!, null!, null!, new Version(1, 0));

Loading…
Cancel
Save