zapper for the zaps

This commit is contained in:
Kukks
2023-09-15 12:58:28 +02:00
parent cdbf4ccc21
commit feae3e6253
3 changed files with 26 additions and 22 deletions

View File

@@ -11,7 +11,7 @@
<PropertyGroup> <PropertyGroup>
<Product>Nostr </Product> <Product>Nostr </Product>
<Description>Allows you to verify your nostr account with NIP5 and zap like the rest of the crazies</Description> <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> </PropertyGroup>
<!-- Plugin development properties --> <!-- Plugin development properties -->
<PropertyGroup> <PropertyGroup>

View File

@@ -36,7 +36,7 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label asp-for="PrivateKey" class="form-label">Private key for zaps</label> <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> <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> <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> </div>

View File

@@ -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); 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.
catch (TaskCanceledException e) //but people need their instant gratification so we removed it.
{ // var waitingToken = CancellationTokenSource.CreateLinkedTokenSource();
break; // 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;
// }
// }
// }
} }
} }