fix(core): harden settlement and wallet integration

This commit is contained in:
wchino
2026-07-22 01:40:37 +08:00
parent 150c3e7ebd
commit 35f6e46958
54 changed files with 2564 additions and 359 deletions

View File

@@ -1,5 +1,31 @@
<?php
$configuredAllowedOrigins = trim((string) env('REVERB_ALLOWED_ORIGINS', ''));
if ($configuredAllowedOrigins === '') {
$configuredAllowedOrigins = trim((string) env('CORS_ALLOWED_ORIGINS', ''));
}
if ($configuredAllowedOrigins === '' && env('APP_ENV', 'production') === 'local') {
$configuredAllowedOrigins = 'localhost,127.0.0.1';
}
$allowedOrigins = array_values(array_unique(array_filter(array_map(
static function (string $origin): string {
$origin = trim($origin);
if ($origin === '' || $origin === '*') {
return '';
}
if (str_starts_with($origin, '*.')) {
return strtolower($origin);
}
$host = parse_url(str_contains($origin, '://') ? $origin : '//'.$origin, PHP_URL_HOST);
return is_string($host) ? strtolower($host) : '';
},
explode(',', $configuredAllowedOrigins),
))));
return [
/*
|--------------------------------------------------------------------------
@@ -78,7 +104,7 @@ return [
'scheme' => env('REVERB_SCHEME', 'https'),
'useTLS' => env('REVERB_SCHEME', 'https') === 'https',
],
'allowed_origins' => ['*'],
'allowed_origins' => $allowedOrigins,
'ping_interval' => env('REVERB_APP_PING_INTERVAL', 60),
'activity_timeout' => env('REVERB_APP_ACTIVITY_TIMEOUT', 30),
'max_connections' => env('REVERB_APP_MAX_CONNECTIONS'),