39 Commits

Author SHA1 Message Date
monicamuyama
5a487985f4 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
2025-11-21 05:23:12 -06:00
Nicolas Dorier
e002f59f4c Tests: All plugin integration tests to resolve plugin's types
Reported by @napoly

In an integration test for a plugin, attempt to resolve a type provided by that plugin using `BTCPayServerTester`.

For example:
```
tester.GetService<MoneroRPCProvider>();
```

The type should be resolved successfully.

The type fails to resolve.

During the test run, the dotnet runtime attempts to load `MoneroRPCProvider` in the default load context (`AssemblyLoadContext.Default`). It locates the plugin assembly in the test directory and loads it there.

In contrast, when BTCPay Server loads a plugin, it creates a dedicated plugin load context, and the plugin’s `MoneroRPCProvider` is loaded inside that context. This results in two distinct `MoneroRPCProvider` types: one in the default context and one in the plugin context.

This PR forces the plugin context, during integration tests, to load the types it resolves into the default assembly context rather than its own. This prevents duplicate type definitions.

As a side effect, behavior may differ slightly between running BTCPay Server normally and running tests, but this should be acceptable in most cases.

Relevant discussion: #6851
2025-11-21 09:11:01 +09:00
Nicolas Dorier
894643c5a3 Fix: When running more than one test in a test run, only the first would load plugins correctly (#6985)
Reported by @napoly.

## Actual behavior

Two tests were created. When we would run the tests through the runner,
ASP.NET wouldn't find the registered view of the plugin.

## Expected behavior

The second test should works find, ASP.NET should properly find the
views of the plugin when there are more than one test in the same test
run.

## Cause

If we detected that a plugin assemly was already in the AppDomain, then
we were not loading the ApplicationParts of such assembly.
This wasn't the case for the first test run, but would be after.

The reason for initially doing this was that long time ago, we would
test plugins by referencing them from BTCPaySevrer project. But since
this is not how we are doing things anymore, I think it is safe to
remove this "Feature".
This feature was broken anyway since we started loading plugins in their
own context, but this wouldn't happen with the old way of referencing
plugins from BTCPayServer. (#6851)
2025-11-12 00:15:31 +09:00
nicolas.dorier
7273e9953f Installing a plugin should install all plugin dependencies 2025-07-19 13:09:18 +09:00
Nicolas Dorier
e77d785358 Plugins can load assemblies from their dependent plugins (#6851) 2025-07-17 22:38:40 +09:00
Dennis Reimann
cdf7cbfeb7 Plugins: Convert relative to absolute path when loading a plugin
Avoids having to provide absolute paths, which differ across machines. We use this for the app to [reference the app plugin](https://github.com/btcpayserver/btcpayserver/blob/mobile-working-branch/BTCPayServer/Properties/launchSettings.json#L7) in the launch settings.
2025-01-21 10:33:56 +01:00
jackstar12
c6fc0302d2 fix: correct < plugin dependency implementation (#6420)
was wrongly implemented using >=
2024-11-22 10:17:16 +01:00
nicolas.dorier
511e90efd1 Disable plugins crashing at startup 2024-10-11 10:50:49 +09:00
Nicolas Dorier
c56b660c92 bump selenium container (#6071) 2024-06-28 17:32:55 +09:00
Andrew Camilleri
a753698ae7 Various plugin fixes (#5577)
* Fix: Plugin updates do not work

* Offer install on disabled plugins when different version

This will:
* Clear any previous pending actions of a plugin if you click uninstall
* Show the plugin version that was disabled
* Show an update button on disabled plugins instead of install
* if a plugin is scheduled to be installed/updated, it will show which version was scheduled to be updated. If a newer version if available than the scheduled one, it will show an option to switch to that

* Ensure disabled plugins don't get loaded

* View fixes

---------

Co-authored-by: d11n <mail@dennisreimann.de>
2024-01-18 17:15:16 +09:00
nicolas.dorier
0b0a8f8218 Fix: BTCPay Server fails to start the first time when installing a new plugin (#5595) 2024-01-17 19:26:22 +09:00
Kukks
6ecfe073e7 disable cj plugin on next btcpay release 2023-12-19 12:58:52 +01:00
Andrew Camilleri
7a06423bc7 Allow scheduling installs/updates of future plugins (#5537)
Co-authored-by: Dennis Reimann <mail@dennisreimann.de>
2023-12-13 12:36:23 +01:00
Nicolas Dorier
04292d09e1 Pluginify BTCPayNetworkProvider (#5331) 2023-11-29 18:51:40 +09:00
d11n
4023b24209 Plugins: Improve crash detection on startup and hint at disabled plugins (#5514) 2023-11-28 15:19:47 +01:00
nicolas.dorier
66a064e78b Disable prism if old version 2023-09-22 23:43:06 +09:00
nicolas.dorier
7546ef7a8e Dotnet reformat 2023-04-10 11:07:03 +09:00
Andrew Camilleri
85513aa5c3 Make NFC built in (#4541)
* Make NFC built int

* support checkout v2

* uninstall old plugin

* fix lnurl in unified checkout

* fix tests

* fix tests

* fix old checkout unified qr

* clean up and make nfc submission more sturdy

* support topup invoices for lnurlw

* fix test

* Payment URI fixes

* Fix LNURL exclusion cases

* UI updates

* Adapt test

---------

Co-authored-by: Dennis Reimann <mail@dennisreimann.de>
2023-02-08 15:47:38 +09:00
nicolas.dorier
248401f534 Plugin assemblies shouldn't be unloadable 2023-01-18 16:46:08 +09:00
Nicolas Dorier
1228a06a90 Improve detection of plugin bricking an install on startup (#4533) 2023-01-18 14:15:27 +09:00
nicolas.dorier
ee70fe85c0 Fix loading of plugins in the plugin directory 2023-01-16 16:31:26 +09:00
Nicolas Dorier
2e31816979 Can load external plugins during dev to debug more easily (#4518)
* Can load external plugins during dev to debug more easily

* Add again load plugin by project reference

* Make sure we don't load same plugin twice
2023-01-16 10:37:17 +09:00
Nicolas Dorier
e2c5e2c7fb Remove system plugins from the plugin list (#4429) 2022-12-13 18:54:41 +09:00
Kukks
e201ddd74c Plugins: Fix plugin installer 2022-04-01 13:20:19 +02:00
Nicolas Dorier
04b8eafacb Run dotnet format (#3244) 2021-12-31 16:59:02 +09:00
Kukks
d949680d5a fix: Plugins disabled message never dissappers even after re-enabling it. 2021-09-27 09:03:59 +02:00
Kukks
4e56ef636b Make system plugins shown as system plugins
fixes #2741
2021-08-04 16:50:25 +02:00
Kukks
060fc46e4f Fix system plugins resource loading 2021-07-08 12:53:34 +02:00
Kukks
86092fc955 Wrap more plugin loading logic in try catch to not crash fatally 2021-05-03 08:35:54 +02:00
Andrew Camilleri
4e1b18e2bb do not crash invoice if wellknown metadata keys used with different e… (#2448)
* do not crash invoice if wellknown metadata keys used with different expected types

* fix

* add bits from alt PR
2021-04-28 16:49:10 +09:00
Kukks
1ada87ca31 Fix: Do not crash if plugin folder mismatches plugin identifier 2021-04-20 08:38:37 +02:00
nicolas.dorier
98eee27b93 Remove warnings 2021-04-13 17:06:11 +09:00
Andrew Camilleri
6ead5c3800 Plugin FailSafe (#2351)
This introduces the concept of plugins being disabled in the case of an unrecoverable runtime error caused by a plugin.
2021-04-01 12:27:22 +09:00
Kukks
9300326483 Remove Max body request size
Upload limit by kestrel restricts plugin upload of 30mb+. this removes that limit
2021-02-15 13:42:08 +01:00
Andrew Camilleri
58d01738ab More Options refactoring (#2179)
* More Options refactoring

Continues refactoring config classes to use the propert Options pattern where possible.
DataDirectories and DatabaseOptions are now configured the Options pattern and the BTCPayOptions is now moved alongside the other config setup

* Move COnfigure logic for Options to the Startup
2021-01-06 23:51:13 +09:00
Nicolas Dorier
a6ee64ea63 Remove DB and Directory settings out of the BTCPayServerOptions (#2168) 2020-12-27 22:06:00 +09:00
Kukks
179520a211 Plugins: Allow creation of independent DbContexts
This allows plugins to create custom dbcontexts, which would be namespaced in the scheme with a prefix. Migrations are supported too and the table would be prefixed too
2020-11-18 12:27:26 +01:00
Andrew Camilleri
31738c465d Plugins: Load plugins by order, aesthetic plugin dependency system (#2020)
* Plugins: Load plugins by order, aesthetic plugin dependency system

Introduces plugins loading in order of installation, BTCPay itself shows up as a system plugin, and that plugins can define other plugins as dependencies.

* use a proper type for plugin dependencies

* rebase fixes

* message when cannot install
2020-11-05 15:43:14 +01:00
Andrew Camilleri
5979fe5eef BTCPay Extensions Part 2 (#2001)
* BTCPay Extensions Part 2

This PR cleans up the extension system a bit in that:
 * It renames the test extension to a more uniform name
 * Allows yo uto have system extensions, which are extensions but bundled by default with the release (and cannot be removed)
 * Adds a tool to help you generate an extension package from a csproj
 * Refactors the UI extension points to a view component
 * Moves some more interfaces to the Abstractions csproj

* Rename to plugins
2020-10-21 14:02:20 +02:00