mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-02-22 14:44:23 +01:00
cleanup
This commit is contained in:
@@ -22,11 +22,11 @@ namespace BTCPayServer.Hubs
|
||||
{
|
||||
public class CrowdfundHub: Hub
|
||||
{
|
||||
private readonly IServiceProvider _ServiceProvider;
|
||||
private readonly AppsPublicController _AppsPublicController;
|
||||
|
||||
public CrowdfundHub(IServiceProvider serviceProvider)
|
||||
public CrowdfundHub(AppsPublicController appsPublicController)
|
||||
{
|
||||
_ServiceProvider = serviceProvider;
|
||||
_AppsPublicController = appsPublicController;
|
||||
}
|
||||
public async Task ListenToCrowdfundApp(string appId)
|
||||
{
|
||||
@@ -42,16 +42,12 @@ namespace BTCPayServer.Hubs
|
||||
|
||||
public async Task CreateInvoice(ContributeToCrowdfund model)
|
||||
{
|
||||
using (var scope = _ServiceProvider.CreateScope())
|
||||
{
|
||||
var controller = scope.ServiceProvider.GetService<AppsPublicController>();
|
||||
model.RedirectToCheckout = false;
|
||||
controller.ControllerContext.HttpContext = Context.GetHttpContext();
|
||||
var result = await controller.ContributeToCrowdfund(Context.Items["app"].ToString(), model);
|
||||
_AppsPublicController.ControllerContext.HttpContext = Context.GetHttpContext();
|
||||
var result = await _AppsPublicController.ContributeToCrowdfund(Context.Items["app"].ToString(), model);
|
||||
await Clients.Caller.SendCoreAsync("InvoiceCreated", new[] {(result as OkObjectResult)?.Value.ToString()});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class CrowdfundHubStreamer
|
||||
@@ -155,7 +151,12 @@ namespace BTCPayServer.Hubs
|
||||
{
|
||||
_CacheTokens[appId].Cancel();
|
||||
}
|
||||
_HubContext.Clients.Group(appId).SendCoreAsync("InfoUpdated", Array.Empty<object>() );
|
||||
|
||||
GetCrowdfundInfo(appId).ContinueWith(task =>
|
||||
{
|
||||
_HubContext.Clients.Group(appId).SendCoreAsync("InfoUpdated", new object[]{ task.Result} );
|
||||
}, TaskScheduler.Default);
|
||||
|
||||
}
|
||||
|
||||
private static async Task<decimal> GetCurrentContributionAmount(InvoiceEntity[] invoices, string primaryCurrency,
|
||||
|
||||
@@ -77,7 +77,6 @@ addLoadEvent(function (ev) {
|
||||
self.thankYouModalOpen = true;
|
||||
};
|
||||
eventAggregator.$on("payment-received", function (amount, cryptoCode, type) {
|
||||
console.warn("AAAAAA", arguments);
|
||||
var onChain = type.toLowerCase() === "btclike";
|
||||
playRandomQuakeSound();
|
||||
fireworks();
|
||||
@@ -97,16 +96,17 @@ addLoadEvent(function (ev) {
|
||||
|
||||
});
|
||||
eventAggregator.$on("info-updated", function (model) {
|
||||
this.srvModel = model;
|
||||
console.warn("UPDATED", self.srvModel, arguments);
|
||||
self.srvModel = model;
|
||||
});
|
||||
eventAggregator.$on("connection-pending", function () {
|
||||
this.connectionStatus = "pending";
|
||||
self.connectionStatus = "pending";
|
||||
});
|
||||
eventAggregator.$on("connection-failed", function () {
|
||||
this.connectionStatus = "failed";
|
||||
self.connectionStatus = "failed";
|
||||
});
|
||||
eventAggregator.$on("connection-lost", function () {
|
||||
this.connectionStatus = "connection lost";
|
||||
self.connectionStatus = "connection lost";
|
||||
});
|
||||
this.updateComputed();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user