mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Issue 6918 re enable plugin (#6930)
* Added the enable button on disabled plugins * Added the disable function and button for installed plugins * Changes based on the coderabbitai comments * Removed markers and added the disable in the same if block as the unistall * Hide the uninstall button when plugin is queued for enabling * Removed the duplicate enale function * Removed the disable button for installed plugins * Removed the disableplugin functions as they are no longer needed * Trigger CI pipeline after dotnet restore * reverted the git ignore
This commit is contained in:
@@ -86,6 +86,20 @@ namespace BTCPayServer.Controllers
|
|||||||
return RedirectToAction("ListPlugins");
|
return RedirectToAction("ListPlugins");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost("server/plugins/enable")]
|
||||||
|
public IActionResult EnablePlugin(
|
||||||
|
[FromServices] PluginService pluginService, string plugin)
|
||||||
|
{
|
||||||
|
pluginService.EnablePlugin(plugin);
|
||||||
|
TempData.SetStatusMessageModel(new StatusMessageModel
|
||||||
|
{
|
||||||
|
Message = StringLocalizer["Plugin scheduled to be enabled."].Value,
|
||||||
|
Severity = StatusMessageModel.StatusSeverity.Success
|
||||||
|
});
|
||||||
|
|
||||||
|
return RedirectToAction("ListPlugins");
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost("server/plugins/cancel")]
|
[HttpPost("server/plugins/cancel")]
|
||||||
public IActionResult CancelPluginCommands(
|
public IActionResult CancelPluginCommands(
|
||||||
[FromServices] PluginService pluginService, string plugin)
|
[FromServices] PluginService pluginService, string plugin)
|
||||||
|
|||||||
@@ -491,6 +491,7 @@ namespace BTCPayServer.Plugins
|
|||||||
QueueCommands(pluginDir, ("disable", plugin));
|
QueueCommands(pluginDir, ("disable", plugin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Loads the list of disabled plugins from the file
|
// Loads the list of disabled plugins from the file
|
||||||
private static HashSet<string> GetDisabledPluginIdentifiers(string pluginsFolder)
|
private static HashSet<string> GetDisabledPluginIdentifiers(string pluginsFolder)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -188,6 +188,10 @@ namespace BTCPayServer.Plugins
|
|||||||
PluginManager.QueueCommands(dest, ("delete", plugin));
|
PluginManager.QueueCommands(dest, ("delete", plugin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void EnablePlugin(string plugin){
|
||||||
|
PluginManager.QueueCommands(_dataDirectories.Value.PluginDir, ("enable", plugin));
|
||||||
|
}
|
||||||
|
|
||||||
public class AvailablePlugin
|
public class AvailablePlugin
|
||||||
{
|
{
|
||||||
public string Identifier { get; set; }
|
public string Identifier { get; set; }
|
||||||
|
|||||||
@@ -904,6 +904,7 @@ namespace BTCPayServer.Services
|
|||||||
"Mark as seen": "",
|
"Mark as seen": "",
|
||||||
"Mark as settled": "",
|
"Mark as settled": "",
|
||||||
"Marked for deletion": "",
|
"Marked for deletion": "",
|
||||||
|
"Marked for enabling": "",
|
||||||
"Master fingerprint": "",
|
"Master fingerprint": "",
|
||||||
"Max": "",
|
"Max": "",
|
||||||
"Max sats": "",
|
"Max sats": "",
|
||||||
@@ -1143,6 +1144,7 @@ namespace BTCPayServer.Services
|
|||||||
"Please, confirm on the device first...": "",
|
"Please, confirm on the device first...": "",
|
||||||
"Please, enter the passphrase on the device.": "",
|
"Please, enter the passphrase on the device.": "",
|
||||||
"Plugin action cancelled.": "",
|
"Plugin action cancelled.": "",
|
||||||
|
"Plugin scheduled to be enabled.": "",
|
||||||
"Plugin scheduled to be installed.": "",
|
"Plugin scheduled to be installed.": "",
|
||||||
"Plugin scheduled to be uninstalled.": "",
|
"Plugin scheduled to be uninstalled.": "",
|
||||||
"Plugin server": "",
|
"Plugin server": "",
|
||||||
|
|||||||
@@ -103,17 +103,31 @@
|
|||||||
</span>
|
</span>
|
||||||
@{
|
@{
|
||||||
var uninstalled = Model.Commands.Any(c => c.plugin == plugin && c.command == "delete");
|
var uninstalled = Model.Commands.Any(c => c.plugin == plugin && c.command == "delete");
|
||||||
|
var enabled = Model.Commands.Any(c => c.plugin == plugin && c.command == "enable");
|
||||||
}
|
}
|
||||||
<form asp-action="UnInstallPlugin" asp-route-plugin="@plugin">
|
<div class="d-flex gap-2">
|
||||||
@if (uninstalled)
|
<form asp-action="EnablePlugin" asp-route-plugin="@plugin">
|
||||||
{
|
@if (enabled)
|
||||||
<button type="submit" class="btn btn-sm btn-outline-danger" disabled text-translate="true">Marked for deletion</button>
|
{
|
||||||
}
|
<button type="submit" class="btn btn-sm btn-outline-primary" disabled text-translate="true">Marked for enabling</button>
|
||||||
else
|
}
|
||||||
{
|
else if (!uninstalled)
|
||||||
<button type="submit" class="btn btn-sm btn-outline-danger" text-translate="true">Uninstall</button>
|
{
|
||||||
}
|
<button type="submit" class="btn btn-sm btn-outline-primary" text-translate="true">Enable</button>
|
||||||
</form>
|
}
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form asp-action="UnInstallPlugin" asp-route-plugin="@plugin">
|
||||||
|
@if (uninstalled)
|
||||||
|
{
|
||||||
|
<button type="submit" class="btn btn-sm btn-outline-danger" disabled text-translate="true">Marked for deletion</button>
|
||||||
|
}
|
||||||
|
else if (!enabled)
|
||||||
|
{
|
||||||
|
<button type="submit" class="btn btn-sm btn-outline-danger" text-translate="true">Uninstall</button>
|
||||||
|
}
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
@@ -287,6 +301,8 @@
|
|||||||
</form>
|
</form>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@if (DependentOn(plugin.Identifier))
|
@if (DependentOn(plugin.Identifier))
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-outline-danger d-flex align-items-center gap-3" data-bs-toggle="tooltip" title="This plugin cannot be uninstalled as it is depended on by other plugins.">
|
<button type="button" class="btn btn-outline-danger d-flex align-items-center gap-3" data-bs-toggle="tooltip" title="This plugin cannot be uninstalled as it is depended on by other plugins.">
|
||||||
|
|||||||
Reference in New Issue
Block a user