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
b7453cb
feat(utils): add SetupCheckUtils trait
guilhermercarvalho Mar 3, 2026
5f017b1
test: add test infrastructure for setup checks
guilhermercarvalho Mar 3, 2026
98a456b
feat(setup-check): add JavaSetupCheck
guilhermercarvalho Mar 3, 2026
21cfdbe
feat(setup-check): add JSignPdfSetupCheck
guilhermercarvalho Mar 3, 2026
29b5376
feat(setup-check): add PDFtkSetupCheck
guilhermercarvalho Mar 3, 2026
ff0e130
feat(setup-check): add PopplerSetupCheck
guilhermercarvalho Mar 3, 2026
b5dd92a
feat(setup-check): add ImagickSetupCheck
guilhermercarvalho Mar 3, 2026
98fe26d
feat(setup-check): add CertificateEngineSetupCheck
guilhermercarvalho Mar 3, 2026
3c6f39a
feat(application): register new setup checks
guilhermercarvalho Mar 3, 2026
186c323
refactor: deprecate ConfigureCheckService
guilhermercarvalho Mar 3, 2026
9a519a8
refactor(setup-check): reorganize mocks and apply code standards
guilhermercarvalho Mar 5, 2026
2d1f237
style(setup-check): apply code style fixes and improve Psalm annotations
guilhermercarvalho Mar 5, 2026
76663e0
fix(setup-check): address Psalm issues and improve robustness
guilhermercarvalho Mar 5, 2026
9033b00
test(setup-check): update PDFtkSetupCheckTest to match new error message
guilhermercarvalho Mar 5, 2026
43d9157
test(setupcheck): reorganize test mocks into dedicated namespace
guilhermercarvalho Mar 6, 2026
b693320
feat(command): update configure:check to use ISetupCheckManager
guilhermercarvalho Mar 6, 2026
e37a64a
refactor: replace deprecated ConfigureCheckService with SetupCheckRes…
guilhermercarvalho Mar 7, 2026
db15663
fix(api): ensure OU field is always returned as string in certificate…
guilhermercarvalho Mar 7, 2026
20cfed5
test(service): add unit tests for SetupCheckResultService
guilhermercarvalho Mar 7, 2026
68d585e
chore(service): remove redundant comment in SetupCheckResultService
guilhermercarvalho Mar 7, 2026
cd3a223
test(handler): update OU filtering test to expect string
guilhermercarvalho Mar 7, 2026
9153ead
chore(service): remove redundant comments
guilhermercarvalho Mar 7, 2026
27ad840
chore(service): add SPDX header to SetupCheckResultService
YvesCesar Jun 20, 2026
2e3b81d
refactor(setup-check): use typed result object for formatted checks
YvesCesar Jun 20, 2026
5dcd762
style(setup-check): apply code style fixes to test files
YvesCesar Jun 22, 2026
8e855a5
chore(setup-check): add SPDX header to SetupCheckResultServiceTest
YvesCesar Jun 22, 2026
d86aa45
chore(openapi): regenerate specs for 'info' setup check status
YvesCesar Jun 22, 2026
d6b6bca
fix(setup-check): query locale with string in setlocale for PHP 8.5
YvesCesar Jun 22, 2026
75a97a8
test(integration): expect OU as string in certificate names
YvesCesar Jun 24, 2026
77293f0
fix(setup-check): restore stable lowercase resource identifiers
YvesCesar Jun 24, 2026
4d604de
fix(setup-check): run only LibreSign checks in configure-check endpoint
YvesCesar Jun 25, 2026
bfe7d00
refactor(setup-check): drop redundant comment in certificate engine c…
YvesCesar Jun 26, 2026
fa7ad47
refactor(setup-check): catch specific LibresignException in certifica…
YvesCesar Jun 26, 2026
e5a4289
refactor(setup-check): use placeholder for the JSignPdf install comma…
YvesCesar Jun 26, 2026
cc6a6fb
refactor(setup-check): use placeholder for the debug mode command tip
YvesCesar Jun 26, 2026
15b98e3
refactor(setup-check): apply occ command placeholders and translator …
YvesCesar Jun 26, 2026
5a57dbc
test(setup-check): use native intersection type for Imagick test mock
YvesCesar Jun 26, 2026
5c0fbe4
test(setup-check): use native intersection type for result service mock
YvesCesar Jun 26, 2026
188ab9a
test(setup-check): use native intersection type for JSignPdf test mock
YvesCesar Jun 26, 2026
7fd8b2f
test(setup-check): use native intersection types for remaining test m…
YvesCesar Jun 26, 2026
dfeeeaa
test(setup-check): use DataProvider attribute instead of docblock ann…
YvesCesar Jun 26, 2026
12e3dc0
fix(setup-check): clarify JSignPdf file-not-found message and add tra…
YvesCesar Jun 27, 2026
f1e7af0
test(setup-check): align JSignPdf assertion with renamed file-not-fou…
YvesCesar Jun 27, 2026
b274bc4
docs(setup-check): add translator context to JSignPdf check messages
YvesCesar Jun 27, 2026
6859367
docs(setup-check): add translator context to JSignPdf check messages
YvesCesar Jun 27, 2026
5dc9fc0
docs(setup-check): add translator context to JSignPdf check messages
YvesCesar Jun 27, 2026
f533dcf
test(setup-check): align JSignPdf assertion with renamed version-upda…
YvesCesar Jun 27, 2026
63193ee
test(setup-check): align JSignPdf assertion with renamed version-down…
YvesCesar Jun 27, 2026
9e3d4aa
test(setup-check): align JSignPdf assertion with renamed version-down…
YvesCesar Jun 27, 2026
64f9b68
docs(setup-check): add translator context to JSignPdf success messages
YvesCesar Jun 27, 2026
72740ec
refactor(setup-check): do not translate JSignPdf product name
YvesCesar Jun 27, 2026
9216b6e
test(setup-check): align JSignPdf getName test with untranslated prod…
YvesCesar Jun 27, 2026
61bd4ad
refactor(setup-check): clarify binary integrity signature-not-found m…
YvesCesar Jun 27, 2026
7e7499b
test(setup-check): align assertions with binary integrity not-found m…
YvesCesar Jun 27, 2026
c5237f0
refactor(setup-check): clarify binary integrity empty signature message
YvesCesar Jun 27, 2026
d0bb98f
refactor(setup-check): clarify binary integrity empty signature message
YvesCesar Jun 27, 2026
f72cf7c
refactor(setup-check): improve running-from-source debug hint wording
YvesCesar Jun 27, 2026
4207715
refactor(setup-check): improve running-from-source debug hint wording
YvesCesar Jun 27, 2026
58a913a
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
d082220
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
71d7263
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
9475b2f
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
8a42a56
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
bafaf6c
refactor(setup-check): do not translate Poppler, Java and PDFtk produ…
YvesCesar Jun 27, 2026
35ed6ea
chore: Update lib/SetupCheck/JSignPdfSetupCheck.php
vitormattos Jun 28, 2026
64385ba
chore: Update lib/SetupCheck/JSignPdfSetupCheck.php
vitormattos Jun 28, 2026
7af16c2
chore: Update lib/SetupCheck/JSignPdfSetupCheck.php
vitormattos Jun 28, 2026
eade2ea
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