• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LibreSign / libresign / 20907588007

12 Jan 2026 03:57AM UTC coverage: 43.867%. First build
20907588007

Pull #6436

github

web-flow
Merge 9c5490a63 into 8fe916f99
Pull Request #6436: feat: async parallel signing

242 of 775 new or added lines in 26 files covered. (31.23%)

6920 of 15775 relevant lines covered (43.87%)

4.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

6.52
/lib/Settings/Admin.php
1
<?php
2

3
declare(strict_types=1);
4
/**
5
 * SPDX-FileCopyrightText: 2020-2024 LibreCode coop and contributors
6
 * SPDX-License-Identifier: AGPL-3.0-or-later
7
 */
8

9
namespace OCA\Libresign\Settings;
10

11
use OCA\Libresign\AppInfo\Application;
12
use OCA\Libresign\Exception\LibresignException;
13
use OCA\Libresign\Handler\CertificateEngine\CertificateEngineFactory;
14
use OCA\Libresign\Service\CertificatePolicyService;
15
use OCA\Libresign\Service\DocMdpConfigService;
16
use OCA\Libresign\Service\FooterService;
17
use OCA\Libresign\Service\IdentifyMethodService;
18
use OCA\Libresign\Service\SignatureBackgroundService;
19
use OCA\Libresign\Service\SignatureTextService;
20
use OCP\AppFramework\Http\TemplateResponse;
21
use OCP\AppFramework\Services\IInitialState;
22
use OCP\IAppConfig;
23
use OCP\Settings\ISettings;
24
use OCP\Util;
25

