mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-18 08:04:26 +01:00
fix
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
<ProjectReference Include="..\..\submodules\btcpayserver\BTCPayServer\BTCPayServer.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NNostr.Client" Version="0.0.27" />
|
||||
<PackageReference Include="NNostr.Client" Version="0.0.28" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources" />
|
||||
|
||||
@@ -114,8 +114,7 @@ public class Zapper : IHostedService
|
||||
var cts = new CancellationTokenSource();
|
||||
cts.CancelAfter(TimeSpan.FromSeconds(30));
|
||||
using var c = new NostrClient(new Uri(relay.Key));
|
||||
_ = c.Connect(cts.Token);
|
||||
await c.WaitUntilConnected(cts.Token);
|
||||
await c.Connect(cts.Token);
|
||||
await c.SendEventsAndWaitUntilReceived(relay.Value, cts.Token);
|
||||
await c.Disconnect();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.WebSockets;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -31,9 +32,14 @@ public class Nostr
|
||||
var ct = CancellationTokenSource
|
||||
.CreateLinkedTokenSource(cancellationToken, new CancellationTokenSource(TimeSpan.FromMinutes(1)).Token)
|
||||
.Token;
|
||||
var client = new NostrClient(relayUri, socket => socket.Options.Proxy = httpClientHandler?.Proxy);
|
||||
_ = client.Connect(ct);
|
||||
await client.WaitUntilConnected(ct);
|
||||
var client = new NostrClient(relayUri, socket =>
|
||||
{
|
||||
if (socket is ClientWebSocket clientWebSocket && httpClientHandler != null)
|
||||
{
|
||||
clientWebSocket.Options.Proxy = httpClientHandler.Proxy;
|
||||
}
|
||||
});
|
||||
await client.Connect(ct);
|
||||
|
||||
await client.SendEventsAndWaitUntilReceived(evts, ct);
|
||||
client.Dispose();
|
||||
@@ -69,14 +75,19 @@ public class Nostr
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
var nostrClient = new NostrClient(relayUri, socket => socket.Options.Proxy = relayUri.IsLocalNetwork()? null: httpClientHandler?.Proxy);
|
||||
var nostrClient = new NostrClient(relayUri, socket =>
|
||||
{
|
||||
if (socket is ClientWebSocket clientWebSocket && httpClientHandler != null)
|
||||
{
|
||||
clientWebSocket.Options.Proxy = httpClientHandler.Proxy;
|
||||
}
|
||||
});
|
||||
var result = new List<NostrEvent>();
|
||||
var network = currentNetwork.Name.ToLower();
|
||||
|
||||
var cts = CancellationTokenSource.CreateLinkedTokenSource(new CancellationTokenSource(TimeSpan.FromMinutes(1)).Token,
|
||||
cancellationToken);
|
||||
_ = nostrClient.Connect(cts.Token);
|
||||
await nostrClient.WaitUntilConnected(cts.Token);
|
||||
await nostrClient.Connect(cts.Token);
|
||||
|
||||
result = await nostrClient.SubscribeForEvents(
|
||||
new[]
|
||||
|
||||
@@ -47,7 +47,7 @@ public class NostrWabisabiApiServer: IHostedService
|
||||
_ = _client.ListenForMessages();
|
||||
var filter = new NostrSubscriptionFilter()
|
||||
{
|
||||
PublicKey = new[] {_coordinatorKey.ToHex()},
|
||||
ReferencedPublicKeys = new[] {_coordinatorKey.ToHex()},
|
||||
Kinds = new[] { CommunicationKind},
|
||||
Since = DateTimeOffset.UtcNow.Subtract(TimeSpan.FromHours(1))
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user