Skip to content

Commit cf80e4e

Browse files
authored
Merge pull request #5476 from LibreSign/fix/isolate-all-dependencies
fix: isolate all dependencies
2 parents 881e237 + f658fe0 commit cf80e4e

20 files changed

Lines changed: 142 additions & 101 deletions

REUSE.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ path = [
3232
"l10n/*.js",
3333
"l10n/*.json",
3434
"Makefile",
35+
"lib/Vendor/.gitkeep",
3536
"openapi-administration.json",
3637
"openapi-full.json",
3738
"openapi.json",

composer.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,16 @@
3636
"openapi": "generate-spec --verbose && (npm run typescript:generate || echo 'Please manually regenerate the typescript OpenAPI models')",
3737
"psalm": "psalm --no-cache --threads=$(nproc)",
3838
"psalm:update-baseline": "psalm --threads=$(nproc) --update-baseline --set-baseline=tests/psalm-baseline.xml",
39+
"pre-autoload-dump": [
40+
"mkdir -p lib/Vendor"
41+
],
3942
"post-install-cmd": [
4043
"@composer bin all install --ansi",
41-
"php -d error_reporting=E_ALL\\&~E_DEPRECATED\\&~E_USER_DEPRECATED vendor-bin/php-scoper/vendor/humbug/php-scoper/bin/php-scoper add-prefix --force",
44+
"php -d error_reporting=E_ALL\\&~E_DEPRECATED\\&~E_USER_DEPRECATED vendor-bin/php-scoper/vendor/humbug/php-scoper/bin/php-scoper add-prefix --force && > lib/Vendor/.gitkeep",
4245
"composer dump-autoload -o"
4346
],
4447
"post-update-cmd": [
45-
"php -d error_reporting=E_ALL\\&~E_DEPRECATED\\&~E_USER_DEPRECATED vendor-bin/php-scoper/vendor/humbug/php-scoper/bin/php-scoper add-prefix --force",
48+
"php -d error_reporting=E_ALL\\&~E_DEPRECATED\\&~E_USER_DEPRECATED vendor-bin/php-scoper/vendor/humbug/php-scoper/bin/php-scoper add-prefix --force && > lib/Vendor/.gitkeep",
4649
"composer dump-autoload"
4750
],
4851
"test:unit": "vendor/bin/phpunit -c tests/php/phpunit.xml --no-coverage --colors=always --fail-on-warning --fail-on-risky --display-deprecations --display-phpunit-deprecations",
@@ -56,11 +59,11 @@
5659
},
5760
"autoload": {
5861
"psr-4": {
59-
"OCA\\Libresign\\": "lib/",
60-
"OCA\\Libresign\\Vendor\\mikehaertl\\pdftk\\": "lib/Vendor/php-pdftk/src/",
61-
"OCA\\Libresign\\Vendor\\mikehaertl\\shellcommand\\": "lib/Vendor/php-shellcommand/src/",
62-
"OCA\\Libresign\\Vendor\\mikehaertl\\tmp\\": "lib/Vendor/php-tmpfile/src/"
63-
}
62+
"OCA\\Libresign\\": "lib/"
63+
},
64+
"classmap": [
65+
"lib/Vendor/"
66+
]
6467
},
6568
"autoload-dev": {
6669
"psr-4": {

lib/Command/Developer/SignSetup.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
use OC\Core\Command\Base;
1313
use OCA\Libresign\Service\Install\InstallService;
1414
use OCA\Libresign\Service\Install\SignSetupService;
15+
use OCA\Libresign\Vendor\phpseclib3\Crypt\RSA;
16+
use OCA\Libresign\Vendor\phpseclib3\Exception\NoKeyLoadedException;
17+
use OCA\Libresign\Vendor\phpseclib3\File\X509;
1518
use OCP\IConfig;
16-
use phpseclib\Crypt\RSA;
17-
use phpseclib\File\X509;
1819
use Symfony\Component\Console\Input\InputInterface;
1920
use Symfony\Component\Console\Input\InputOption;
2021
use Symfony\Component\Console\Output\OutputInterface;
@@ -57,8 +58,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
5758
return 1;
5859
}
5960

60-
$rsa = new RSA();
61-
if ($rsa->loadKey($privateKey) === false) {
61+
try {
62+
$rsa = RSA::loadPrivateKey($privateKey);
63+
} catch (NoKeyLoadedException) {
6264
$output->writeln('Invalid private key');
6365
return 1;
6466
}

lib/Db/PagerFantaQueryAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
namespace OCA\Libresign\Db;
1010

1111
use Doctrine\DBAL\Query\QueryBuilder;
12+
use OCA\Libresign\Vendor\Pagerfanta\Adapter\AdapterInterface;
13+
use OCA\Libresign\Vendor\Pagerfanta\Exception\InvalidArgumentException;
1214
use OCP\DB\QueryBuilder\IQueryBuilder;
13-
use Pagerfanta\Adapter\AdapterInterface;
14-
use Pagerfanta\Exception\InvalidArgumentException;
1515

1616
/**
1717
* Adapter which calculates pagination from a Doctrine DBAL QueryBuilder.

lib/Handler/FooterHandler.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@
88

99
namespace OCA\Libresign\Handler;
1010

11-
use BaconQrCode\Encoder\Encoder;
12-
use Endroid\QrCode\Bacon\ErrorCorrectionLevelConverter;
13-
use Endroid\QrCode\Color\Color;
14-
use Endroid\QrCode\Encoding\Encoding;
15-
use Endroid\QrCode\ErrorCorrectionLevel;
16-
use Endroid\QrCode\QrCode;
17-
use Endroid\QrCode\RoundBlockSizeMode;
18-
use Endroid\QrCode\Writer\PngWriter;
19-
use Mpdf\Mpdf;
2011
use OCA\Libresign\AppInfo\Application;
2112
use OCA\Libresign\Db\File as FileEntity;
2213
use OCA\Libresign\Exception\LibresignException;
2314
use OCA\Libresign\Service\PdfParserService;
15+
use OCA\Libresign\Vendor\BaconQrCode\Encoder\Encoder;
16+
use OCA\Libresign\Vendor\Endroid\QrCode\Bacon\ErrorCorrectionLevelConverter;
17+
use OCA\Libresign\Vendor\Endroid\QrCode\Color\Color;
18+
use OCA\Libresign\Vendor\Endroid\QrCode\Encoding\Encoding;
19+
use OCA\Libresign\Vendor\Endroid\QrCode\ErrorCorrectionLevel;
20+
use OCA\Libresign\Vendor\Endroid\QrCode\QrCode;
21+
use OCA\Libresign\Vendor\Endroid\QrCode\RoundBlockSizeMode;
22+
use OCA\Libresign\Vendor\Endroid\QrCode\Writer\PngWriter;
23+
use OCA\Libresign\Vendor\Mpdf\Mpdf;
24+
use OCA\Libresign\Vendor\Twig\Environment;
25+
use OCA\Libresign\Vendor\Twig\Error\SyntaxError;
26+
use OCA\Libresign\Vendor\Twig\Loader\FilesystemLoader;
2427
use OCP\Files\File;
2528
use OCP\IAppConfig;
2629
use OCP\IL10N;
2730
use OCP\ITempManager;
2831
use OCP\IURLGenerator;
2932
use OCP\L10N\IFactory;
30-
use Twig\Environment;
31-
use Twig\Error\SyntaxError;
32-
use Twig\Loader\FilesystemLoader;
3333

3434
class FooterHandler {
3535
private QrCode $qrCode;

lib/Handler/SignEngine/JSignPdfHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
use Imagick;
1212
use ImagickPixel;
13-
use Jeidison\JSignPDF\JSignPDF;
14-
use Jeidison\JSignPDF\Sign\JSignParam;
1513
use OCA\Libresign\AppInfo\Application;
1614
use OCA\Libresign\Exception\LibresignException;
1715
use OCA\Libresign\Handler\CertificateEngine\CertificateEngineFactory;
@@ -20,6 +18,8 @@
2018
use OCA\Libresign\Service\SignatureBackgroundService;
2119
use OCA\Libresign\Service\SignatureTextService;
2220
use OCA\Libresign\Service\SignerElementsService;
21+
use OCA\Libresign\Vendor\Jeidison\JSignPDF\JSignPDF;
22+
use OCA\Libresign\Vendor\Jeidison\JSignPDF\Sign\JSignParam;
2323
use OCP\Files\File;
2424
use OCP\IAppConfig;
2525
use OCP\ITempManager;

lib/Handler/SignEngine/Pkcs12Handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
use OCA\Libresign\Handler\CertificateEngine\OrderCertificatesTrait;
1616
use OCA\Libresign\Handler\FooterHandler;
1717
use OCA\Libresign\Service\FolderService;
18+
use OCA\Libresign\Vendor\phpseclib3\File\ASN1;
1819
use OCP\Files\File;
1920
use OCP\IAppConfig;
2021
use OCP\IL10N;
2122
use OCP\ITempManager;
22-
use phpseclib3\File\ASN1;
2323
use Psr\Log\LoggerInterface;
2424

2525
class Pkcs12Handler extends SignEngineHandler {

lib/Helper/Pagination.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
namespace OCA\Libresign\Helper;
1010

1111
use OCA\Libresign\Db\PagerFantaQueryAdapter;
12+
use OCA\Libresign\Vendor\Pagerfanta\Pagerfanta;
1213
use OCP\DB\QueryBuilder\IQueryBuilder;
1314
use OCP\IURLGenerator;
14-
use Pagerfanta\Pagerfanta;
1515

1616
class Pagination extends Pagerfanta {
1717
private string $routeName;

lib/Service/IdentifyMethod/AbstractIdentifyMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
use OCA\Libresign\Helper\JSActions;
2020
use OCA\Libresign\Service\IdentifyMethod\SignatureMethod\AbstractSignatureMethod;
2121
use OCA\Libresign\Service\SessionService;
22+
use OCA\Libresign\Vendor\Wobeto\EmailBlur\Blur;
2223
use OCP\IUser;
23-
use Wobeto\EmailBlur\Blur;
2424

2525
abstract class AbstractIdentifyMethod implements IIdentifyMethod {
2626
protected IdentifyMethod $entity;

lib/Service/IdentifyMethod/SignatureMethod/EmailToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use OCA\Libresign\Exception\LibresignException;
1212
use OCA\Libresign\Helper\JSActions;
1313
use OCA\Libresign\Service\IdentifyMethod\IdentifyService;
14-
use Wobeto\EmailBlur\Blur;
14+
use OCA\Libresign\Vendor\Wobeto\EmailBlur\Blur;
1515

1616
class EmailToken extends AbstractSignatureMethod implements IToken {
1717
public function __construct(

0 commit comments

Comments
 (0)