Clipboard action now sets an expiration timer

WIP Max History count (back-end done, front-end todo)
This commit is contained in:
Geoffroy BONNEVILLE
2020-05-12 18:43:37 +02:00
parent f8f7c19f65
commit 7ac1595aaa
11 changed files with 64 additions and 9 deletions

View File

@@ -106,6 +106,7 @@
<Compile Include="Parameters\Commands\SetCipher\SetCipherCommand.cs" />
<Compile Include="Parameters\Commands\SetCompression\SetCompressionCommand.cs" />
<Compile Include="Parameters\Commands\SetHasRecycleBin\SetHasRecycleBinCommand.cs" />
<Compile Include="Parameters\Commands\SetMaxHistoryCount\SetHistoryCountCommand.cs" />
<Compile Include="Parameters\Commands\SetKeyDerivation\SetKeyDerivationCommand.cs" />
<Compile Include="Parameters\Commands\SetRecycleBin\SetRecycleBinCommand.cs" />
<Compile Include="Parameters\Models\CipherVm.cs" />

View File

@@ -22,6 +22,7 @@ namespace ModernKeePass.Application.Common.Interfaces
string FileAccessToken { get; set; }
int Size { get; set; }
bool IsDirty { get; set; }
int MaxHistoryCount { get; set; }
Task Open(byte[] file, Credentials credentials);
Task ReOpen(byte[] file);

View File

@@ -12,5 +12,6 @@
public string KeyDerivationId { get; set; }
public int Size { get; internal set; }
public bool IsDirty { get; internal set; }
public int MaxHistoryCount { get; set; }
}
}

View File

@@ -33,6 +33,7 @@ namespace ModernKeePass.Application.Database.Queries.GetDatabase
database.KeyDerivationId = _databaseProxy.KeyDerivationId;
database.Size = _databaseProxy.Size;
database.IsDirty = _databaseProxy.IsDirty;
database.MaxHistoryCount = _databaseProxy.MaxHistoryCount;
}
return database;
}

View File

@@ -0,0 +1,27 @@
using MediatR;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Domain.Exceptions;
namespace ModernKeePass.Application.Parameters.Commands.SetMaxHistoryCount
{
public class SetMaxHistoryCountCommand : IRequest
{
public int MaxHistoryCount { get; set; }
public class SetMaxHistoryCountCommandHandler : IRequestHandler<SetMaxHistoryCountCommand>
{
private readonly IDatabaseProxy _database;
public SetMaxHistoryCountCommandHandler(IDatabaseProxy database)
{
_database = database;
}
public void Handle(SetMaxHistoryCountCommand message)
{
if (_database.IsOpen) _database.MaxHistoryCount = message.MaxHistoryCount;
else throw new DatabaseClosedException();
}
}
}
}