mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 17:46:06 +00:00
fix(bunny): read the CDN host from runtime config so Docker images can play video
NEXT_PUBLIC_BUNNY_CDN_URL is inlined into the client bundle at build time, and the published image is built by CI without it, so the browser had no host to build a playlist URL from no matter what the operator set in .env.docker. The player read the empty URL as a stream that had not finished encoding and sat on 'Video Is Processing', retrying forever. The server knows the value on every request, so the root layout now serialises the public settings into a JSON script tag and the browser reads them from there, falling back to the build-time variable for source builds. The direct-download allow list came through the same broken path and moves with it. Closes #60
This commit is contained in:
@@ -10,6 +10,7 @@ import type {
|
||||
VideoData,
|
||||
} from '@/components/video-page/types';
|
||||
import { resolvePublicBunnyCdnHostname } from '@/lib/bunny-cdn';
|
||||
import { resolvePublicDirectDownloadAllowedHosts } from '@/lib/runtime-public-config';
|
||||
import {
|
||||
downloadNamedFile,
|
||||
downloadProgressLabel,
|
||||
@@ -32,11 +33,9 @@ function sanitizeDownloadFileName(value: string): string {
|
||||
function getAllowedHosts() {
|
||||
const bunnyCdnHostname = resolvePublicBunnyCdnHostname();
|
||||
return [
|
||||
...(bunnyCdnHostname ? [bunnyCdnHostname] : []),
|
||||
...(process.env.NEXT_PUBLIC_DIRECT_DOWNLOAD_ALLOWED_HOSTS ?? '').split(','),
|
||||
]
|
||||
.map((host) => host.trim().toLowerCase())
|
||||
.filter(Boolean);
|
||||
...(bunnyCdnHostname ? [bunnyCdnHostname.trim().toLowerCase()] : []),
|
||||
...resolvePublicDirectDownloadAllowedHosts(),
|
||||
].filter(Boolean);
|
||||
}
|
||||
|
||||
function getSafeDirectDownloadUrl(rawUrl: string): string | null {
|
||||
|
||||
Reference in New Issue
Block a user