2024-05-06 14:33:44 +02:00
|
|
|
|
using BTCPayServer.App;
|
|
|
|
|
using BTCPayServer.Lightning;
|
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
2023-07-03 09:56:00 +02:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
|
|
|
|
namespace BTCPayServer.Controllers;
|
|
|
|
|
|
|
|
|
|
public static class BTCPayAppExtensions
|
|
|
|
|
{
|
|
|
|
|
public static IServiceCollection AddBTCPayApp(this IServiceCollection serviceCollection)
|
|
|
|
|
{
|
2023-08-17 15:03:37 +02:00
|
|
|
|
serviceCollection.AddSingleton<BTCPayAppState>();
|
2024-05-06 14:33:44 +02:00
|
|
|
|
serviceCollection.AddSingleton<ILightningConnectionStringHandler, BTCPayAppLightningConnectionStringHandler>();
|
2023-08-17 15:03:37 +02:00
|
|
|
|
serviceCollection.AddHostedService(serviceProvider => serviceProvider.GetRequiredService<BTCPayAppState>());
|
2023-07-03 09:56:00 +02:00
|
|
|
|
return serviceCollection;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void UseBTCPayApp(this IApplicationBuilder builder)
|
|
|
|
|
{
|
|
|
|
|
builder.UseEndpoints(routeBuilder =>
|
|
|
|
|
{
|
|
|
|
|
routeBuilder.MapHub<BTCPayAppHub>("hub/btcpayapp");
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-08-17 15:03:37 +02:00
|
|
|
|
}
|