Download plugin have progress status
This commit is contained in:
@@ -25,7 +25,6 @@ public class ApiManager
|
||||
AddEndpoint(new PluginListEndpoint());
|
||||
AddEndpoint(new PluginListInstalledEndpoint());
|
||||
AddEndpoint(new PluginInstallEndpoint());
|
||||
AddEndpoint(new PluginInstallGetProgressEndpoint());
|
||||
|
||||
AddEndpoint(new SettingsChangeEndpoint());
|
||||
AddEndpoint(new SettingsGetEndpoint());
|
||||
|
||||
@@ -23,7 +23,7 @@ public class PluginInstallEndpoint : IEndpoint
|
||||
return ApiResponse.Fail("Plugin not found.");
|
||||
}
|
||||
|
||||
await Application.CurrentApplication.PluginManager.InstallPluginWithNoProgress(pluginInfo);
|
||||
Application.CurrentApplication.PluginManager.InstallPluginWithNoProgress(pluginInfo);
|
||||
return ApiResponse.Ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
using DiscordBotCore.Interfaces.API;
|
||||
using DiscordBotCore.Others;
|
||||
|
||||
namespace DiscordBotCore.API.Endpoints.PluginManagement;
|
||||
|
||||
public class PluginInstallGetProgressEndpoint : IEndpoint
|
||||
{
|
||||
public string Path => "/api/plugin/install/progress";
|
||||
public EndpointType HttpMethod => EndpointType.Get;
|
||||
public async Task<ApiResponse> HandleRequest(string? jsonRequest)
|
||||
{
|
||||
if (!Application.CurrentApplication.PluginManager.InstallingPluginInformation.IsInstalling)
|
||||
{
|
||||
return ApiResponse.Fail("No plugin is currently being installed.");
|
||||
}
|
||||
|
||||
var progress = Application.CurrentApplication.PluginManager.InstallingPluginInformation.InstallationProgress;
|
||||
string stringProgress = progress.ToString(CultureInfo.InvariantCulture);
|
||||
var response = new Dictionary<string, string>
|
||||
{
|
||||
{"progress", stringProgress},
|
||||
{"pluginName", Application.CurrentApplication.PluginManager.InstallingPluginInformation.PluginName}
|
||||
};
|
||||
return ApiResponse.From(await JsonManager.ConvertToJsonString(response), true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user