Merge pull request #5761 from LibreSign/chore/bump-dependencies

chore: bump dependencies
This commit is contained in:
Vitor Mattos 2025-11-11 13:11:15 -03:00 committed by GitHub
commit dbc24e05fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 41 deletions

@ -1 +1 @@
Subproject commit 3ce3c293960dcc8f98a123b5b6628c43729f103e
Subproject commit 9c7bd6b3454f8b04a187956590bfb1f12b76f85b

View file

@ -12,8 +12,6 @@ use OCA\Libresign\AppInfo\Application;
use OCA\Libresign\Db\File as FileEntity;
use OCA\Libresign\Exception\LibresignException;
use OCA\Libresign\Service\PdfParserService;
use OCA\Libresign\Vendor\BaconQrCode\Encoder\Encoder;
use OCA\Libresign\Vendor\Endroid\QrCode\Bacon\ErrorCorrectionLevelConverter;
use OCA\Libresign\Vendor\Endroid\QrCode\Color\Color;
use OCA\Libresign\Vendor\Endroid\QrCode\Encoding\Encoding;
use OCA\Libresign\Vendor\Endroid\QrCode\ErrorCorrectionLevel;
@ -162,14 +160,16 @@ class FooterHandler {
}
private function getQrCodeImageBase64(string $text): string {
$this->qrCode = QrCode::create($text)
->setEncoding(new Encoding('UTF-8'))
->setErrorCorrectionLevel(ErrorCorrectionLevel::Low)
->setMargin(4)
->setRoundBlockSizeMode(RoundBlockSizeMode::Margin)
->setForegroundColor(new Color(0, 0, 0))
->setBackgroundColor(new Color(255, 255, 255));
$this->setQrCodeSize();
$this->qrCode = new QrCode(
data: $text,
encoding: new Encoding('UTF-8'),
errorCorrectionLevel: ErrorCorrectionLevel::Low,
size: self::MIN_QRCODE_SIZE,
margin: 4,
roundBlockSizeMode: RoundBlockSizeMode::Margin,
foregroundColor: new Color(0, 0, 0),
backgroundColor: new Color(255, 255, 255)
);
$writer = new PngWriter();
$result = $writer->write($this->qrCode);
$qrcode = base64_encode($result->getString());
@ -178,34 +178,4 @@ class FooterHandler {
return $qrcode;
}
private function setQrCodeSize(): void {
$blockValues = $this->getQrCodeBlocks();
$this->qrCode->setSize(self::MIN_QRCODE_SIZE);
$blockSize = $this->qrCode->getSize() / count($blockValues);
if ($blockSize < 1) {
$this->qrCode->setSize(count($blockValues));
}
}
/**
* @return int[][]
*
* @psalm-return array<0|positive-int, array<0|positive-int, int>>
*/
private function getQrCodeBlocks(): array {
$baconErrorCorrectionLevel = ErrorCorrectionLevelConverter::convertToBaconErrorCorrectionLevel($this->qrCode->getErrorCorrectionLevel());
$baconMatrix = Encoder::encode($this->qrCode->getData(), $baconErrorCorrectionLevel, strval($this->qrCode->getEncoding()))->getMatrix();
$blockValues = [];
$columnCount = $baconMatrix->getWidth();
$rowCount = $baconMatrix->getHeight();
for ($rowIndex = 0; $rowIndex < $rowCount; ++$rowIndex) {
$blockValues[$rowIndex] = [];
for ($columnIndex = 0; $columnIndex < $columnCount; ++$columnIndex) {
$blockValues[$rowIndex][$columnIndex] = $baconMatrix->get($columnIndex, $rowIndex);
}
}
return $blockValues;
}
}