Main update
This commit is contained in:
@@ -2,4 +2,34 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once dirname(__DIR__, 3) . '/src/App/bootstrap.php';
|
||||
|
||||
use App\CronAuth;
|
||||
use ModulesCore\ModuleHttp;
|
||||
|
||||
if (session_status() !== PHP_SESSION_ACTIVE) {
|
||||
session_start();
|
||||
}
|
||||
|
||||
$projectRoot = dirname(__DIR__, 3);
|
||||
$requestUri = (string) ($_SERVER['REQUEST_URI'] ?? '');
|
||||
$requestPath = (string) (parse_url($requestUri, PHP_URL_PATH) ?: '');
|
||||
$prefix = '/api/boersenchecker/index.php/';
|
||||
$relativePath = trim((string) ($_GET['path'] ?? ''), '/');
|
||||
|
||||
if ($relativePath === '') {
|
||||
$relativePath = str_starts_with($requestPath, $prefix)
|
||||
? substr($requestPath, strlen($prefix))
|
||||
: ltrim((string) ($_SERVER['PATH_INFO'] ?? ''), '/');
|
||||
}
|
||||
|
||||
$normalizedPath = strtolower(trim($relativePath, '/'));
|
||||
$cronPaths = [
|
||||
'v1/cron/refresh-quotes',
|
||||
];
|
||||
|
||||
if (!(in_array($normalizedPath, $cronPaths, true) && CronAuth::isAuthorizedRequest($projectRoot))) {
|
||||
ModuleHttp::requireDesktopAccess($projectRoot, true);
|
||||
}
|
||||
|
||||
require dirname(__DIR__, 3) . '/modules/boersenchecker/api/index.php';
|
||||
|
||||
@@ -4,11 +4,31 @@ declare(strict_types=1);
|
||||
|
||||
require_once dirname(__DIR__, 3) . '/src/App/bootstrap.php';
|
||||
|
||||
use App\CronAuth;
|
||||
use ModulesCore\ModuleHttp;
|
||||
|
||||
session_start();
|
||||
|
||||
$projectRoot = dirname(__DIR__, 3);
|
||||
ModuleHttp::requireDesktopAccess($projectRoot, true);
|
||||
$requestUri = (string) ($_SERVER['REQUEST_URI'] ?? '');
|
||||
$requestPath = (string) (parse_url($requestUri, PHP_URL_PATH) ?: '');
|
||||
$prefix = '/api/fx-rates/index.php/';
|
||||
$relativePath = trim((string) ($_GET['path'] ?? ''), '/');
|
||||
|
||||
if ($relativePath === '') {
|
||||
$relativePath = str_starts_with($requestPath, $prefix)
|
||||
? substr($requestPath, strlen($prefix))
|
||||
: ltrim((string) ($_SERVER['PATH_INFO'] ?? ''), '/');
|
||||
}
|
||||
|
||||
$normalizedPath = strtolower(trim($relativePath, '/'));
|
||||
$cronPaths = [
|
||||
'v1/refresh',
|
||||
'v1/currency-catalog/sync',
|
||||
];
|
||||
|
||||
if (!(in_array($normalizedPath, $cronPaths, true) && CronAuth::isAuthorizedRequest($projectRoot))) {
|
||||
ModuleHttp::requireDesktopAccess($projectRoot, true);
|
||||
}
|
||||
|
||||
require $projectRoot . '/modules/fx-rates/api/index.php';
|
||||
|
||||
Reference in New Issue
Block a user