mirror of
https://github.com/SrIzan10/hctv.git
synced 2026-06-06 00:56:56 +00:00
fix: onboarding errors
This commit is contained in:
@@ -4,7 +4,10 @@ import OnboardingClient from "./page.client";
|
||||
|
||||
export default async function Page() {
|
||||
const { user } = await validateRequest();
|
||||
if (user!.hasOnboarded) {
|
||||
if (!user) {
|
||||
return redirect('/');
|
||||
}
|
||||
if (user.hasOnboarded) {
|
||||
return redirect('/');
|
||||
}
|
||||
return <OnboardingClient />;
|
||||
|
||||
@@ -105,6 +105,15 @@ export async function onboard(prev: any, formData: FormData) {
|
||||
|
||||
await generateStreamKey(createdChannel.id, createdChannel.name);
|
||||
|
||||
if (process.env.NODE_ENV === 'production' && process.env.WELCOME_WORKFLOW_URL) {
|
||||
await fetch(process.env.WELCOME_WORKFLOW_URL, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
username: zod.data.username,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,10 @@ export async function initializeStreamInfo(channelId?: string) {
|
||||
|
||||
export async function syncStream() {
|
||||
try {
|
||||
if (!process.env.MEDIAMTX_API) {
|
||||
console.error('MEDIAMTX_API environment variable is not set');
|
||||
return;
|
||||
}
|
||||
const regions = Object.keys(MEDIAMTX_SERVER_REGIONS) as Array<
|
||||
keyof typeof MEDIAMTX_SERVER_REGIONS
|
||||
>;
|
||||
|
||||
Reference in New Issue
Block a user