summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranoy <anoymouserver+github@mailbox.org>2022-07-02 14:58:02 +0200
committeranoy <anoymouserver@users.noreply.github.com>2022-07-03 09:40:01 +0200
commit89eb6a65847d334018df9d7c2b7cb755e0a1ff56 (patch)
treefff3f0522c4f1ee0870f4a73dbdf82997b01aee3
parentfa3a2c56dee012aafffa80506171e2313e89b4c6 (diff)
add CORS and version endpoint for API v2
Signed-off-by: anoy <anoymouserver+github@mailbox.org>
-rw-r--r--appinfo/routes.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/appinfo/routes.php b/appinfo/routes.php
index 7799a3e4a..3f5b8eb23 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -61,17 +61,13 @@ return ['routes' => [
// general API
['name' => 'api#index', 'url' => '/api', 'verb' => 'GET'],
-// API 2
-['name' => 'folder_api_v2#create', 'url' => '/api/v2/folders', 'verb' => 'POST'],
-['name' => 'folder_api_v2#update', 'url' => '/api/v2/folders/{folderId}', 'verb' => 'PATCH'],
-['name' => 'folder_api_v2#delete', 'url' => '/api/v2/folders/{folderId}', 'verb' => 'DELETE'],
+['name' => 'utility_api#preflighted_cors', 'url' => '/api/{apiVersion}/{path}', 'verb' => 'OPTIONS', 'requirements' => ['apiVersion' => 'v(1-[23]|2)', 'path' => '.+']],
+['name' => 'utility_api#version', 'url' => '/api/{apiVersion}/version', 'verb' => 'GET', 'requirements' => ['apiVersion' => 'v(1-[23]|2)']],
// API 1.x
-['name' => 'utility_api#version', 'url' => '/api/{apiVersion}/version', 'verb' => 'GET', 'requirements' => ['apiVersion' => 'v1-[23]']],
['name' => 'utility_api#status', 'url' => '/api/{apiVersion}/status', 'verb' => 'GET', 'requirements' => ['apiVersion' => 'v1-[23]']],
['name' => 'utility_api#before_update', 'url' => '/api/{apiVersion}/cleanup/before-update', 'verb' => 'GET', 'requirements' => ['apiVersion' => 'v1-[23]']],
['name' => 'utility_api#after_update', 'url' => '/api/{apiVersion}/cleanup/after-update', 'verb' => 'GET', 'requirements' => ['apiVersion' => 'v1-[23]']],
-['name' => 'utility_api#preflighted_cors', 'url' => '/api/{apiVersion}/{path}', 'verb' => 'OPTIONS', 'requirements' => ['apiVersion' => 'v1-[23]', 'path' => '.+']],
// folders
['name' => 'folder_api#index', 'url' => '/api/{apiVersion}/folders', 'verb' => 'GET', 'requirements' => ['apiVersion' => 'v1-[23]']],
@@ -117,4 +113,9 @@ return ['routes' => [
['name' => 'item_api#unstar_multiple_by_item_ids', 'url' => '/api/{apiVersion}/items/unstar/multiple', 'verb' => 'POST', 'requirements' => ['apiVersion' => 'v1-3']],
['name' => 'item_api#unstar_multiple', 'url' => '/api/v1-2/items/unstar/multiple', 'verb' => 'PUT'], // Backward compatibility. Corrected HTTP method as of v1.3
+// API 2
+['name' => 'folder_api_v2#create', 'url' => '/api/v2/folders', 'verb' => 'POST'],
+['name' => 'folder_api_v2#update', 'url' => '/api/v2/folders/{folderId}', 'verb' => 'PATCH'],
+['name' => 'folder_api_v2#delete', 'url' => '/api/v2/folders/{folderId}', 'verb' => 'DELETE'],
+
]];