feat: add configurable HLS CORS allowlists

This commit is contained in:
root
2026-09-04 22:28:33 +02:00
parent 6fae6a3a43
commit 9710e8d228
24 changed files with 879 additions and 7 deletions
+25
View File
@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace Plugin\AzuraCastOnDemandHls\Tests\Cors;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use Plugin\AzuraCastOnDemandHls\Cors\NginxRules;
#[CoversClass(NginxRules::class)]
final class NginxRulesTest extends TestCase
{
public function testItWritesExactOriginRulesForTheInternalHlsLocation(): void
{
self::assertSame(
" set \$ondemand_hls_cors_origin \"\";\n"
. " set \$ondemand_hls_cors_vary \"\";\n"
. " if (\$http_origin != \"\") { set \$ondemand_hls_cors_vary \"Origin\"; }\n"
. " if (\$http_origin = \"https://aifrequency.org\") { set \$ondemand_hls_cors_origin \$http_origin; }\n"
. " if (\$http_origin = \"https://www.aifrequency.org\") { set \$ondemand_hls_cors_origin \$http_origin; }\n",
NginxRules::forOrigins(['https://aifrequency.org', 'https://www.aifrequency.org'])
);
}
}