Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/private/App/AppStore/Fetcher/AppFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,17 @@ protected function fetch($ETag, $content) {
/** @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();
Expand Down
21 changes: 21 additions & 0 deletions lib/private/App/AppStore/Fetcher/Fetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ abstract class Fetcher {
protected $endpointUrl;
/** @var string */
protected $version;
/** @var string */
protected $channel;

/**
* @param Factory $appDataFactory
Expand Down Expand Up @@ -197,4 +199,23 @@ protected function getVersion() {
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;
}
}