fix: proxy Anizium video sources to fix CORS playback errors
videoSourcesData (quality/dub failover list) wasn't routed through stream.proxy, so switching quality/dub hit Anizium's CDN directly and got blocked by CORS. aniziumserver.sbs was also wrongly whitelisted as CORS-safe in isOwn — it isn't, per browser console evidence. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
0a43385961
commit
c891d77ae1
@@ -89,9 +89,8 @@ class PlayerController extends Controller
|
|||||||
$ep->video_url = BunnyCdnSigner::sign($ep->video_url);
|
$ep->video_url = BunnyCdnSigner::sign($ep->video_url);
|
||||||
|
|
||||||
// Proxy all external HLS streams through our server (CORS + SSL bypass).
|
// Proxy all external HLS streams through our server (CORS + SSL bypass).
|
||||||
// anizium.co + aniziumserver.* CDN'leri doğrudan yükle (tarayıcı üzerinden).
|
// aniziumserver.* (sbs/site) CORS izni vermiyor, bu yüzden hepsi proxy'den geçmeli.
|
||||||
$isOwn = fn(?string $u) => !$u || str_contains($u, 'b-cdn.net') || str_contains($u, 'animexe.com')
|
$isOwn = fn(?string $u) => !$u || str_contains($u, 'b-cdn.net') || str_contains($u, 'animexe.com');
|
||||||
|| str_contains($u, 'anizium.co') || str_contains($u, 'aniziumserver.sbs');
|
|
||||||
if ($ep->m3u8_url && !$isOwn($ep->m3u8_url)) {
|
if ($ep->m3u8_url && !$isOwn($ep->m3u8_url)) {
|
||||||
$ep->m3u8_url = route("stream.proxy", ["u" => base64_encode((string) $ep->m3u8_url)]);
|
$ep->m3u8_url = route("stream.proxy", ["u" => base64_encode((string) $ep->m3u8_url)]);
|
||||||
}
|
}
|
||||||
@@ -127,6 +126,12 @@ class PlayerController extends Controller
|
|||||||
'is_hevc' => (bool) $default->is_hevc,
|
'is_hevc' => (bool) $default->is_hevc,
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
|
->map(function ($item) use ($isOwn) {
|
||||||
|
if (!empty($item['url']) && !$isOwn($item['url'])) {
|
||||||
|
$item['url'] = route("stream.proxy", ["u" => base64_encode((string) $item['url'])]);
|
||||||
|
}
|
||||||
|
return $item;
|
||||||
|
})
|
||||||
->sortBy(function ($item) {
|
->sortBy(function ($item) {
|
||||||
$isAnizium = ($item['source'] === 'anizium');
|
$isAnizium = ($item['source'] === 'anizium');
|
||||||
$q = strtolower($item['quality'] ?? '');
|
$q = strtolower($item['quality'] ?? '');
|
||||||
|
|||||||
Reference in New Issue
Block a user