From d1f5cc7a6dd80f0d975fff84df9df388b912b6a0 Mon Sep 17 00:00:00 2001 From: Izan Gil <66965250+SrIzan10@users.noreply.github.com> Date: Sat, 20 Dec 2025 03:01:21 +0100 Subject: [PATCH] fix: set next public after build time --- .../settings/channel/[channelName]/page.client.tsx | 3 ++- apps/web/src/app/layout.tsx | 14 ++++++++++++++ .../components/app/StreamPlayer/StreamPlayer.tsx | 3 ++- apps/web/src/lib/env.ts | 10 ++++++++++ apps/web/src/lib/workers/worker/thumbnails.ts | 3 ++- 5 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 apps/web/src/lib/env.ts diff --git a/apps/web/src/app/(ui)/(protected)/settings/channel/[channelName]/page.client.tsx b/apps/web/src/app/(ui)/(protected)/settings/channel/[channelName]/page.client.tsx index ee7c8c8..91dce29 100644 --- a/apps/web/src/app/(ui)/(protected)/settings/channel/[channelName]/page.client.tsx +++ b/apps/web/src/app/(ui)/(protected)/settings/channel/[channelName]/page.client.tsx @@ -53,6 +53,7 @@ import { ChannelSelect } from '@/components/app/ChannelSelect/ChannelSelect'; import { useRouter } from 'next/navigation'; import Link from 'next/link'; import { useConfirm } from '@omit/react-confirm-dialog'; +import { MEDIAMTX_INGEST_ROUTE } from '@/lib/env'; interface ChannelSettingsClientProps { channel: Channel & { @@ -136,7 +137,7 @@ export default function ChannelSettingsClient({ toast.error('Stream key not available'); return ''; } - return `srt://${process.env.NEXT_PUBLIC_MEDIAMTX_INGEST_ROUTE}?streamid=publish:${channel.name}:thisusernameislongonpurposesoyoudontaccidentallyleakyourstreamkey:${streamKey}&pkt_size=1316`; + return `srt://${MEDIAMTX_INGEST_ROUTE}?streamid=publish:${channel.name}:thisusernameislongonpurposesoyoudontaccidentallyleakyourstreamkey:${streamKey}&pkt_size=1316`; }; const copyStreamUrl = async () => { diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx index 3546aad..dcc986e 100644 --- a/apps/web/src/app/layout.tsx +++ b/apps/web/src/app/layout.tsx @@ -2,8 +2,22 @@ import { NuqsAdapter } from 'nuqs/adapters/next/app'; import './globals.css'; export default function Layout({ children }: { children: React.ReactNode }) { + const publicEnv = Object.keys(process.env).reduce((acc, key) => { + if (key.startsWith('NEXT_PUBLIC_')) { + acc[key] = process.env[key]; + } + return acc; + }, {} as Record); + return ( + +