fix(deploy): 跨域来源未配置时默认放行
Test deployment public URL (Linux) / test-linux (push) Waiting to run
Test start.ps1 (Windows) / test-windows (push) Waiting to run

This commit is contained in:
2026-09-27 18:00:03 +08:00
parent a00ee10b37
commit 89cc554c04
12 changed files with 62 additions and 50 deletions
+4 -2
View File
@@ -6,16 +6,18 @@ New-Item -ItemType Directory -Path $tempDir | Out-Null
try {
$path = Join-Path $tempDir 'test.env'
[System.IO.File]::WriteAllText($path, "CONFIG_PUBLIC_API_BASE_URL=https://zaowua.com/api`n")
$before = Get-Content $path -Raw
Initialize-SecurityOrigin -Path $path
$content = Get-Content $path -Raw
if ((Get-PublicEnvValue $content 'CONFIG_SECURITY_ORIGIN') -ne 'https://zaowua.com') { throw 'Missing origin was not initialized' }
if ((Get-PublicEnvValue $content 'CONFIG_SECURITY_ORIGIN')) { throw 'Missing origin was unexpectedly initialized' }
if ($content -ne $before) { throw 'Missing origin changed the environment' }
$before = $content
Initialize-SecurityOrigin -Path $path
if ((Get-Content $path -Raw) -ne $before) { throw 'Repeated initialization changed the environment' }
[System.IO.File]::WriteAllText($path, "CONFIG_PUBLIC_API_BASE_URL=https://zaowua.com/api`nCONFIG_SECURITY_ORIGIN=http://127.0.0.1,http://localhost`n")
Initialize-SecurityOrigin -Path $path
if ((Get-PublicEnvValue (Get-Content $path -Raw) 'CONFIG_SECURITY_ORIGIN') -ne 'https://zaowua.com') { throw 'Sample origin was not migrated' }
if ((Get-PublicEnvValue (Get-Content $path -Raw) 'CONFIG_SECURITY_ORIGIN')) { throw 'Sample origin was not cleared' }
[System.IO.File]::WriteAllText($path, "CONFIG_PUBLIC_API_BASE_URL=https://zaowua.com/api`nCONFIG_SECURITY_ORIGIN=https://zaowua.com,https://www.zaowua.com`n")
$before = Get-Content $path -Raw