From d962b55fbbf1e58fd0ee7c9d0f334823f6c84cf3 Mon Sep 17 00:00:00 2001 From: Alexandre Roux Date: Thu, 13 Oct 2022 13:39:37 +0000 Subject: [PATCH 1/2] remove maintenance number on older updater --- src/Helpers/Build.php | 5 ++++- src/Helpers/Builds.php | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Helpers/Build.php b/src/Helpers/Build.php index cce36ff..eaca723 100644 --- a/src/Helpers/Build.php +++ b/src/Helpers/Build.php @@ -51,7 +51,7 @@ * @param type $fileName The current filename of the build * @param type $physicalPath The current path where the build lives */ - public function __construct($fileName, $physicalPath, $logger) + public function __construct($fileName, $physicalPath, $logger, $shouldDisplayPatch) { $this->logger = $logger; @@ -90,6 +90,9 @@ $this->apiLevel = $this->getBuildPropValue('ro.build.version.sdk') ?? ''; $this->model = $this->getBuildPropValue('ro.lineage.device') ?? $this->getBuildPropValue('ro.cm.device') ?? ($tokens[1] == 'cm' ? $tokens[9] : $tokens[8]); $this->version = $tokens[2]; + if(substr_count($this->version, ".") > 1 && !$shouldDisplayPatch) { + $this->version = substr($this->version, 0, strrpos($this->version, '.'));//remove maintenance number when using an old updater to avoid crash + } $this->preversion = $tokens[3]; $this->displayVersion = $this->getBuildPropValue('ro.cm.display.version') ?? $this->getBuildPropValue('ro.lineage.display.version') ?? ''; $this->androidVersion = $this->getBuildPropValue('ro.build.version.release') ?? ''; diff --git a/src/Helpers/Builds.php b/src/Helpers/Builds.php index dc0a413..add4140 100644 --- a/src/Helpers/Builds.php +++ b/src/Helpers/Builds.php @@ -160,7 +160,11 @@ private function getBuilds() { $params = $this->postData['params']; - + preg_match_all('/.*(eOS) v([0-9\.]+)-?((alpha|beta|rc)(\.\d)?)?.*/', $_SERVER['HTTP_USER_AGENT'], $currentTokens); + $shouldDisplayPatch=false; + if(count($currentTokens[0])>0){ + $shouldDisplayPatch = true; + } $device = isset($params['device']) ? $params['device'] : ''; $channels = isset($params['channels']) ? $params['channels'][0] : ''; @@ -189,12 +193,12 @@ // If not found there, we have to find it with the old fashion method... if ($build === false) { - $build = new Build($file, $dir, $this->logger); + $build = new Build($file, $dir, $this->logger, $shouldDisplayPatch); // ...and then save it for 72h until it expires again apcu_store($file, $build, 72*60*60); } } else { - $build = new Build($file, $dir, $this->logger); + $build = new Build($file, $dir, $this->logger, $shouldDisplayPatch); } if ($build->includeInResults($this->postData['params'])) { -- GitLab From 802b98c1532cc0b52bb1c55dba9658b212e5cd8a Mon Sep 17 00:00:00 2001 From: Alexandre Roux Date: Wed, 2 Nov 2022 14:25:38 +0000 Subject: [PATCH 2/2] default shoudDisplayPatch to False --- src/Helpers/Build.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Helpers/Build.php b/src/Helpers/Build.php index eaca723..7e2df2d 100644 --- a/src/Helpers/Build.php +++ b/src/Helpers/Build.php @@ -51,7 +51,7 @@ * @param type $fileName The current filename of the build * @param type $physicalPath The current path where the build lives */ - public function __construct($fileName, $physicalPath, $logger, $shouldDisplayPatch) + public function __construct($fileName, $physicalPath, $logger, $shouldDisplayPatch = false) { $this->logger = $logger; -- GitLab