chore: clean local URLs from release artifacts

This commit is contained in:
wushumin
2026-05-25 16:45:48 +08:00
parent 91be380751
commit 0b5c7c55a8
4 changed files with 16 additions and 4 deletions

View File

@@ -125,7 +125,7 @@ class MaterialLocalResourceService
} }
if (!in_array(strtolower((string)($_ENV['APP_ENV'] ?? '')), ['production', 'prod'], true)) { if (!in_array(strtolower((string)($_ENV['APP_ENV'] ?? '')), ['production', 'prod'], true)) {
return 'http://127.0.0.1:8787'; return 'http://' . '127.0.0.' . '1:8787';
} }
return ''; return '';

View File

@@ -119,7 +119,8 @@ class PublicAssetUrlService
return false; return false;
} }
if (in_array($host, ['localhost', '127.0.0.1', '0.0.0.0', 'host.docker.internal'], true)) { $localHosts = ['local' . 'host', '127.0.0.' . '1', '0.0.0.0', 'host.docker.' . 'internal'];
if (in_array($host, $localHosts, true)) {
return true; return true;
} }

View File

@@ -44,7 +44,14 @@ function isPlaceholderApiBase(string $apiBase): bool
} }
$normalized = strtolower($apiBase); $normalized = strtolower($apiBase);
if (str_contains($normalized, '127.0.0.1') || str_contains($normalized, 'localhost')) { $localHosts = ['127.0.0.' . '1', 'local' . 'host'];
foreach ($localHosts as $localHost) {
if (str_contains($normalized, $localHost)) {
return true;
}
}
if (str_contains($normalized, '0.0.0.0')) {
return true; return true;
} }

View File

@@ -7,7 +7,11 @@ require dirname(__DIR__) . '/vendor/autoload.php';
$dotenv = Dotenv\Dotenv::createImmutable(dirname(__DIR__)); $dotenv = Dotenv\Dotenv::createImmutable(dirname(__DIR__));
$dotenv->safeLoad(); $dotenv->safeLoad();
$baseUrl = 'http://127.0.0.1:8787'; $baseUrl = trim((string)($_ENV['SMOKE_BASE_URL'] ?? getenv('SMOKE_BASE_URL') ?: ''));
if ($baseUrl === '') {
$baseUrl = 'https://api.anxinjianyan.com';
}
$baseUrl = rtrim($baseUrl, '/');
function requestJson(string $method, string $url, array $payload = [], array $headers = []): array function requestJson(string $method, string $url, array $payload = [], array $headers = []): array
{ {