Skip to content

Commit

Permalink
fixup! Restore old behavior allowing to set custom appstore
Browse files Browse the repository at this point in the history
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
  • Loading branch information
rullzer committed Dec 19, 2019
1 parent c20b01b commit 389bb41
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
1 change: 0 additions & 1 deletion lib/private/App/AppStore/Fetcher/AppFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public function __construct(Factory $appDataFactory,
);

$this->fileName = 'apps.json';
$this->endpointUrl = $this->getEndpoint($this->fileName);
$this->compareVersion = $compareVersion;
$this->ignoreMaxVersion = true;
}
Expand Down
1 change: 0 additions & 1 deletion lib/private/App/AppStore/Fetcher/CategoryFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,5 @@ public function __construct(Factory $appDataFactory,
$logger
);
$this->fileName = 'categories.json';
$this->endpointUrl = $this->getEndpoint($this->fileName);
}
}
8 changes: 3 additions & 5 deletions lib/private/App/AppStore/Fetcher/Fetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ abstract class Fetcher {
/** @var string */
protected $fileName;
/** @var string */
protected $endpointUrl;
/** @var string */
protected $version;
/** @var string */
protected $channel;
Expand Down Expand Up @@ -106,7 +104,7 @@ protected function fetch($ETag, $content) {
}

$client = $this->clientService->newClient();
$response = $client->get($this->endpointUrl, $options);
$response = $client->get($this->getEndpoint(), $options);

$responseJson = [];
if ($response->getStatusCode() === Http::STATUS_NOT_MODIFIED) {
Expand Down Expand Up @@ -220,7 +218,7 @@ public function setChannel(string $channel) {
$this->channel = $channel;
}

protected function getEndpoint(string $fileName): string {
return $this->config->getSystemValue('appstoreurl', 'https://apps.nextcloud.com/api/v1') . '/' . $fileName;
protected function getEndpoint(): string {
return $this->config->getSystemValue('appstoreurl', 'https://apps.nextcloud.com/api/v1') . '/' . $this->fileName;
}
}
15 changes: 15 additions & 0 deletions tests/lib/App/AppStore/Fetcher/FetcherBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ public function testGetWithNotExistingFileAndUpToDateTimestampAndVersion() {
$this->config
->expects($this->at(3))
->method('getSystemValue')
->with('appstoreurl', 'https://apps.nextcloud.com/api/v1')
->willReturn('https://apps.nextcloud.com/api/v1');
$this->config
->expects($this->at(4))
->method('getSystemValue')
->with(
$this->equalTo('version'),
$this->anything()
Expand Down Expand Up @@ -298,6 +303,11 @@ public function testGetWithAlreadyExistingFileAndNoVersion() {
$this->config
->expects($this->at(3))
->method('getSystemValue')
->with('appstoreurl', 'https://apps.nextcloud.com/api/v1')
->willReturn('https://apps.nextcloud.com/api/v1');
$this->config
->expects($this->at(4))
->method('getSystemValue')
->with(
$this->equalTo('version'),
$this->anything()
Expand Down Expand Up @@ -382,6 +392,11 @@ public function testGetWithAlreadyExistingFileAndOutdatedVersion() {
$this->config
->expects($this->at(3))
->method('getSystemValue')
->with('appstoreurl', 'https://apps.nextcloud.com/api/v1')
->willReturn('https://apps.nextcloud.com/api/v1');
$this->config
->expects($this->at(4))
->method('getSystemValue')
->with(
$this->equalTo('version'),
$this->anything()
Expand Down

0 comments on commit 389bb41

Please sign in to comment.