From 3fa611f0f51df30674148316a5c886eee1bfe86c Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Thu, 30 Jan 2025 09:28:29 -0300 Subject: [PATCH] refactor: moved hashes to be close to version number This will make more easy when we need to update the version of dependencies. Signed-off-by: Vitor Mattos --- lib/Service/Install/InstallService.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/Service/Install/InstallService.php b/lib/Service/Install/InstallService.php index 690576fac..0335d747d 100644 --- a/lib/Service/Install/InstallService.php +++ b/lib/Service/Install/InstallService.php @@ -41,12 +41,12 @@ class InstallService { public const JAVA_VERSION = 'openjdk version "21.0.6" 2025-01-21 LTS'; private const JAVA_URL_PATH_NAME = '21.0.6+7'; - public const PDFTK_VERSION = '3.3.3'; - public const JSIGNPDF_VERSION = '2.3.0'; - /** - * When update, verify the hash of all architectures - */ + public const PDFTK_VERSION = '3.3.3'; /** @todo When update, verify the hash **/ + private const PDFTK_HASH = '59a28bed53b428595d165d52988bf4cf'; + public const JSIGNPDF_VERSION = '2.3.0'; /** @todo When update, verify the hash **/ + private const JSIGNPDF_HASH = 'd239658ea50a39eb35169d8392feaffb'; public const CFSSL_VERSION = '1.6.5'; + private ICache $cache; private ?OutputInterface $output = null; private string $resource = ''; @@ -484,10 +484,8 @@ public function installJSignPdf(?bool $async = false): void { } $comporessedInternalFileName = $this->getInternalPathOfFile($compressedFile); $url = 'https://github.com/intoolswetrust/jsignpdf/releases/download/JSignPdf_' . str_replace('.', '_', InstallService::JSIGNPDF_VERSION) . '/jsignpdf-' . InstallService::JSIGNPDF_VERSION . '.zip'; - /** WHEN UPDATE version: generate this hash handmade and update here */ - $hash = 'd239658ea50a39eb35169d8392feaffb'; - $this->download($url, 'JSignPdf', $comporessedInternalFileName, $hash); + $this->download($url, 'JSignPdf', $comporessedInternalFileName, self::JSIGNPDF_HASH); $extractDir = $this->getInternalPathOfFolder($folder); $zip = new ZIP($extractDir . '/' . $compressedFileName); @@ -539,10 +537,8 @@ public function installPdftk(?bool $async = false): void { } $fullPath = $this->getInternalPathOfFile($file); $url = 'https://gitlab.com/api/v4/projects/5024297/packages/generic/pdftk-java/v' . self::PDFTK_VERSION . '/pdftk-all.jar'; - /** @todo WHEN UPDATE version: generate this hash handmade and update here */ - $hash = '59a28bed53b428595d165d52988bf4cf'; - $this->download($url, 'pdftk', $fullPath, $hash); + $this->download($url, 'pdftk', $fullPath, self::PDFTK_HASH); $this->appConfig->setValueString(Application::APP_ID, 'pdftk_path', $fullPath); $this->writeAppSignature(); }