Skip to content

Commit

Permalink
cli: Fix plugins command (#3394)
Browse files Browse the repository at this point in the history
* Fix plugin list

* Update src/Neo.CLI/CLI/MainService.Plugins.cs

---------

Co-authored-by: NGD Admin <[email protected]>
  • Loading branch information
shargon and NGDAdmin authored Jul 4, 2024
1 parent 20b7409 commit a80fca6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Neo.CLI/CLI/MainService.Plugins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -269,13 +269,15 @@ private async Task<IEnumerable<string>> GetPluginListAsync()
var asmName = Assembly.GetExecutingAssembly().GetName();
httpClient.DefaultRequestHeaders.UserAgent.Add(new(asmName.Name!, asmName.Version!.ToString(3)));

var json = await httpClient.GetFromJsonAsync<JsonArray>(Settings.Default.Plugins.DownloadUrl) ?? throw new HttpRequestException($"Failed: {Settings.Default.Plugins.DownloadUrl}");
var json = await httpClient.GetFromJsonAsync<JsonArray>(Settings.Default.Plugins.DownloadUrl)
?? throw new HttpRequestException($"Failed: {Settings.Default.Plugins.DownloadUrl}");
return json.AsArray()
.Where(w =>
w != null &&
w["tag_name"]!.GetValue<string>() == $"v{Settings.Default.Plugins.Version.ToString(3)}")
.SelectMany(s => s!["assets"]!.AsArray())
.Select(s => Path.GetFileNameWithoutExtension(s!["name"]!.GetValue<string>()));
.Select(s => Path.GetFileNameWithoutExtension(s!["name"]!.GetValue<string>()))
.Where(s => !s.StartsWith("neo-cli", StringComparison.InvariantCultureIgnoreCase));
}
}
}

0 comments on commit a80fca6

Please sign in to comment.