diff --git a/src/Helpers/Build.php b/src/Helpers/Build.php index cce36ffe7d7f51148666b42eabb69dc227f0027e..7e2df2d18bb8fd87e541e47869a35dd67713d4b2 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 = false) { $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 dc0a413b7a0c1ed7b6b45d80839e02deb7eb98fa..add41407d48719c9833b8be53faed15860ccc54f 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'])) {