mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 16:11:10 +00:00
Adds bundled plugin trust and cross-platform native deployment
- embeds the append-only historical and deny trust lists in the API and marks matching bundled plugins as Official without blocking loading - builds and records the current plugin manifest only for official release builds - deploys the PDF native libraries for the supported Linux, macOS and Windows runtimes from the plugin dependency manifest - records release hashes by appending only missing entries to master's manifest and rejects any diff that removes a line - documents the release flow, the supported runtimes and the plugin installer limits
This commit is contained in:
1 parent
3fb8912c7f
commit
b30cbd6b9e
114 files changed
+2708
-243
No files matched your search
+15
-1
@@ -26,7 +26,7 @@ public class PluginEntityMappingTests
|
||||
IReadOnlyDictionary<string, string>? expectedSettings = JsonSerializer.Deserialize<Dictionary<string, string>>(entity.SettingsJson!);
|
||||
|
||||
// Act
|
||||
PluginResponse result = entity.ToResponse();
|
||||
PluginResponse result = entity.ToResponse(isOfficial: true);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(result);
|
||||
@@ -38,6 +38,20 @@ public class PluginEntityMappingTests
|
||||
Assert.Equal(entity.LoadStatus, result.LoadStatus);
|
||||
Assert.Equal(entity.LoadError, result.LoadError);
|
||||
Assert.Equal(expectedSettings, result.Settings);
|
||||
Assert.True(result.IsOfficial);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToResponse_WhenPluginIsNotOfficial_ShouldSetIsOfficialFalse()
|
||||
{
|
||||
// Arrange
|
||||
PluginEntity entity = _pluginEntityFixture.Create();
|
||||
|
||||
// Act
|
||||
PluginResponse result = entity.ToResponse(isOfficial: false);
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsOfficial);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+40
-2
@@ -3,7 +3,7 @@ using Nemera.Application.Common.DataAccess.Entities.Plugins;
|
||||
using Nemera.Application.Common.DataAccess.Repositories.Plugins;
|
||||
using Nemera.Application.Common.DataAccess.UoW;
|
||||
using Nemera.Application.Common.DTO.Filtering;
|
||||
using Nemera.Application.Common.DTO.Pagination;
|
||||
using Nemera.Application.Common.Infrastructure.Plugins;
|
||||
using Nemera.Application.Core.Plugins.Queries.GetPlugins;
|
||||
using Nemera.Application.Fixtures.Common.DataAccess.Entities.Plugins;
|
||||
using Nemera.Application.Fixtures.Common.DTO.Pagination;
|
||||
@@ -27,6 +27,7 @@ public class GetPluginsQueryHandlerTests
|
||||
{
|
||||
private readonly IUnitOfWork _mockUnitOfWork;
|
||||
private readonly IPluginRepository _mockPluginRepository;
|
||||
private readonly IPluginManager _mockPluginManager;
|
||||
private readonly GetPluginsQueryHandler _sut;
|
||||
private readonly GetPluginsQueryFixture _getPluginsQueryFixture = new();
|
||||
private readonly PluginEntityFixture _pluginEntityFixture = new();
|
||||
@@ -41,7 +42,8 @@ public class GetPluginsQueryHandlerTests
|
||||
_mockUnitOfWork.SaveChangesAsync(Arg.Any<CancellationToken>()).Returns(Result.Success);
|
||||
_mockPluginRepository = Substitute.For<IPluginRepository>();
|
||||
_mockUnitOfWork.PluginRepository.Returns(_mockPluginRepository);
|
||||
_sut = new GetPluginsQueryHandler(_mockUnitOfWork);
|
||||
_mockPluginManager = Substitute.For<IPluginManager>();
|
||||
_sut = new GetPluginsQueryHandler(_mockUnitOfWork, _mockPluginManager);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -62,6 +64,42 @@ public class GetPluginsQueryHandlerTests
|
||||
Assert.Equal(plugins[0].Id, result.Value[0].Id);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HandleAsync_WhenPluginIsOfficial_ShouldReturnItAsOfficial()
|
||||
{
|
||||
// Arrange
|
||||
PluginEntity plugin = _pluginEntityFixture.Create();
|
||||
_mockPluginRepository.GetAllAsync<BaseFilterDto>(cancellationToken: Arg.Any<CancellationToken>())
|
||||
.Returns(Result.From(_paginatedResultDtoFixture.Create(data: [plugin], currentPage: 1, perPage: 1, count: 1, numberOfPages: 1)));
|
||||
_mockPluginManager.IsOfficial(plugin.Id).Returns(true);
|
||||
|
||||
// Act
|
||||
Result<IReadOnlyList<PluginResponse>> result = await _sut.HandleAsync(_getPluginsQueryFixture.Create(), CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
PluginResponse response = Assert.Single(result.Value);
|
||||
Assert.True(response.IsOfficial);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HandleAsync_WhenPluginIsNotOfficial_ShouldReturnItAsNotOfficial()
|
||||
{
|
||||
// Arrange
|
||||
PluginEntity plugin = _pluginEntityFixture.Create();
|
||||
_mockPluginRepository.GetAllAsync<BaseFilterDto>(cancellationToken: Arg.Any<CancellationToken>())
|
||||
.Returns(Result.From(_paginatedResultDtoFixture.Create(data: [plugin], currentPage: 1, perPage: 1, count: 1, numberOfPages: 1)));
|
||||
_mockPluginManager.IsOfficial(plugin.Id).Returns(false);
|
||||
|
||||
// Act
|
||||
Result<IReadOnlyList<PluginResponse>> result = await _sut.HandleAsync(_getPluginsQueryFixture.Create(), CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
Assert.False(result.IsFailure);
|
||||
PluginResponse response = Assert.Single(result.Value);
|
||||
Assert.False(response.IsOfficial);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HandleAsync_WhenRepositoryReturnsError_ShouldReturnError()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user