Skip to content

Commit c4d1a52

Browse files
committed
get routes from cache folder (wip)
1 parent 9c09b2a commit c4d1a52

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

core/models/Users.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public function user_manage_key_permissions_validate($id, $data, $user_id)
208208

209209
// make sure V2 permissions are valid
210210
if ($data['permissions_v2'] !== '') {
211-
$routes = json_decode(file_get_contents(OB_LOCAL . '/routes.json'), true);
211+
$routes = json_decode(file_get_contents(OB_CACHE . '/routes.json'), true);
212212
$permissions = preg_split('/\r\n|\r|\n/', $data['permissions_v2']);
213213
foreach ($permissions as $permission) {
214214
[$method, $route] = explode(' ', $permission);

core/support/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public function auth_appkey($appkey, $requests)
283283
}
284284
} else {
285285
// Permissions check for new v2 API.
286-
$routes = json_decode(file_get_contents(OB_LOCAL . '/routes.json'), true);
286+
$routes = json_decode(file_get_contents(OB_CACHE . '/routes.json'), true);
287287
$permissions = json_decode($result['permissions_v2'], true);
288288

289289
foreach ($requests as $request) {

public/api.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ public function __construct()
2929

3030
if (str_starts_with($_SERVER['REQUEST_URI'], '/api/v2/')) {
3131
// we have routes for this request method? find the regex pattern to match with, and variables to extract.
32-
$routes = json_decode(file_get_contents(OB_LOCAL . '/routes.json'));
32+
$routes = json_decode(file_get_contents(OB_CACHE . '/routes.json'));
33+
3334
if ($routes && is_object($routes) && property_exists($routes, $_SERVER['REQUEST_METHOD'])) {
3435
$this->routes = $routes->{$_SERVER['REQUEST_METHOD']};
3536
foreach ($this->routes as &$route) {

0 commit comments

Comments
 (0)