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
33b0f25
feat(utils): add SetupCheckUtils trait
guilhermercarvalho Mar 3, 2026
dfe28cc
test: add test infrastructure for setup checks
guilhermercarvalho Mar 3, 2026
5467f97
feat(setup-check): add JavaSetupCheck
guilhermercarvalho Mar 3, 2026
0a12981
feat(setup-check): add JSignPdfSetupCheck
guilhermercarvalho Mar 3, 2026
a1106ff
feat(setup-check): add PDFtkSetupCheck
guilhermercarvalho Mar 3, 2026
f33c7ed
feat(setup-check): add PopplerSetupCheck
guilhermercarvalho Mar 3, 2026
500992c
feat(setup-check): add ImagickSetupCheck
guilhermercarvalho Mar 3, 2026
f94c723
feat(setup-check): add CertificateEngineSetupCheck
guilhermercarvalho Mar 3, 2026
329ca4f
feat(application): register new setup checks
guilhermercarvalho Mar 3, 2026
e20e9bc
refactor: deprecate ConfigureCheckService
guilhermercarvalho Mar 3, 2026
678f842
refactor(setup-check): reorganize mocks and apply code standards
guilhermercarvalho Mar 5, 2026
bc674fa
style(setup-check): apply code style fixes and improve Psalm annotations
guilhermercarvalho Mar 5, 2026
da24f3f
fix(setup-check): address Psalm issues and improve robustness
guilhermercarvalho Mar 5, 2026
2535d6d
test(setup-check): update PDFtkSetupCheckTest to match new error message
guilhermercarvalho Mar 5, 2026
1f1e396
test(setupcheck): reorganize test mocks into dedicated namespace
guilhermercarvalho Mar 6, 2026
b5cced6
feat(command): update configure:check to use ISetupCheckManager
guilhermercarvalho Mar 6, 2026
db1124d
refactor: replace deprecated ConfigureCheckService with SetupCheckRes…
guilhermercarvalho Mar 7, 2026
c5db494
fix(api): ensure OU field is always returned as string in certificate…
guilhermercarvalho Mar 7, 2026
61d984c
refactor(service): remove deprecated ConfigureCheckService
guilhermercarvalho Mar 7, 2026
0fa908b
test(service): add unit tests for SetupCheckResultService
guilhermercarvalho Mar 7, 2026
99d89e3
chore(service): remove redundant comment in SetupCheckResultService
guilhermercarvalho Mar 7, 2026
16caa26
test(handler): update OU filtering test to expect string
guilhermercarvalho Mar 7, 2026
79c5673
chore(service): remove redundant comments
guilhermercarvalho Mar 7, 2026
9a58d2d
chore(service): add SPDX header to SetupCheckResultService
YvesCesar Jun 20, 2026
08084f5
refactor(setup-check): use typed result object for formatted checks
YvesCesar Jun 20, 2026
762efd7
style(setup-check): apply code style fixes to test files
YvesCesar Jun 22, 2026
43745f8
chore(setup-check): add SPDX header to SetupCheckResultServiceTest
YvesCesar Jun 22, 2026
d9938ed
chore(openapi): regenerate specs for 'info' setup check status
YvesCesar Jun 22, 2026
23c9e70
fix(setup-check): query locale with string in setlocale for PHP 8.5
YvesCesar Jun 22, 2026
9a06f61
test(integration): expect OU as string in certificate names
YvesCesar Jun 24, 2026
27befa7
fix(setup-check): restore stable lowercase resource identifiers
YvesCesar Jun 24, 2026
33022ea
fix(setup-check): run only LibreSign checks in configure-check endpoint
YvesCesar Jun 25, 2026
a69da54
refactor(setup-check): drop redundant comment in certificate engine c…
YvesCesar Jun 26, 2026
77a61e7
refactor(setup-check): catch specific LibresignException in certifica…
YvesCesar Jun 26, 2026
ec8bbea
refactor(setup-check): use placeholder for the JSignPdf install comma…
YvesCesar Jun 26, 2026
154a1a0
refactor(setup-check): use placeholder for the debug mode command tip
YvesCesar Jun 26, 2026
ab4ac77
refactor(setup-check): apply occ command placeholders and translator …
YvesCesar Jun 26, 2026
7a5feb8
test(setup-check): use native intersection type for Imagick test mock
YvesCesar Jun 26, 2026
f1a94e1
test(setup-check): use native intersection type for result service mock
YvesCesar Jun 26, 2026
3b3d1a1
test(setup-check): use native intersection type for JSignPdf test mock
YvesCesar Jun 26, 2026
a3d1947
test(setup-check): use native intersection types for remaining test m…
YvesCesar Jun 26, 2026
9d84756
test(setup-check): use DataProvider attribute instead of docblock ann…
YvesCesar Jun 26, 2026
29c63a3
fix(setup-check): clarify JSignPdf file-not-found message and add tra…
YvesCesar Jun 27, 2026
6d09180
test(setup-check): align JSignPdf assertion with renamed file-not-fou…
YvesCesar Jun 27, 2026
1b05606
docs(setup-check): add translator context to JSignPdf check messages
YvesCesar Jun 27, 2026
d3abec3
docs(setup-check): add translator context to JSignPdf check messages
YvesCesar Jun 27, 2026
2b29586
docs(setup-check): add translator context to JSignPdf check messages
YvesCesar Jun 27, 2026
0a64589
test(setup-check): align JSignPdf assertion with renamed version-upda…
YvesCesar Jun 27, 2026
124e6e4
test(setup-check): align JSignPdf assertion with renamed version-down…
YvesCesar Jun 27, 2026
008b136
test(setup-check): align JSignPdf assertion with renamed version-down…
YvesCesar Jun 27, 2026
6d1b4c5
docs(setup-check): add translator context to JSignPdf success messages
YvesCesar Jun 27, 2026
3745ecb
refactor(setup-check): do not translate JSignPdf product name
YvesCesar Jun 27, 2026
da3583a
test(setup-check): align JSignPdf getName test with untranslated prod…
YvesCesar Jun 27, 2026
f8b7291
refactor(setup-check): clarify binary integrity signature-not-found m…
YvesCesar Jun 27, 2026
f9e72d4
test(setup-check): align assertions with binary integrity not-found m…
YvesCesar Jun 27, 2026
2d426ed
refactor(setup-check): clarify binary integrity empty signature message
YvesCesar Jun 27, 2026
5fbf9a0
refactor(setup-check): clarify binary integrity empty signature message
YvesCesar Jun 27, 2026
44f5779
refactor(setup-check): improve running-from-source debug hint wording
YvesCesar Jun 27, 2026
e155012
refactor(setup-check): improve running-from-source debug hint wording
YvesCesar Jun 27, 2026
7f4533c
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
0f670ca
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
eb32e97
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
64e1519
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
44c924c
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
b945d8c
refactor(setup-check): do not translate Poppler, Java and PDFtk produ…
YvesCesar Jun 27, 2026
e37796a
chore: Update lib/SetupCheck/JSignPdfSetupCheck.php
vitormattos Jun 28, 2026
4b37994
chore: Update lib/SetupCheck/JSignPdfSetupCheck.php
vitormattos Jun 28, 2026
9e022ba
chore: Update lib/SetupCheck/JSignPdfSetupCheck.php
vitormattos Jun 28, 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 @@ -71,7 +71,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 @@ -86,6 +85,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 @@ -258,11 +258,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 @@ -301,8 +299,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 @@ -313,7 +310,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 @@ -327,7 +324,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 @@ -564,7 +561,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 @@ -266,7 +266,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