Skip to content

Commit

Permalink
Restore old behavior allowing to set custom appstore
Browse files Browse the repository at this point in the history
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
  • Loading branch information
georgehrke committed Dec 17, 2019
1 parent 76895b6 commit 9d4cee8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/private/App/AppStore/Fetcher/AppFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ protected function fetch($ETag, $content) {
}

private function setEndpoint() {
$this->endpointUrl = 'https://apps.nextcloud.com/api/v1/apps.json';
$endpoint = $this->config->getSystemValue('appstoreurl', 'https://apps.nextcloud.com/api/v1');
$this->endpointUrl = $endpoint . '/apps.json';
}

/**
Expand Down
4 changes: 3 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,8 @@ public function __construct(Factory $appDataFactory,
$logger
);
$this->fileName = 'categories.json';
$this->endpointUrl = 'https://apps.nextcloud.com/api/v1/categories.json';

$endpoint = $this->config->getSystemValue('appstoreurl', 'https://apps.nextcloud.com/api/v1');
$this->endpointUrl = $endpoint . '/categories.json';
}
}
4 changes: 3 additions & 1 deletion tests/lib/App/AppStore/Fetcher/AppFetcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public function testGetWithFilter() {
return true;
} else if ($key === 'version') {
return '11.0.0.2';
} else if ($key === 'appstoreurl' && $default === 'https://apps.nextcloud.com/api/v1') {
return 'https://custom.appsstore.endpoint/api/v1';
} else {
return $default;
}
Expand Down Expand Up @@ -122,7 +124,7 @@ public function testGetWithFilter() {
$response = $this->createMock(IResponse::class);
$client
->method('get')
->with('https://apps.nextcloud.com/api/v1/apps.json')
->with('https://custom.appsstore.endpoint/api/v1/apps.json')
->willReturn($response);
$response
->expects($this->once())
Expand Down

0 comments on commit 9d4cee8

Please sign in to comment.