FX Modul
This commit is contained in:
@@ -160,6 +160,35 @@ if (preg_match('~^api/mining-checker(?:/(.*))?$~', $uriPath, $apiMatches)) {
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('~^api/fx-rates(?:/(.*))?$~', $uriPath, $apiMatches)) {
|
||||
$moduleMeta = app()->modules()->get('fx-rates') ?? ['auth' => ['required' => false]];
|
||||
if (!$auth->canAccessModule($moduleMeta)) {
|
||||
http_response_code($auth->isAuthenticated() ? 403 : 401);
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode([
|
||||
'error' => $auth->isAuthenticated() ? 'forbidden' : 'auth_required',
|
||||
'login_url' => '/auth/login',
|
||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once $projectRoot . '/modules/fx-rates/bootstrap.php';
|
||||
app()->modules()->runDueIntervalTasks('fx-rates');
|
||||
|
||||
try {
|
||||
$service = module_fn('fx-rates', 'service');
|
||||
(new \Modules\FxRates\Api\Router($service))->handle($apiMatches[1] ?? '');
|
||||
} catch (Throwable $exception) {
|
||||
http_response_code(500);
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode([
|
||||
'error' => 'Unerwarteter FX-Module Fehler.',
|
||||
'context' => ['message' => $exception->getMessage()],
|
||||
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (preg_match('~^module-assets/([a-zA-Z0-9_-]+)/(.*)$~', $uriPath, $assetMatches)) {
|
||||
$module = $assetMatches[1];
|
||||
$relativeAssetPath = trim($assetMatches[2], '/');
|
||||
|
||||
Reference in New Issue
Block a user