FX Modul
All checks were successful
Deploy / deploy-staging (push) Successful in 7s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-04-29 00:46:40 +02:00
parent 8140f1e1b1
commit 1dd74d4674
10 changed files with 1428 additions and 2 deletions

View File

@@ -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], '/');