Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
e5b8e10
feat(utils): add SetupCheckUtils trait
guilhermercarvalho Mar 3, 2026
1c995cb
test: add test infrastructure for setup checks
guilhermercarvalho Mar 3, 2026
2f0d006
feat(setup-check): add JavaSetupCheck
guilhermercarvalho Mar 3, 2026
ea874c7
feat(setup-check): add JSignPdfSetupCheck
guilhermercarvalho Mar 3, 2026
d950a1c
feat(setup-check): add PDFtkSetupCheck
guilhermercarvalho Mar 3, 2026
b7580b6
feat(setup-check): add PopplerSetupCheck
guilhermercarvalho Mar 3, 2026
1f939e1
feat(setup-check): add ImagickSetupCheck
guilhermercarvalho Mar 3, 2026
3cf41c4
feat(setup-check): add CertificateEngineSetupCheck
guilhermercarvalho Mar 3, 2026
1a04704
feat(application): register new setup checks
guilhermercarvalho Mar 3, 2026
2c83569
refactor: deprecate ConfigureCheckService
guilhermercarvalho Mar 3, 2026
ee38a97
refactor(setup-check): reorganize mocks and apply code standards
guilhermercarvalho Mar 5, 2026
4794c3a
style(setup-check): apply code style fixes and improve Psalm annotations
guilhermercarvalho Mar 5, 2026
f18b4dd
fix(setup-check): address Psalm issues and improve robustness
guilhermercarvalho Mar 5, 2026
d565156
test(setup-check): update PDFtkSetupCheckTest to match new error message
guilhermercarvalho Mar 5, 2026
1d23645
test(setupcheck): reorganize test mocks into dedicated namespace
guilhermercarvalho Mar 6, 2026
e749f65
feat(command): update configure:check to use ISetupCheckManager
guilhermercarvalho Mar 6, 2026
f11fa78
refactor: replace deprecated ConfigureCheckService with SetupCheckRes…
guilhermercarvalho Mar 7, 2026
59fddbf
fix(api): ensure OU field is always returned as string in certificate…
guilhermercarvalho Mar 7, 2026
b318cbe
test(service): add unit tests for SetupCheckResultService
guilhermercarvalho Mar 7, 2026
c93cba0
chore(service): remove redundant comment in SetupCheckResultService
guilhermercarvalho Mar 7, 2026
4fb87d8
test(handler): update OU filtering test to expect string
guilhermercarvalho Mar 7, 2026
6b28842
chore(service): remove redundant comments
guilhermercarvalho Mar 7, 2026
d4a418d
chore(service): add SPDX header to SetupCheckResultService
YvesCesar Jun 20, 2026
aab4c3a
refactor(setup-check): use typed result object for formatted checks
YvesCesar Jun 20, 2026
de76bcb
style(setup-check): apply code style fixes to test files
YvesCesar Jun 22, 2026
2d9c549
chore(setup-check): add SPDX header to SetupCheckResultServiceTest
YvesCesar Jun 22, 2026
c52348a
chore(openapi): regenerate specs for 'info' setup check status
YvesCesar Jun 22, 2026
3ced85d
fix(setup-check): query locale with string in setlocale for PHP 8.5
YvesCesar Jun 22, 2026
02b6f70
test(integration): expect OU as string in certificate names
YvesCesar Jun 24, 2026
0262acb
fix(setup-check): restore stable lowercase resource identifiers
YvesCesar Jun 24, 2026
de09e06
fix(setup-check): run only LibreSign checks in configure-check endpoint
YvesCesar Jun 25, 2026
9af337e
refactor(setup-check): drop redundant comment in certificate engine c…
YvesCesar Jun 26, 2026
2c8ca07
refactor(setup-check): catch specific LibresignException in certifica…
YvesCesar Jun 26, 2026
2047dd7
refactor(setup-check): use placeholder for the JSignPdf install comma…
YvesCesar Jun 26, 2026
4dbfb6f
refactor(setup-check): use placeholder for the debug mode command tip
YvesCesar Jun 26, 2026
fa0937a
refactor(setup-check): apply occ command placeholders and translator …
YvesCesar Jun 26, 2026
22b4ac7
test(setup-check): use native intersection type for Imagick test mock
YvesCesar Jun 26, 2026
aee82f0
test(setup-check): use native intersection type for result service mock
YvesCesar Jun 26, 2026
dc8a927
test(setup-check): use native intersection type for JSignPdf test mock
YvesCesar Jun 26, 2026
db5e2f7
test(setup-check): use native intersection types for remaining test m…
YvesCesar Jun 26, 2026
89fb5ef
test(setup-check): use DataProvider attribute instead of docblock ann…
YvesCesar Jun 26, 2026
4f5e0f1
fix(setup-check): clarify JSignPdf file-not-found message and add tra…
YvesCesar Jun 27, 2026
0a8490c
test(setup-check): align JSignPdf assertion with renamed file-not-fou…
YvesCesar Jun 27, 2026
e3fb5cd
docs(setup-check): add translator context to JSignPdf check messages
YvesCesar Jun 27, 2026
2167852
docs(setup-check): add translator context to JSignPdf check messages
YvesCesar Jun 27, 2026
ad94e8f
docs(setup-check): add translator context to JSignPdf check messages
YvesCesar Jun 27, 2026
ec9708e
test(setup-check): align JSignPdf assertion with renamed version-upda…
YvesCesar Jun 27, 2026
85046c6
test(setup-check): align JSignPdf assertion with renamed version-down…
YvesCesar Jun 27, 2026
598fb69
test(setup-check): align JSignPdf assertion with renamed version-down…
YvesCesar Jun 27, 2026
449319a
docs(setup-check): add translator context to JSignPdf success messages
YvesCesar Jun 27, 2026
e7b82db
refactor(setup-check): do not translate JSignPdf product name
YvesCesar Jun 27, 2026
885a8cc
test(setup-check): align JSignPdf getName test with untranslated prod…
YvesCesar Jun 27, 2026
1cd4d34
refactor(setup-check): clarify binary integrity signature-not-found m…
YvesCesar Jun 27, 2026
73ad1ae
test(setup-check): align assertions with binary integrity not-found m…
YvesCesar Jun 27, 2026
21f4c96
refactor(setup-check): clarify binary integrity empty signature message
YvesCesar Jun 27, 2026
2b749cf
refactor(setup-check): clarify binary integrity empty signature message
YvesCesar Jun 27, 2026
b7f00ef
refactor(setup-check): improve running-from-source debug hint wording
YvesCesar Jun 27, 2026
fdda051
refactor(setup-check): improve running-from-source debug hint wording
YvesCesar Jun 27, 2026
1fe4ec1
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
04aee88
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
18458a3
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
d87f69f
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
93e346c
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
062320d
refactor(setup-check): do not translate Poppler, Java and PDFtk produ…
YvesCesar Jun 27, 2026
7d2c383
chore: Update lib/SetupCheck/JSignPdfSetupCheck.php
vitormattos Jun 28, 2026
09e7022
chore: Update lib/SetupCheck/JSignPdfSetupCheck.php
vitormattos Jun 28, 2026
67380e7
chore: Update lib/SetupCheck/JSignPdfSetupCheck.php
vitormattos Jun 28, 2026
5ee3496
chore: delete skipped configure check remnants
vitormattos Jun 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,14 @@ public function register(IRegistrationContext $context): void {
$context->registerEventListener(UserDeletedEvent::class, UserDeletedListener::class);

$context->registerDashboardWidget(PendingSignaturesWidget::class);

$context->registerSetupCheck(\OCA\Libresign\SetupCheck\JavaSetupCheck::class);
$context->registerSetupCheck(\OCA\Libresign\SetupCheck\JSignPdfSetupCheck::class);
$context->registerSetupCheck(\OCA\Libresign\SetupCheck\PDFtkSetupCheck::class);

$context->registerSetupCheck(\OCA\Libresign\SetupCheck\PopplerSetupCheck::class);
$context->registerSetupCheck(\OCA\Libresign\SetupCheck\ImagickSetupCheck::class);

$context->registerSetupCheck(\OCA\Libresign\SetupCheck\CertificateEngineSetupCheck::class);
}
}
36 changes: 20 additions & 16 deletions lib/Command/Configure/Check.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
namespace OCA\Libresign\Command\Configure;

