Browse Source

added new plugins/marketplace api endpoint

CauseFX 4 years ago
parent
commit
0846e22aed
1 changed files with 13 additions and 0 deletions
  1. 13 0
      api/v2/routes/plugins.php

+ 13 - 0
api/v2/routes/plugins.php

@@ -53,4 +53,17 @@ $app->delete('/plugins/manage/{plugin}', function ($request, $response, $args) {
 	return $response
 		->withHeader('Content-Type', 'application/json;charset=UTF-8')
 		->withStatus($GLOBALS['responseCode']);
+});
+$app->get('/plugins/marketplace', function ($request, $response, $args) {
+	$Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
+	if ($Organizr->checkRoute($request)) {
+		if ($Organizr->qualifyRequest(1, true)) {
+			$GLOBALS['api']['response']['data'] = $Organizr->getPluginsMarketplace();
+		}
+		
+	}
+	$response->getBody()->write(jsonE($GLOBALS['api']));
+	return $response
+		->withHeader('Content-Type', 'application/json;charset=UTF-8')
+		->withStatus($GLOBALS['responseCode']);
 });