mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 14:04:26 +01:00
Plugins: Recommended plugins and github Remote config options (#2045)
This allows external integrations ( btcpay docker fragments) to highlight specific plugins as recommended to be installed. Also moved the remote option to a config option instead of a url query param to avoid messy situations where users could get deceived with a generated url. The dockerfiles also have an additional csproj to build and the plugin dir was renamed correctly from extensions to plugins
This commit is contained in:
@@ -16,13 +16,12 @@ namespace BTCPayServer.Controllers
|
||||
[HttpGet("server/plugins")]
|
||||
public async Task<IActionResult> ListPlugins(
|
||||
[FromServices] PluginService pluginService,
|
||||
[FromServices] BTCPayServerOptions btcPayServerOptions,
|
||||
string remote = "btcpayserver/btcpayserver-plugins")
|
||||
[FromServices] BTCPayServerOptions btcPayServerOptions)
|
||||
{
|
||||
IEnumerable<PluginService.AvailablePlugin> availablePlugins;
|
||||
try
|
||||
{
|
||||
availablePlugins = await pluginService.GetRemotePlugins(remote);
|
||||
availablePlugins = await pluginService.GetRemotePlugins();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -37,7 +36,6 @@ namespace BTCPayServer.Controllers
|
||||
{
|
||||
Installed = pluginService.LoadedPlugins,
|
||||
Available = availablePlugins,
|
||||
Remote = remote,
|
||||
Commands = pluginService.GetPendingCommands(),
|
||||
CanShowRestart = btcPayServerOptions.DockerDeployment
|
||||
};
|
||||
@@ -46,7 +44,6 @@ namespace BTCPayServer.Controllers
|
||||
|
||||
public class ListPluginsViewModel
|
||||
{
|
||||
public string Remote { get; set; }
|
||||
public IEnumerable<IBTCPayServerPlugin> Installed { get; set; }
|
||||
public IEnumerable<PluginService.AvailablePlugin> Available { get; set; }
|
||||
public (string command, string plugin)[] Commands { get; set; }
|
||||
@@ -82,11 +79,11 @@ namespace BTCPayServer.Controllers
|
||||
|
||||
[HttpPost("server/plugins/install")]
|
||||
public async Task<IActionResult> InstallPlugin(
|
||||
[FromServices] PluginService pluginService, string remote, string plugin)
|
||||
[FromServices] PluginService pluginService, string plugin)
|
||||
{
|
||||
try
|
||||
{
|
||||
await pluginService.DownloadRemotePlugin(remote, plugin);
|
||||
await pluginService.DownloadRemotePlugin(plugin);
|
||||
pluginService.InstallPlugin(plugin);
|
||||
TempData.SetStatusMessageModel(new StatusMessageModel()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user