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
6da608e
feat(utils): add SetupCheckUtils trait
guilhermercarvalho Mar 3, 2026
2222bb4
test: add test infrastructure for setup checks
guilhermercarvalho Mar 3, 2026
521e219
feat(setup-check): add JavaSetupCheck
guilhermercarvalho Mar 3, 2026
98d4df0
feat(setup-check): add JSignPdfSetupCheck
guilhermercarvalho Mar 3, 2026
2959793
feat(setup-check): add PDFtkSetupCheck
guilhermercarvalho Mar 3, 2026
d68f973
feat(setup-check): add PopplerSetupCheck
guilhermercarvalho Mar 3, 2026
4f61d50
feat(setup-check): add ImagickSetupCheck
guilhermercarvalho Mar 3, 2026
aac6c54
feat(setup-check): add CertificateEngineSetupCheck
guilhermercarvalho Mar 3, 2026
abba64c
feat(application): register new setup checks
guilhermercarvalho Mar 3, 2026
2a8e50d
refactor: deprecate ConfigureCheckService
guilhermercarvalho Mar 3, 2026
0883406
refactor(setup-check): reorganize mocks and apply code standards
guilhermercarvalho Mar 5, 2026
4e6f90b
style(setup-check): apply code style fixes and improve Psalm annotations
guilhermercarvalho Mar 5, 2026
00b91f6
fix(setup-check): address Psalm issues and improve robustness
guilhermercarvalho Mar 5, 2026
93cb504
test(setup-check): update PDFtkSetupCheckTest to match new error message
guilhermercarvalho Mar 5, 2026
d6b3173
test(setupcheck): reorganize test mocks into dedicated namespace
guilhermercarvalho Mar 6, 2026
01b53a6
feat(command): update configure:check to use ISetupCheckManager
guilhermercarvalho Mar 6, 2026
549095e
refactor: replace deprecated ConfigureCheckService with SetupCheckRes…
guilhermercarvalho Mar 7, 2026
17453da
fix(api): ensure OU field is always returned as string in certificate…
guilhermercarvalho Mar 7, 2026
254e8f6
test(service): add unit tests for SetupCheckResultService
guilhermercarvalho Mar 7, 2026
9055dbe
chore(service): remove redundant comment in SetupCheckResultService
guilhermercarvalho Mar 7, 2026
4718944
test(handler): update OU filtering test to expect string
guilhermercarvalho Mar 7, 2026
edf4d58
chore(service): remove redundant comments
guilhermercarvalho Mar 7, 2026
511760e
chore(service): add SPDX header to SetupCheckResultService
YvesCesar Jun 20, 2026
e3c0059
refactor(setup-check): use typed result object for formatted checks
YvesCesar Jun 20, 2026
6480f49
style(setup-check): apply code style fixes to test files
YvesCesar Jun 22, 2026
459b2da
chore(setup-check): add SPDX header to SetupCheckResultServiceTest
YvesCesar Jun 22, 2026
60cc6a4
chore(openapi): regenerate specs for 'info' setup check status
YvesCesar Jun 22, 2026
d994272
fix(setup-check): query locale with string in setlocale for PHP 8.5
YvesCesar Jun 22, 2026
5e5734e
test(integration): expect OU as string in certificate names
YvesCesar Jun 24, 2026
4ffbb82
fix(setup-check): restore stable lowercase resource identifiers
YvesCesar Jun 24, 2026
d959429
fix(setup-check): run only LibreSign checks in configure-check endpoint
YvesCesar Jun 25, 2026
e2a2905
refactor(setup-check): drop redundant comment in certificate engine c…
YvesCesar Jun 26, 2026
054575f
refactor(setup-check): catch specific LibresignException in certifica…
YvesCesar Jun 26, 2026
a69443d
refactor(setup-check): use placeholder for the JSignPdf install comma…
YvesCesar Jun 26, 2026
32bdaba
refactor(setup-check): use placeholder for the debug mode command tip
YvesCesar Jun 26, 2026
4a8f508
refactor(setup-check): apply occ command placeholders and translator …
YvesCesar Jun 26, 2026
880a7a2
test(setup-check): use native intersection type for Imagick test mock
YvesCesar Jun 26, 2026
dc58605
test(setup-check): use native intersection type for result service mock
YvesCesar Jun 26, 2026
c9b44d1
test(setup-check): use native intersection type for JSignPdf test mock
YvesCesar Jun 26, 2026
2f00ba5
test(setup-check): use native intersection types for remaining test m…
YvesCesar Jun 26, 2026
2b6e2e2
test(setup-check): use DataProvider attribute instead of docblock ann…
YvesCesar Jun 26, 2026
51ba253
fix(setup-check): clarify JSignPdf file-not-found message and add tra…
YvesCesar Jun 27, 2026
141410a
test(setup-check): align JSignPdf assertion with renamed file-not-fou…
YvesCesar Jun 27, 2026
0d28a3c
docs(setup-check): add translator context to JSignPdf check messages
YvesCesar Jun 27, 2026
8a57fcd
docs(setup-check): add translator context to JSignPdf check messages
YvesCesar Jun 27, 2026
a818d13
docs(setup-check): add translator context to JSignPdf check messages
YvesCesar Jun 27, 2026
512d620
test(setup-check): align JSignPdf assertion with renamed version-upda…
YvesCesar Jun 27, 2026
9ee26ec
test(setup-check): align JSignPdf assertion with renamed version-down…
YvesCesar Jun 27, 2026
003b6e9
test(setup-check): align JSignPdf assertion with renamed version-down…
YvesCesar Jun 27, 2026
f5891cd
docs(setup-check): add translator context to JSignPdf success messages
YvesCesar Jun 27, 2026
3d37a21
refactor(setup-check): do not translate JSignPdf product name
YvesCesar Jun 27, 2026
c02ea50
test(setup-check): align JSignPdf getName test with untranslated prod…
YvesCesar Jun 27, 2026
72f8c6c
refactor(setup-check): clarify binary integrity signature-not-found m…
YvesCesar Jun 27, 2026
0786d0e
test(setup-check): align assertions with binary integrity not-found m…
YvesCesar Jun 27, 2026
d868735
refactor(setup-check): clarify binary integrity empty signature message
YvesCesar Jun 27, 2026
b33254e
refactor(setup-check): clarify binary integrity empty signature message
YvesCesar Jun 27, 2026
b81ca54
refactor(setup-check): improve running-from-source debug hint wording
YvesCesar Jun 27, 2026
d05fc59
refactor(setup-check): improve running-from-source debug hint wording
YvesCesar Jun 27, 2026
af2ec81
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
bd2c5d3
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
ec92d2e
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
7fd4885
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
7f8ba72
docs(setup-check): add translator context to invalid-hash messages
YvesCesar Jun 27, 2026
c4a61e8
refactor(setup-check): do not translate Poppler, Java and PDFtk produ…
YvesCesar Jun 27, 2026
6a2633b
chore: Update lib/SetupCheck/JSignPdfSetupCheck.php
vitormattos Jun 28, 2026
083047b
chore: Update lib/SetupCheck/JSignPdfSetupCheck.php
vitormattos Jun 28, 2026
14dda5c
chore: Update lib/SetupCheck/JSignPdfSetupCheck.php
vitormattos Jun 28, 2026
303d9c7
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