Example #1
0
        public async Task <IActionResult> ListExtensions(
            [FromServices] ExtensionService extensionService,
            [FromServices] BTCPayServerOptions btcPayServerOptions,
            string remote = "btcpayserver/btcpayserver-extensions")
        {
            IEnumerable <ExtensionService.AvailableExtension> availableExtensions;

            try
            {
                availableExtensions = await extensionService.GetRemoteExtensions(remote);
            }
            catch (Exception e)
            {
                TempData.SetStatusMessageModel(new StatusMessageModel()
                {
                    Severity = StatusMessageModel.StatusSeverity.Error,
                    Message  = "The remote could not be reached"
                });
                availableExtensions = Array.Empty <ExtensionService.AvailableExtension>();
            }
            var res = new ListExtensionsViewModel()
            {
                Installed      = extensionService.LoadedExtensions,
                Available      = availableExtensions,
                Remote         = remote,
                Commands       = extensionService.GetPendingCommands(),
                CanShowRestart = btcPayServerOptions.DockerDeployment
            };

            return(View(res));
        }