Explorar el Código

added organizr-auth api endpoint

CauseFX hace 4 años
padre
commit
e0aa7ec112
Se han modificado 1 ficheros con 11 adiciones y 1 borrados
  1. 11 1
      api/v2/routes/root.php

+ 11 - 1
api/v2/routes/root.php

@@ -111,6 +111,17 @@ $app->any('/auth/[{group}[/{type}[/{ips}]]]', function ($request, $response, $ar
 		->withHeader('Content-Type', 'application/json;charset=UTF-8')
 		->withStatus($GLOBALS['responseCode']);
 });
+$app->any('/organizr-auth/[{group}[/{type}[/{ips}]]]', function ($request, $response, $args) {
+	$Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
+	$_GET['group'] = $args['group'] ?? 0;
+	$_GET['type'] = $args['type'] ?? 'deny';
+	$_GET['ips'] = $args['ips'] ?? '192.0.0.0';
+	$Organizr->auth();
+	$response->getBody()->write(jsonE($GLOBALS['api']));
+	return $response
+		->withHeader('Content-Type', 'application/json;charset=UTF-8')
+		->withStatus($GLOBALS['responseCode']);
+});
 $app->get('/launch', function ($request, $response, $args) {
 	$Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
 	$tabInfo = $Organizr->getUserTabsAndCategories();
@@ -131,5 +142,4 @@ $app->get('/launch', function ($request, $response, $args) {
 	return $response
 		->withHeader('Content-Type', 'application/json;charset=UTF-8')
 		->withStatus($GLOBALS['responseCode']);
-	
 });