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

LibreSign / libresign / 22354645759

24 Feb 2026 02:15PM UTC coverage: 52.896%. First build
22354645759

Pull #6993

github

web-flow
Merge d1c9799cb into 398ef479e
Pull Request #6993: feat: vue3 typescript migration

1 of 10 new or added lines in 4 files covered. (10.0%)

9425 of 17818 relevant lines covered (52.9%)

6.38 hits per line

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

6.25
/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\DocMdp\ConfigService as 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');
×
NEW
44
                Util::addStyle(Application::APP_ID, 'libresign-settings');
×
45
                try {
46
                        $signatureParsed = $this->signatureTextService->parse();
×
47
                        $this->initialState->provideInitialState('signature_text_parsed', $signatureParsed['parsed']);
×
48
                } catch (LibresignException $e) {
×
49
                        $this->initialState->provideInitialState('signature_text_parsed', '');
×
50
                        $this->initialState->provideInitialState('signature_text_template_error', $e->getMessage());
×
51
                }
52
                $this->initialState->provideInitialState('certificate_engine', $this->certificateEngineFactory->getEngine()->getName());
×
53
                $this->initialState->provideInitialState('certificate_policies_oid', $this->certificatePolicyService->getOid());
×
54
                $this->initialState->provideInitialState('certificate_policies_cps', $this->certificatePolicyService->getCps());
×
55
                $this->initialState->provideInitialState('config_path', $this->appConfig->getValueString(Application::APP_ID, 'config_path'));
×
56
                $this->initialState->provideInitialState('default_signature_font_size', SignatureTextService::SIGNATURE_DEFAULT_FONT_SIZE);
×
57
                $this->initialState->provideInitialState('default_signature_height', SignatureTextService::DEFAULT_SIGNATURE_HEIGHT);
×
58
                $this->initialState->provideInitialState('default_signature_text_template', $this->signatureTextService->getDefaultTemplate());
×
59
                $this->initialState->provideInitialState('default_signature_width', SignatureTextService::DEFAULT_SIGNATURE_WIDTH);
×
60
                $this->initialState->provideInitialState('default_template_font_size', $this->signatureTextService->getDefaultTemplateFontSize());
×
61
                $this->initialState->provideInitialState('identify_methods', $this->identifyMethodService->getIdentifyMethodsSettings());
×
NEW
62
                $this->initialState->provideInitialState('legal_information', $this->appConfig->getValueString(Application::APP_ID, 'legal_information', ''));
×
63
                $this->initialState->provideInitialState('signature_available_variables', $this->signatureTextService->getAvailableVariables());
×
64
                $this->initialState->provideInitialState('signature_background_type', $this->signatureBackgroundService->getSignatureBackgroundType());
×
65
                $this->initialState->provideInitialState('signature_font_size', $this->signatureTextService->getSignatureFontSize());
×
66
                $this->initialState->provideInitialState('signature_height', $this->signatureTextService->getFullSignatureHeight());
×
67
                $this->initialState->provideInitialState('signature_preview_zoom_level', $this->appConfig->getValueFloat(Application::APP_ID, 'signature_preview_zoom_level', 100));
×
68
                $this->initialState->provideInitialState('footer_preview_zoom_level', $this->appConfig->getValueFloat(Application::APP_ID, 'footer_preview_zoom_level', 100));
×
69
                $this->initialState->provideInitialState('footer_preview_width', $this->appConfig->getValueInt(Application::APP_ID, 'footer_preview_width', 595));
×
70
                $this->initialState->provideInitialState('footer_preview_height', $this->appConfig->getValueInt(Application::APP_ID, 'footer_preview_height', 100));
×
71
                $this->initialState->provideInitialState('footer_template_variables', $this->footerService->getTemplateVariablesMetadata());
×
72
                $this->initialState->provideInitialState('footer_template', $this->footerService->getTemplate());
×
73
                $this->initialState->provideInitialState('footer_template_is_default', $this->footerService->isDefaultTemplate());
×
74
                $this->initialState->provideInitialState('signature_render_mode', $this->signatureTextService->getRenderMode());
×
75
                $this->initialState->provideInitialState('signature_text_template', $this->signatureTextService->getTemplate());
×
76
                $this->initialState->provideInitialState('signature_width', $this->signatureTextService->getFullSignatureWidth());
×
77
                $this->initialState->provideInitialState('template_font_size', $this->signatureTextService->getTemplateFontSize());
×
78
                $this->initialState->provideInitialState('tsa_url', $this->appConfig->getValueString(Application::APP_ID, 'tsa_url', ''));
×
79
                $this->initialState->provideInitialState('tsa_policy_oid', $this->appConfig->getValueString(Application::APP_ID, 'tsa_policy_oid', ''));
×
80
                $this->initialState->provideInitialState('tsa_auth_type', $this->appConfig->getValueString(Application::APP_ID, 'tsa_auth_type', 'none'));
×
81
                $this->initialState->provideInitialState('tsa_username', $this->appConfig->getValueString(Application::APP_ID, 'tsa_username', ''));
×
82
                $this->initialState->provideInitialState('tsa_password', $this->appConfig->getValueString(Application::APP_ID, 'tsa_password', self::PASSWORD_PLACEHOLDER));
×
83
                $this->initialState->provideInitialState('docmdp_config', $this->docMdpConfigService->getConfig());
×
84
                $this->initialState->provideInitialState('signature_flow', $this->appConfig->getValueString(Application::APP_ID, 'signature_flow', \OCA\Libresign\Enum\SignatureFlow::NONE->value));
×
85
                $this->initialState->provideInitialState('signing_mode', $this->appConfig->getValueString(Application::APP_ID, 'signing_mode', 'sync'));
×
86
                $this->initialState->provideInitialState('worker_type', $this->appConfig->getValueString(Application::APP_ID, 'worker_type', 'local'));
×
87
                $this->initialState->provideInitialState('envelope_enabled', $this->appConfig->getValueString(Application::APP_ID, 'envelope_enabled', '1') === '1');
×
88
                $this->initialState->provideInitialState('parallel_workers', $this->appConfig->getValueString(Application::APP_ID, 'parallel_workers', '4'));
×
89
                return new TemplateResponse(Application::APP_ID, 'admin_settings');
×
90
        }
91

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

100
        /**
101
         * @psalm-return 100
102
         */
103
        #[\Override]
104
        public function getPriority(): int {
105
                return 100;
1✔
106
        }
107
}
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