mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-26 23:49:57 +01:00
* 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
42 lines
1.8 KiB
C#
42 lines
1.8 KiB
C#
#if ALTCOINS
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using BTCPayServer.Contracts;
|
|
using BTCPayServer.HostedServices;
|
|
using BTCPayServer.Payments;
|
|
using BTCPayServer.Services.Altcoins.Ethereum.Payments;
|
|
using BTCPayServer.Services.Altcoins.Ethereum.Services;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
namespace BTCPayServer.Services.Altcoins.Ethereum
|
|
{
|
|
public static class EthereumLikeExtensions
|
|
{
|
|
public const string EthereumInvoiceCheckHttpClient = "EthereumCheck";
|
|
public const string EthereumInvoiceCreateHttpClient = "EthereumCreate";
|
|
public static IServiceCollection AddEthereumLike(this IServiceCollection serviceCollection)
|
|
{
|
|
serviceCollection.AddSingleton<EthereumService>();
|
|
serviceCollection.AddSingleton<IHostedService, EthereumService>(provider => provider.GetService<EthereumService>());
|
|
serviceCollection.AddSingleton<EthereumLikePaymentMethodHandler>();
|
|
serviceCollection.AddSingleton<IPaymentMethodHandler>(provider => provider.GetService<EthereumLikePaymentMethodHandler>());
|
|
|
|
serviceCollection.AddSingleton<IUIExtension>(new UIExtension("Ethereum/StoreNavEthereumExtension", "store-nav"));
|
|
serviceCollection.AddTransient<NoRedirectHttpClientHandler>();
|
|
serviceCollection.AddSingleton<ISyncSummaryProvider, EthereumSyncSummaryProvider>();
|
|
serviceCollection.AddHttpClient(EthereumInvoiceCreateHttpClient)
|
|
.ConfigurePrimaryHttpMessageHandler<NoRedirectHttpClientHandler>();
|
|
return serviceCollection;
|
|
}
|
|
}
|
|
|
|
public class NoRedirectHttpClientHandler : HttpClientHandler
|
|
{
|
|
public NoRedirectHttpClientHandler()
|
|
{
|
|
this.AllowAutoRedirect = false;
|
|
}
|
|
}
|
|
}
|
|
#endif
|