Update Saqel Platform: 2026-09-12 16:23:39

This commit is contained in:
Hamza-Ayed
2026-09-12 16:23:39 +03:00
parent f4d4f02853
commit 81fa8c5dc8
9 changed files with 585 additions and 115 deletions
+19 -8
View File
@@ -491,8 +491,8 @@ class VideoService
return [
'library_id' => getenv('BUNNY_STREAM_LIBRARY_ID') ?: '',
'api_key' => getenv('BUNNY_STREAM_API_KEY') ?: '',
'token_key' => getenv('BUNNY_STREAM_TOKEN_KEY') ?: getenv('JWT_SECRET') ?: '',
'pull_zone_host' => getenv('BUNNY_STREAM_HOST') ?: '',
'token_key' => getenv('BUNNY_STREAM_TOKEN_KEY') ?: '',
'pull_zone_host' => getenv('BUNNY_STREAM_HOST') ?: 'video.bunnycdn.com',
'embed_host' => 'iframe.mediadelivery.net'
];
}
@@ -598,18 +598,29 @@ class VideoService
$config = self::getBunnyConfig();
$libraryId = $config['library_id'];
$tokenKey = $config['token_key'];
$expires = time() + $expiresInSeconds;
$host = !empty($config['pull_zone_host']) ? $config['pull_zone_host'] : 'video.bunnycdn.com';
$hashable = $tokenKey . $videoId . $expires;
$token = hash('sha256', $hashable);
if (!empty($tokenKey)) {
$expires = time() + $expiresInSeconds;
$hashable = $tokenKey . $videoId . $expires;
$token = hash('sha256', $hashable);
$embedUrl = "https://{$config['embed_host']}/embed/{$libraryId}/{$videoId}?token={$token}&expires={$expires}";
$hlsUrl = "https://{$config['pull_zone_host']}/{$videoId}/playlist.m3u8?token={$token}&expires={$expires}";
$thumbUrl = "https://{$config['pull_zone_host']}/{$videoId}/thumbnail.jpg?token={$token}&expires={$expires}";
$embedUrl = "https://{$config['embed_host']}/embed/{$libraryId}/{$videoId}?token={$token}&expires={$expires}";
$hlsUrl = "https://{$host}/{$videoId}/playlist.m3u8?token={$token}&expires={$expires}";
$thumbUrl = "https://{$host}/{$videoId}/thumbnail.jpg?token={$token}&expires={$expires}";
} else {
// Clean direct streaming without bogus token hashes that cause 403
$expires = null;
$token = '';
$embedUrl = "https://{$config['embed_host']}/embed/{$libraryId}/{$videoId}";
$hlsUrl = "https://{$host}/{$videoId}/playlist.m3u8";
$thumbUrl = "https://{$host}/{$videoId}/thumbnail.jpg";
}
return [
'video_id' => $videoId,
'library_id' => $libraryId,
'video_url' => $hlsUrl,
'embed_url' => $embedUrl,
'hls_url' => $hlsUrl,
'thumb_url' => $thumbUrl,