26
class Admin implements ISettings {
27
        public const PASSWORD_PLACEHOLDER = '••••••••';
28

29
        public function __construct(
30
                private IInitialState $initialState,
31
                private IdentifyMethodService $identifyMethodService,
32
                private CertificateEngineFactory $certificateEngineFactory,
33
                private CertificatePolicyService $certificatePolicyService,
34
                private IAppConfig $appConfig,
35
                private SignatureTextService $signatureTextService,
36
                private SignatureBackgroundService $signatureBackgroundService,
37
                private FooterService $footerService,
38
                private DocMdpConfigService $docMdpConfigService,
39
        ) {
40
        }
2✔
41
        #[\Override]
42
        public function getForm(): TemplateResponse {
43
                Util::addScript(Application::APP_ID, 'libresign-settings');
×
44
                try {
45
                        $signatureParsed = $this->signatureTextService->parse();
×
46
                        $this->initialState->provideInitialState('signature_text_parsed', $signatureParsed['parsed']);
×
47
                } catch (LibresignException $e) {
×
48
                        $this->initialState->provideInitialState('signature_text_parsed', '');
×
49
                        $this->initialState->provideInitialState('signature_text_template_error', $e->getMessage());
×
50
                }
51
                $this->initialState->provideInitialState('certificate_engine', $this->certificateEngineFactory->getEngine()->getName());
×
52
                $this->initialState->provideInitialState('certificate_policies_oid', $this->certificatePolicyService->getOid());
×
53
                $this->initialState->provideInitialState('certificate_policies_cps', $this->certificatePolicyService->getCps());
×
54
                $this->initialState->provideInitialState('config_path', $this->appConfig->getValueString(Application::APP_ID, 'config_path'));
×
55
                $this->initialState->provideInitialState('default_signature_font_size', SignatureTextService::SIGNATURE_DEFAULT_FONT_SIZE);
×
56
                $this->initialState->provideInitialState('default_signature_height', SignatureTextService::DEFAULT_SIGNATURE_HEIGHT);
×
57
                $this->initialState->provideInitialState('default_signature_text_template', $this->signatureTextService->getDefaultTemplate());
×
58
                $this->initialState->provideInitialState('default_signature_width', SignatureTextService::DEFAULT_SIGNATURE_WIDTH);
×
59
                $this->initialState->provideInitialState('default_template_font_size', $this->signatureTextService->getDefaultTemplateFontSize());
×
60
                $this->initialState->provideInitialState('identify_methods', $this->identifyMethodService->getIdentifyMethodsSettings());
×
61
                $this->initialState->provideInitialState('signature_available_variables', $this->signatureTextService->getAvailableVariables());
×
62
                $this->initialState->provideInitialState('signature_background_type', $this->signatureBackgroundService->getSignatureBackgroundType());
×
63
                $this->initialState->provideInitialState('signature_font_size', $this->signatureTextService->getSignatureFontSize());
×
64
                $this->initialState->provideInitialState('signature_height', $this->signatureTextService->getFullSignatureHeight());
×
65
                $this->initialState->provideInitialState('signature_preview_zoom_level', $this->appConfig->getValueFloat(Application::APP_ID, 'signature_preview_zoom_level', 100));
×
66
                $this->initialState->provideInitialState('footer_preview_zoom_level', $this->appConfig->getValueFloat(Application::APP_ID, 'footer_preview_zoom_level', 100));
×
67
                $this->initialState->provideInitialState('footer_preview_width', $this->appConfig->getValueInt(Application::APP_ID, 'footer_preview_width', 595));
×
68
                $this->initialState->provideInitialState('footer_preview_height', $this->appConfig->getValueInt(Application::APP_ID, 'footer_preview_height', 100));
×
69
                $this->initialState->provideInitialState('footer_template_variables', $this->footerService->getTemplateVariablesMetadata());
×
70
                $this->initialState->provideInitialState('footer_template', $this->footerService->getTemplate());
×
71
                $this->initialState->provideInitialState('footer_template_is_default', $this->footerService->isDefaultTemplate());
×
72
                $this->initialState->provideInitialState('signature_render_mode', $this->signatureTextService->getRenderMode());
×
73
                $this->initialState->provideInitialState('signature_text_template', $this->signatureTextService->getTemplate());
×
74
                $this->initialState->provideInitialState('signature_width', $this->signatureTextService->getFullSignatureWidth());
×
75
                $this->initialState->provideInitialState('template_font_size', $this->signatureTextService->getTemplateFontSize());
×
76
                $this->initialState->provideInitialState('tsa_url', $this->appConfig->getValueString(Application::APP_ID, 'tsa_url', ''));
×
77
                $this->initialState->provideInitialState('tsa_policy_oid', $this->appConfig->getValueString(Application::APP_ID, 'tsa_policy_oid', ''));
×
78
                $this->initialState->provideInitialState('tsa_auth_type', $this->appConfig->getValueString(Application::APP_ID, 'tsa_auth_type', 'none'));
×
79
                $this->initialState->provideInitialState('tsa_username', $this->appConfig->getValueString(Application::APP_ID, 'tsa_username', ''));
×
80
                $this->initialState->provideInitialState('tsa_password', $this->appConfig->getValueString(Application::APP_ID, 'tsa_password', self::PASSWORD_PLACEHOLDER));
×
81
                $this->initialState->provideInitialState('docmdp_config', $this->docMdpConfigService->getConfig());
×
82
                $this->initialState->provideInitialState('signature_flow', $this->appConfig->getValueString(Application::APP_ID, 'signature_flow', \OCA\Libresign\Enum\SignatureFlow::NONE->value));
×
NEW
83
                $this->initialState->provideInitialState('signing_mode', $this->appConfig->getValueString(Application::APP_ID, 'signing_mode', 'async'));
×
NEW
84
                $this->initialState->provideInitialState('worker_type', $this->appConfig->getValueString(Application::APP_ID, 'worker_type', 'local'));
×
NEW
85
                $this->initialState->provideInitialState('envelope_enabled', $this->appConfig->getValueString(Application::APP_ID, 'envelope_enabled', '1') === '1');
×
NEW
86
                $this->initialState->provideInitialState('parallel_workers', $this->appConfig->getValueString(Application::APP_ID, 'parallel_workers', '4'));
×
87
                return new TemplateResponse(Application::APP_ID, 'admin_settings');
×
88
        }
89

90
        /**
91
         * @psalm-return 'libresign'
92
         */
93
        #[\Override]
94
        public function getSection(): string {
95
                return Application::APP_ID;
1✔
96
        }
97

98
        /**
99
         * @psalm-return 100
100
         */
101
        #[\Override]
102
        public function getPriority(): int {
103
                return 100;
1✔
104
        }
105
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc