Skip to content

Commit eb1a510

Browse files
authored
Merge pull request #4827 from LibreSign/backport/4772/stable31
[stable31] feat: customize signature stamp
2 parents b5f4764 + e709dbe commit eb1a510

File tree

87 files changed

+6926
-875
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+6926
-875
lines changed

.devcontainer/devcontainer.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@
3939
],
4040
"gitlens.showWelcomeOnInstall": false,
4141
"telemetry.telemetryLevel": "off",
42-
"intelephense.telemetry.enabled": false
42+
"intelephense.telemetry.enabled": false,
43+
"intelephense.environment.includePaths": [
44+
"apps-extra"
45+
],
46+
"git.scanRepositories": [
47+
"/apps-extra/libresign"
48+
]
4349
}
4450
}
4551
},

.devcontainer/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ services:
6767
- nextcloud:/var/www/html:ro
6868
- ../:/var/www/html/apps-extra/libresign:ro
6969
ports:
70-
- 127.0.0.1:${HTTP_PORT:-80}:80
70+
- ${HTTP_PORT:-80}:80
7171
mailhog:
7272
image: blueimp/mailhog
7373
ports:

.devcontainer/setup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ if [[ ! -d "vendor" ]]; then
1616
composer install
1717
fi
1818
occ app:enable libresign
19+
occ libresign:install --use-local-cert --java
20+
occ libresign:install --use-local-cert --pdftk
21+
occ libresign:install --use-local-cert --jsignpdf
22+
occ libresign:configure:openssl --cn=CommonName --c=BR --ou=OrganizationUnit --st=RioDeJaneiro --o=LibreSign --l=RioDeJaneiro
1923
if [[ ! -d "node_modules" ]]; then
2024
occ theming:config name "LibreSign"
2125
occ theming:config url "https://libresign.coop"

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
"require": {
33
"endroid/qr-code": "^5.0",
44
"jsignpdf/jsignpdf-php": "^1.2",
5-
"league/plates": "^3.5",
65
"libresign/whatosami": "^0.0.2",
76
"mikehaertl/php-pdftk": "^0.13.0",
87
"mpdf/mpdf": "^8.2",
98
"pagerfanta/pagerfanta": "^4.5",
109
"phpseclib/phpseclib": "^3.0",
1110
"smalot/pdfparser": "^2.4",
11+
"twig/twig": "^3.20",
1212
"wobeto/email-blur": "^1.0"
1313
},
1414
"require-dev": {
@@ -30,7 +30,7 @@
3030
},
3131
"scripts": {
3232
"bin": "echo 'bin not installed'",
33-
"lint": "find . -name \\*.php -not -path './vendor/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l",
33+
"lint": "find . -name \\*.php -not -path './vendor/*' -not -path './build/*' -not -path './tests/integration/vendor/*' -print0 | xargs -0 -n1 php -l",
3434
"cs:check": "php-cs-fixer fix --dry-run --diff",
3535
"cs:fix": "php-cs-fixer fix",
3636
"openapi": "generate-spec --verbose && (npm run typescript:generate || echo 'Please manually regenerate the typescript OpenAPI models')",

composer.lock

Lines changed: 159 additions & 65 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/AppInfo/Application.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use OCA\Files\Event\LoadAdditionalScriptsEvent;
1212
use OCA\Files\Event\LoadSidebar;
1313
use OCA\Libresign\Activity\Listener as ActivityListener;
14+
use OCA\Libresign\Capabilities;
1415
use OCA\Libresign\Events\SendSignNotificationEvent;
1516
use OCA\Libresign\Events\SignedEvent;
1617
use OCA\Libresign\Files\TemplateLoader as FilesTemplateLoader;
@@ -55,6 +56,7 @@ public function boot(IBootContext $context): void {
5556
public function register(IRegistrationContext $context): void {
5657
$context->registerMiddleWare(GlobalInjectionMiddleware::class, true);
5758
$context->registerMiddleWare(InjectionMiddleware::class);
59+
$context->registerCapability(Capabilities::class);
5860

5961
$context->registerNotifierService(Notifier::class);
6062

lib/Capabilities.php

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* SPDX-FileCopyrightText: 2025 LibreCode coop and contributors
6+
* SPDX-License-Identifier: AGPL-3.0-or-later
7+
*/
8+
9+
namespace OCA\Libresign;
10+
11+
use OCA\Libresign\Service\SignatureTextService;
12+
use OCA\Libresign\Service\SignerElementsService;
13+
use OCP\App\IAppManager;
14+
use OCP\Capabilities\IPublicCapability;
15+
16+
/**
17+
* @psalm-import-type LibresignCapabilities from ResponseDefinitions
18+
*/
19+
class Capabilities implements IPublicCapability {
20+
public const FEATURES = [
21+
'customize-signature'
22+
];
23+
24+
public function __construct(
25+
protected SignerElementsService $signerElementsService,
26+
protected SignatureTextService $signatureTextService,
27+
protected IAppManager $appManager,
28+
) {
29+
}
30+
31+
/**
32+
* @return array{
33+
* libresign?: LibresignCapabilities,
34+
* }
35+
*/
36+
public function getCapabilities(): array {
37+
$capabilities = [
38+
'features' => self::FEATURES,
39+
'config' => [
40+
'sign-elements' => [
41+
'is-available' => $this->signerElementsService->isSignElementsAvailable(),
42+
'can-create-signature' => $this->signerElementsService->canCreateSignature(),
43+
'full-signature-width' => $this->signatureTextService->getFullSignatureWidth(),
44+
'full-signature-height' => $this->signatureTextService->getFullSignatureHeight(),
45+
'signature-width' => $this->signatureTextService->getSignatureWidth(),
46+
'signature-height' => $this->signatureTextService->getSignatureHeight(),
47+
],
48+
],
49+
'version' => $this->appManager->getAppVersion('libresign'),
50+
];
51+
52+
return [
53+
'libresign' => $capabilities,
54+
];
55+
}
56+
}

lib/Controller/AccountController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use OCA\Libresign\AppInfo\Application;
1515
use OCA\Libresign\Db\AccountFileMapper;
1616
use OCA\Libresign\Exception\LibresignException;
17-
use OCA\Libresign\Handler\Pkcs12Handler;
17+
use OCA\Libresign\Handler\SignEngine\Pkcs12Handler;
1818
use OCA\Libresign\Helper\JSActions;
1919
use OCA\Libresign\Helper\ValidateHelper;
2020
use OCA\Libresign\ResponseDefinitions;

0 commit comments

Comments
 (0)