use OC\Core\Command\Base;
use OCA\Libresign\Service\Install\ConfigureCheckService;
use OCP\IConfig;
use OCA\Libresign\Service\SetupCheck\ConfigureCheckResult;
use OCA\Libresign\Service\SetupCheckResultService;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableCell;
use Symfony\Component\Console\Helper\TableCellStyle;
Expand All @@ -19,9 +19,9 @@
use Symfony\Component\Console\Output\OutputInterface;

class Check extends Base {

public function __construct(
private ConfigureCheckService $configureCheckService,
private IConfig $config,
private SetupCheckResultService $setupCheckResultService,
) {
parent::__construct();
}
Expand Down Expand Up @@ -49,22 +49,25 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$certificate = $input->getOption('certificate');
$all = (!$sign && !$certificate);

$result = [];
if ($all) {
$result = $this->configureCheckService->checkAll();
} else {
if ($sign) {
$result = array_merge($result, $this->configureCheckService->checkSign());
$allChecks = $this->setupCheckResultService->getFormattedChecks();

$filteredRows = array_filter($allChecks, function (ConfigureCheckResult $check) use ($all, $sign, $certificate) {
if ($all) {
return true;
}
if ($certificate) {
$result = array_merge($result, $this->configureCheckService->checkCertificate());
if ($sign && $check->getCategory() === 'system') {
return true;
}
}
if ($certificate && $check->getCategory() === 'security') {
return true;
}
return false;
});

if (count($result)) {
if (!empty($filteredRows)) {
$table = new Table($output);
$table->setColumnMaxWidth(3, 40);
foreach ($result as $row) {
foreach ($filteredRows as $row) {
$table->addRow([
new TableCell($row->getStatus(), ['style' => new TableCellStyle([
'bg' => $this->getStatusColor($row->getStatus()),
Expand All @@ -86,10 +89,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
->setStyle('symfony-style-guide')
->render();
}

return 0;
}

private function getStatusColor($status): string {
private function getStatusColor(string $status): string {
return match ($status) {
'success' => 'green',
'error' => 'red',
Expand Down
21 changes: 9 additions & 12 deletions lib/Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
use OCA\Libresign\Service\DocMdp\ConfigService as DocMdpConfigService;
use OCA\Libresign\Service\FooterService;
use OCA\Libresign\Service\IdentifyMethodService;
use OCA\Libresign\Service\Install\ConfigureCheckService;
use OCA\Libresign\Service\Install\InstallService;
use OCA\Libresign\Service\ReminderService;
use OCA\Libresign\Service\SetupCheckResultService;
use OCA\Libresign\Service\SignatureBackgroundService;
use OCA\Libresign\Service\SignatureTextService;
use OCA\Libresign\Settings\Admin;
Expand Down Expand Up @@ -70,7 +70,6 @@ class AdminController extends AEnvironmentAwareController {
public function __construct(
IRequest $request,
private IAppConfig $appConfig,
private ConfigureCheckService $configureCheckService,
private InstallService $installService,
private CertificateEngineFactory $certificateEngineFactory,
private IEventSourceFactory $eventSourceFactory,
Expand All @@ -85,6 +84,7 @@ public function __construct(
private DocMdpConfigService $docMdpConfigService,
private IdentifyMethodService $identifyMethodService,
private FileMapper $fileMapper,
private SetupCheckResultService $setupCheckResultService,
) {
parent::__construct(Application::APP_ID, $request);
$this->eventSource = $this->eventSourceFactory->create();
Expand Down Expand Up @@ -257,11 +257,9 @@ public function loadCertificate(): DataResponse {
#[NoCSRFRequired]
#[ApiRoute(verb: 'GET', url: '/api/{apiVersion}/admin/configure-check', requirements: ['apiVersion' => '(v1)'])]
public function configureCheck(): DataResponse {
/** @var LibresignConfigureChecksResponse $configureCheckList */
$configureCheckList = array_values($this->configureCheckService->checkAll());
return new DataResponse(
$configureCheckList
);
/** @var LibresignConfigureChecksResponse $checks */
$checks = $this->setupCheckResultService->getFormattedChecks();
return new DataResponse($checks);
}

/**
Expand Down Expand Up @@ -300,8 +298,7 @@ public function installAndValidate(): void {
$this->installService->installCfssl($async);
}

$this->configureCheckService->disableCache();
$this->eventSource->send('configure_check', $this->configureCheckService->checkAll());
$this->eventSource->send('configure_check', $this->setupCheckResultService->getFormattedChecks());
$seconds = 0;
while ($this->installService->isDownloadWip()) {
$totalSize = $this->installService->getTotalSize();
Expand All @@ -312,7 +309,7 @@ public function installAndValidate(): void {
usleep(200000); // 0.2 seconds
$seconds += 0.2;
if ($seconds === 5.0) {
$this->eventSource->send('configure_check', $this->configureCheckService->checkAll());
$this->eventSource->send('configure_check', $this->setupCheckResultService->getFormattedChecks());
$seconds = 0;
}
}
Expand All @@ -326,7 +323,7 @@ public function installAndValidate(): void {
]));
}

$this->eventSource->send('configure_check', $this->configureCheckService->checkAll());
$this->eventSource->send('configure_check', $this->setupCheckResultService->getFormattedChecks());
$this->eventSource->send('done', '');
$this->eventSource->close();
// Nextcloud inject a lot of headers that is incompatible with SSE
Expand Down Expand Up @@ -563,7 +560,7 @@ public function signerName(
float $fontSize,
bool $isDarkTheme,
string $align,
): FileDisplayResponse|DataResponse {
): FileDisplayResponse|DataResponse {
try {
$blob = $this->signatureTextService->signerNameImage(
width: $width,
Expand Down
8 changes: 5 additions & 3 deletions lib/Handler/CertificateEngine/AEngineHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -777,9 +777,11 @@ private function getConfigPathForApi(bool $generated): string {
}

private function filterNameValue(string $name, mixed $value, bool $generated): mixed {
if ($name === 'OU' && is_array($value) && !$generated) {
$filtered = $this->removeCaIdFromOrganizationalUnit($value);
return empty($filtered) ? null : $filtered;
if ($name === 'OU' && is_array($value)) {
if (!$generated) {
$value = $this->removeCaIdFromOrganizationalUnit($value);
}
return empty($value) ? null : implode(', ', $value);
}
return $value;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
* @psalm-type LibresignConfigureCheck = array{
* message: string,
* resource: string,
* status: "error"|"success",
* status: "error"|"info"|"success",
* tip: string,
* }
* @psalm-type LibresignConfigureChecksResponse = list<LibresignConfigureCheck>
Expand Down
Loading
Loading