mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2026-02-18 06:04:29 +01:00
update nostr components
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.0.12</Version>
|
||||
<Version>1.0.13</Version>
|
||||
</PropertyGroup>
|
||||
<!-- Plugin development properties -->
|
||||
<PropertyGroup>
|
||||
@@ -35,7 +35,7 @@
|
||||
<ProjectReference Include="..\..\submodules\btcpayserver\BTCPayServer\BTCPayServer.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NNostr.Client" Version="0.0.25" />
|
||||
<PackageReference Include="NNostr.Client" Version="0.0.27" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources" />
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NNostr.Client" Version="0.0.25" />
|
||||
<PackageReference Include="NNostr.Client" Version="0.0.27" />
|
||||
<PackageReference Include="WabiSabi" Version="1.0.1.2" />
|
||||
</ItemGroup>
|
||||
<Target Name="DeleteExampleFile" AfterTargets="Publish">
|
||||
|
||||
@@ -209,12 +209,10 @@ public class WabisabiCoordinatorService : PeriodicRunner
|
||||
if (s.Enabled && !string.IsNullOrEmpty(s.NostrIdentity) && s.NostrRelay is not null &&
|
||||
s.UriToAdvertise is not null)
|
||||
{
|
||||
|
||||
var uri = new Uri(s.UriToAdvertise, "plugins/wabisabi-coordinator/wabisabi");
|
||||
await Nostr.Publish(s.NostrRelay,
|
||||
new[]
|
||||
{
|
||||
await Nostr.CreateCoordinatorDiscoveryEvent(network, s.NostrIdentity, uri,
|
||||
await Nostr.CreateCoordinatorDiscoveryEvent(network, s.NostrIdentity, s.UriToAdvertise,
|
||||
s.CoordinatorDescription)
|
||||
},s.UriToAdvertise.IsOnion()? _socks5HttpClientHandler: null, cancel);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public class WabisabiCoordinatorSettings
|
||||
public bool Enabled { get; set; } = false;
|
||||
|
||||
public string NostrIdentity { get; set; }
|
||||
public Uri NostrRelay { get; set; } = new Uri("wss://nostr.mutinywallet.com");
|
||||
public Uri NostrRelay { get; set; } = new Uri("wss://kukks.org/nostr");
|
||||
|
||||
public List<DiscoveredCoordinator> DiscoveredCoordinators { get; set; } = new();
|
||||
|
||||
|
||||
@@ -73,45 +73,28 @@ public class Nostr
|
||||
{
|
||||
|
||||
var nostrClient = new NostrClient(relayUri, socket => socket.Options.Proxy = relayUri.IsLocalNetwork()? null: httpClientHandler?.Proxy);
|
||||
Stopwatch stopwatch = new();
|
||||
var result = new List<NostrEvent>();
|
||||
var tcs = new TaskCompletionSource();
|
||||
nostrClient.EoseReceived += (sender, s) =>
|
||||
{
|
||||
tcs.SetResult();
|
||||
};
|
||||
nostrClient.EventsReceived += (sender, tuple) =>
|
||||
{
|
||||
stopwatch.Restart();
|
||||
result.AddRange(tuple.events);
|
||||
};
|
||||
|
||||
var network = currentNetwork.Name.ToLower();
|
||||
var cts = new CancellationTokenSource(TimeSpan.FromMinutes(1));
|
||||
|
||||
var cts = CancellationTokenSource.CreateLinkedTokenSource(new CancellationTokenSource(TimeSpan.FromMinutes(1)).Token,
|
||||
cancellationToken);
|
||||
_ = nostrClient.Connect(cts.Token);
|
||||
await nostrClient.WaitUntilConnected(cts.Token);
|
||||
await nostrClient.CreateSubscription("nostr-wabisabi-coordinators",
|
||||
|
||||
result = await nostrClient.SubscribeForEvents(
|
||||
new[]
|
||||
{
|
||||
new NostrSubscriptionFilter()
|
||||
{
|
||||
Kinds = new[] {Kind},
|
||||
Kinds = new[] {Kind},
|
||||
Since = DateTimeOffset.UtcNow.Subtract(TimeSpan.FromHours(1)),
|
||||
ExtensionData = new Dictionary<string, JsonElement>()
|
||||
{
|
||||
["#type"] = JsonSerializer.SerializeToElement(new []{TypeTagValue}),
|
||||
["#network"] = JsonSerializer.SerializeToElement(new []{network})
|
||||
["#type"] = JsonSerializer.SerializeToElement(new[] {TypeTagValue}),
|
||||
["#network"] = JsonSerializer.SerializeToElement(new[] {network})
|
||||
}
|
||||
}
|
||||
}, cancellationToken);
|
||||
stopwatch.Start();
|
||||
|
||||
|
||||
while (!tcs.Task.IsCompleted && !cts.IsCancellationRequested &&
|
||||
stopwatch.ElapsedMilliseconds < 10000)
|
||||
{
|
||||
await Task.Delay(1000, cts.Token);
|
||||
}
|
||||
}, true, cts.Token).ToListAsync();
|
||||
|
||||
nostrClient.Dispose();
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Nostr Relay</label>
|
||||
<input type="url" class="form-control" asp-for="Relay" required="required">
|
||||
<input type="url" class="form-control" asp-for="Relay" required="required" value="wss://kukks.org/nostr">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -73,6 +73,7 @@ namespace BTCPayServer.Plugins.Wabisabi
|
||||
}
|
||||
|
||||
[HttpGet("")]
|
||||
[HttpGet("add-coordinator")]
|
||||
public async Task<IActionResult> UpdateWabisabiStoreSettings(string storeId)
|
||||
{
|
||||
WabisabiStoreSettings Wabisabi = null;
|
||||
@@ -132,7 +133,6 @@ namespace BTCPayServer.Plugins.Wabisabi
|
||||
}
|
||||
|
||||
return View(vm);
|
||||
break;
|
||||
case "check":
|
||||
await _walletProvider.Check(storeId, CancellationToken.None);
|
||||
TempData["SuccessMessage"] = "Store wallet re-checked";
|
||||
|
||||
Reference in New Issue
Block a user