diff --git a/lib/private/App/AppStore/Fetcher/AppFetcher.php b/lib/private/App/AppStore/Fetcher/AppFetcher.php index 9ad8f582460e70173a4ed4e9903dd3c4130194ad..ea69c37f32c9da1415b57174c7773b4576ec28fb 100644 --- a/lib/private/App/AppStore/Fetcher/AppFetcher.php +++ b/lib/private/App/AppStore/Fetcher/AppFetcher.php @@ -83,14 +83,17 @@ class AppFetcher extends Fetcher { /** @var mixed[] $response */ $response = parent::fetch($ETag, $content); + $allowPreReleases = $this->getChannel() === 'beta' || $this->getChannel() === 'daily'; + $allowNightly = $this->getChannel() === 'daily'; + foreach($response['data'] as $dataKey => $app) { $releases = []; // Filter all compatible releases foreach($app['releases'] as $release) { - // Exclude all nightly and pre-releases - if($release['isNightly'] === false - && strpos($release['version'], '-') === false) { + // Exclude all nightly and pre-releases if required + if (($allowNightly || $release['isNightly'] === false) + && ($allowPreReleases || strpos($release['version'], '-') === false)) { // Exclude all versions not compatible with the current version try { $versionParser = new VersionParser(); diff --git a/lib/private/App/AppStore/Fetcher/Fetcher.php b/lib/private/App/AppStore/Fetcher/Fetcher.php index 973c4e55e9f01255e1983d5106243f66aa7f6ec3..db8c38ac686835bed1e4183958b5bf6a3eab8182 100644 --- a/lib/private/App/AppStore/Fetcher/Fetcher.php +++ b/lib/private/App/AppStore/Fetcher/Fetcher.php @@ -57,6 +57,8 @@ abstract class Fetcher { protected $endpointUrl; /** @var string */ protected $version; + /** @var string */ + protected $channel; /** * @param Factory $appDataFactory @@ -197,4 +199,23 @@ abstract class Fetcher { public function setVersion(string $version) { $this->version = $version; } + + /** + * Get the currently Nextcloud update channel + * @return string + */ + protected function getChannel() { + if ($this->channel === null) { + $this->channel = \OC_Util::getChannel(); + } + return $this->channel; + } + + /** + * Set the current Nextcloud update channel + * @param string $channel + */ + public function setChannel(string $channel) { + $this->channel = $channel; + } }