Add GET /Api/Plugins endpoint,

In regards to https://github.com/JustArchiNET/ASF-ui/issues/1015
This commit is contained in:
JustArchi
2020-06-24 20:54:41 +02:00
parent d191820317
commit 69936d55b6
5 changed files with 54 additions and 3 deletions

View File

@@ -21,6 +21,7 @@
using System;
using JetBrains.Annotations;
using Newtonsoft.Json;
namespace ArchiSteamFarm.Plugins {
[PublicAPI]
@@ -29,6 +30,7 @@ namespace ArchiSteamFarm.Plugins {
/// ASF will use this property as general plugin identifier for the user.
/// </summary>
/// <returns>String that will be used as the name of this plugin.</returns>
[JsonProperty]
[NotNull]
string Name { get; }
@@ -37,6 +39,7 @@ namespace ArchiSteamFarm.Plugins {
/// You have a freedom in deciding what versioning you want to use, this is for identification purposes only.
/// </summary>
/// <returns>Version that will be shown to the user when plugin is loaded.</returns>
[JsonProperty]
[NotNull]
Version Version { get; }

View File

@@ -39,10 +39,10 @@ namespace ArchiSteamFarm.Plugins {
internal static class PluginsCore {
internal static bool HasCustomPluginsLoaded => HasActivePluginsLoaded && ActivePlugins.Any(plugin => !(plugin is OfficialPlugin officialPlugin) || !officialPlugin.HasSameVersion());
private static bool HasActivePluginsLoaded => ActivePlugins?.Count > 0;
[ImportMany]
private static ImmutableHashSet<IPlugin> ActivePlugins { get; set; }
internal static ImmutableHashSet<IPlugin> ActivePlugins { get; private set; }
private static bool HasActivePluginsLoaded => ActivePlugins?.Count > 0;
[ItemNotNull]
internal static async Task<StringComparer> GetBotsComparer() {