Skip to content

Commit 24f7420

Browse files
committed
perf(appstore): only send what is needed in app listing
reduces transfered data from 6MiB to <1MiB Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 0c6f5ce commit 24f7420

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

apps/appstore/lib/Controller/ApiController.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,11 @@ public function listCategories(): DataResponse {
7676

7777
/**
7878
* Get all available apps
79+
*
80+
* @param bool $details - Whether to include detailed appstore information about the app
7981
*/
8082
#[ApiRoute('GET', '/api/v1/apps')]
81-
public function listApps(): DataResponse {
83+
public function listApps($details = false): DataResponse {
8284
$apps = $this->getAllApps();
8385

8486
$ignoreMaxApps = $this->config->getSystemValue('app_install_overwrite', []);
@@ -88,12 +90,16 @@ public function listApps(): DataResponse {
8890
}
8991

9092
// Extend existing app details
91-
$apps = array_map(function (array $appData) use ($ignoreMaxApps) {
93+
$apps = array_map(function (array $appData) use ($ignoreMaxApps, $details) {
9294
if (isset($appData['appstoreData'])) {
9395
$appstoreData = $appData['appstoreData'];
9496
$appData['screenshot'] = $this->createProxyPreviewUrl($appstoreData['screenshots'][0]['url'] ?? '');
9597
$appData['category'] = $appstoreData['categories'];
9698
$appData['releases'] = $appstoreData['releases'];
99+
100+
if (!$details) {
101+
unset($appData['appstoreData']);
102+
}
97103
}
98104

99105
$newVersion = $this->installer->isUpdateAvailable($appData['id']);
@@ -174,6 +180,7 @@ public function enableApp(string $appId, array $groups = []): DataResponse {
174180
public function disableApp(string $appId): DataResponse {
175181
try {
176182
$appId = $this->appManager->cleanAppId($appId);
183+
$this->appManager->removeOverwriteNextcloudRequirement($appId);
177184
$this->appManager->disableApp($appId);
178185
return new DataResponse([]);
179186
} catch (\Exception $e) {

0 commit comments

Comments
 (0)