summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-03-12 13:41:42 +0100
committerBenjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>2024-03-14 20:45:24 +0100
commitf4efb762ecfa5e47cf76178f6a9be5ff1b829042 (patch)
tree3cf652c34a977e68df1e1824dc688635191533c6 /apps
parent4cadb828502dce74f8ce41f85c21fceb15954cf6 (diff)
downloadnextcloud-server-f4efb762ecfa5e47cf76178f6a9be5ff1b829042.tar.gz
nextcloud-server-f4efb762ecfa5e47cf76178f6a9be5ff1b829042.zip
feat: Allow to fetch app discover json and provide frontend API route
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps')
-rw-r--r--apps/settings/appinfo/routes.php1
-rw-r--r--apps/settings/lib/Controller/AppSettingsController.php14
2 files changed, 15 insertions, 0 deletions
diff --git a/apps/settings/appinfo/routes.php b/apps/settings/appinfo/routes.php
index 7bb946d1934..6eea170fe39 100644
--- a/apps/settings/appinfo/routes.php
+++ b/apps/settings/appinfo/routes.php
@@ -39,6 +39,7 @@ return [
['name' => 'MailSettings#storeCredentials', 'url' => '/settings/admin/mailsettings/credentials', 'verb' => 'POST' , 'root' => ''],
['name' => 'MailSettings#sendTestMail', 'url' => '/settings/admin/mailtest', 'verb' => 'POST' , 'root' => ''],
+ ['name' => 'AppSettings#getAppDiscoverJSON', 'url' => '/settings/api/apps/discover', 'verb' => 'GET', 'root' => ''],
['name' => 'AppSettings#listCategories', 'url' => '/settings/apps/categories', 'verb' => 'GET' , 'root' => ''],
['name' => 'AppSettings#viewApps', 'url' => '/settings/apps', 'verb' => 'GET' , 'root' => ''],
['name' => 'AppSettings#listApps', 'url' => '/settings/apps/list', 'verb' => 'GET' , 'root' => ''],
diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php
index 407cd6d9b6a..58869537c44 100644
--- a/apps/settings/lib/Controller/AppSettingsController.php
+++ b/apps/settings/lib/Controller/AppSettingsController.php
@@ -14,6 +14,7 @@
* @author Roeland Jago Douma <roeland@famdouma.nl>
* @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Kate Döen <kate.doeen@nextcloud.com>
+ * @author Ferdinand Thiessen <opensource@fthiessen.de>
*
* @license AGPL-3.0
*
@@ -33,6 +34,7 @@
namespace OCA\Settings\Controller;
use OC\App\AppStore\Bundles\BundleFetcher;
+use OC\App\AppStore\Fetcher\AppDiscoverFetcher;
use OC\App\AppStore\Fetcher\AppFetcher;
use OC\App\AppStore\Fetcher\CategoryFetcher;
use OC\App\AppStore\Version\VersionParser;
@@ -77,6 +79,7 @@ class AppSettingsController extends Controller {
private IURLGenerator $urlGenerator,
private LoggerInterface $logger,
private IInitialState $initialState,
+ private AppDiscoverFetcher $discoverFetcher,
) {
parent::__construct($appName, $request);
}
@@ -106,6 +109,16 @@ class AppSettingsController extends Controller {
return $templateResponse;
}
+ /**
+ * Get all active entries for the app discover section
+ *
+ * @NoCSRFRequired
+ */
+ public function getAppDiscoverJSON(): JSONResponse {
+ $data = $this->discoverFetcher->get();
+ return new JSONResponse($data);
+ }
+
private function getAppsWithUpdates() {
$appClass = new \OC_App();
$apps = $appClass->listAllApps();
@@ -190,6 +203,7 @@ class AppSettingsController extends Controller {
private function getAllApps() {
return $this->allApps;
}
+
/**
* Get all available apps in a category
*