mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-16 23:24:25 +01:00
bump n
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<PropertyGroup>
|
||||
<Product>Nostr</Product>
|
||||
<Description>NIP5 addresses, Zap support, Nostr Wallet Connect Lightning support</Description>
|
||||
<Version>1.1.17</Version>
|
||||
<Version>1.1.18</Version>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
</PropertyGroup>
|
||||
<!-- Plugin development properties -->
|
||||
@@ -36,7 +36,7 @@
|
||||
<ProjectReference Include="..\..\submodules\btcpayserver\BTCPayServer\BTCPayServer.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NNostr.Client" Version="0.0.51" />
|
||||
<PackageReference Include="NNostr.Client" Version="0.0.54" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources" />
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using NNostr.Client;
|
||||
|
||||
namespace BTCPayServer.Plugins.NIP05;
|
||||
|
||||
public class NostrClientWrapper : IDisposable
|
||||
{
|
||||
public INostrClient Client { get; private set; }
|
||||
private int _usageCount = 0;
|
||||
private bool _isDisposed = false;
|
||||
private DateTimeOffset _lastUsed;
|
||||
|
||||
public NostrClientWrapper(INostrClient client)
|
||||
{
|
||||
Client = client;
|
||||
_lastUsed = DateTimeOffset.UtcNow;
|
||||
}
|
||||
|
||||
public void IncrementUsage()
|
||||
{
|
||||
_lastUsed = DateTimeOffset.UtcNow;
|
||||
Interlocked.Increment(ref _usageCount);
|
||||
}
|
||||
|
||||
public void DecrementUsage()
|
||||
{
|
||||
_lastUsed = DateTimeOffset.UtcNow;
|
||||
if (Interlocked.Decrement(ref _usageCount) == 0 && IsExpired())
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsExpired()
|
||||
{
|
||||
return DateTimeOffset.UtcNow - _lastUsed > TimeSpan.FromMinutes(5);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (!_isDisposed)
|
||||
{
|
||||
Client.Dispose();
|
||||
_isDisposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// using System;
|
||||
// using System.Threading;
|
||||
// using NNostr.Client;
|
||||
//
|
||||
// namespace BTCPayServer.Plugins.NIP05;
|
||||
//
|
||||
// public class NostrClientWrapper : IDisposable
|
||||
// {
|
||||
// public INostrClient Client { get; private set; }
|
||||
// private int _usageCount = 0;
|
||||
// private bool _isDisposed = false;
|
||||
// private DateTimeOffset _lastUsed;
|
||||
//
|
||||
// public NostrClientWrapper(INostrClient client)
|
||||
// {
|
||||
// Client = client;
|
||||
// _lastUsed = DateTimeOffset.UtcNow;
|
||||
// }
|
||||
//
|
||||
// public void IncrementUsage()
|
||||
// {
|
||||
// _lastUsed = DateTimeOffset.UtcNow;
|
||||
// Interlocked.Increment(ref _usageCount);
|
||||
// }
|
||||
//
|
||||
// public void DecrementUsage()
|
||||
// {
|
||||
// _lastUsed = DateTimeOffset.UtcNow;
|
||||
// if (Interlocked.Decrement(ref _usageCount) == 0 && IsExpired())
|
||||
// {
|
||||
// Dispose();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsExpired()
|
||||
// {
|
||||
// return DateTimeOffset.UtcNow - _lastUsed > TimeSpan.FromMinutes(5);
|
||||
// }
|
||||
//
|
||||
// public void Dispose()
|
||||
// {
|
||||
// if (!_isDisposed)
|
||||
// {
|
||||
// Client.Dispose();
|
||||
// _isDisposed = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
@@ -44,7 +44,7 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NNostr.Client" Version="0.0.51"></PackageReference>
|
||||
<PackageReference Include="NNostr.Client" Version="0.0.54"></PackageReference>
|
||||
<PackageReference Include="WabiSabi" Version="1.0.1.2"/>
|
||||
</ItemGroup>
|
||||
<Target Name="DeleteExampleFile" AfterTargets="Publish">
|
||||
|
||||
Reference in New Issue
Block a user