dont crash if the plugin builder provides more instances of the same plugin but different v

This commit is contained in:
Kukks 2023-12-12 13:23:33 +01:00
parent 72ee65843d
commit b751e23e93
No known key found for this signature in database
GPG key ID: 8E5530D9D1C93097

View file

@ -83,7 +83,10 @@ namespace BTCPayServer.HostedServices
var installedPlugins =
pluginService.LoadedPlugins.ToDictionary(plugin => plugin.Identifier, plugin => plugin.Version);
var remotePlugins = await pluginService.GetRemotePlugins();
//take the latest version of each plugin
var remotePluginsList = remotePlugins
.GroupBy(plugin => plugin.Identifier)
.Select(group => group.OrderByDescending(plugin => plugin.Version).First())
.Where(pair => installedPlugins.ContainsKey(pair.Identifier) || disabledPlugins.Contains(pair.Name))
.ToDictionary(plugin => plugin.Identifier, plugin => plugin.Version);
var notify = new HashSet<string>();