mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-17 07:34:24 +01:00
zapper for the zaps
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<PropertyGroup>
|
||||
<Product>Nostr </Product>
|
||||
<Description>Allows you to verify your nostr account with NIP5 and zap like the rest of the crazies</Description>
|
||||
<Version>1.1.0</Version>
|
||||
<Version>1.1.1</Version>
|
||||
</PropertyGroup>
|
||||
<!-- Plugin development properties -->
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="PrivateKey" class="form-label">Private key for zaps</label>
|
||||
<input asp-for="PrivateKey" class="form-control" type="password"/>
|
||||
<input asp-for="PrivateKey" class="form-control" type="password" value="@Model.PrivateKey"/>
|
||||
<span asp-validation-for="PrivateKey" class="text-danger"></span>
|
||||
<p class="text-muted pt-2">OPTIONALLY, provide the private key to your pubkey so that zaps are signed directly by you as proof of receipt. Supports hex and nsec. Will be converted to hex once saved. </p>
|
||||
</div>
|
||||
|
||||
@@ -136,27 +136,31 @@ public class Zapper : IHostedService
|
||||
|
||||
|
||||
}
|
||||
var waitingToken = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
|
||||
waitingToken.CancelAfter(TimeSpan.FromMinutes(2));
|
||||
while (!waitingToken.IsCancellationRequested)
|
||||
{
|
||||
if (_pendingZapEvents.Count > 10)
|
||||
{
|
||||
waitingToken.Cancel();
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
await Task.Delay(100, waitingToken.Token);
|
||||
}
|
||||
catch (TaskCanceledException e)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
|
||||
//we used to have some waiting logic so that we dont open a websocket to every relay for every individual zap only.
|
||||
//but people need their instant gratification so we removed it.
|
||||
// var waitingToken = CancellationTokenSource.CreateLinkedTokenSource();
|
||||
// waitingToken.CancelAfter(TimeSpan.FromSeconds(5));
|
||||
// while (!waitingToken.IsCancellationRequested)
|
||||
// {
|
||||
// if (_pendingZapEvents.Count > 10)
|
||||
// {
|
||||
// waitingToken.Cancel();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
//
|
||||
// await Task.Delay(100, waitingToken.Token);
|
||||
// }
|
||||
// catch (TaskCanceledException e)
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user