From 8e8c58e195e07eb7713816251775ae46629190d0 Mon Sep 17 00:00:00 2001 From: Izan Gil <66965250+SrIzan10@users.noreply.github.com> Date: Sat, 13 Dec 2025 22:34:29 +0100 Subject: [PATCH] feat: add preliminary hls reading --- .../(protected)/api/mediamtx/publish/route.ts | 4 +++- .../components/app/StreamPlayer/StreamPlayer.tsx | 15 ++++++++++++++- .../{tailwind.config.ts => tailwind.config.mts} | 7 ++++--- apps/web/tsconfig.json | 5 +++-- 4 files changed, 24 insertions(+), 7 deletions(-) rename apps/web/{tailwind.config.ts => tailwind.config.mts} (94%) diff --git a/apps/web/src/app/(ui)/(protected)/api/mediamtx/publish/route.ts b/apps/web/src/app/(ui)/(protected)/api/mediamtx/publish/route.ts index 7ceaa8e..3db4814 100644 --- a/apps/web/src/app/(ui)/(protected)/api/mediamtx/publish/route.ts +++ b/apps/web/src/app/(ui)/(protected)/api/mediamtx/publish/route.ts @@ -14,11 +14,13 @@ export async function POST(request: NextRequest) { console.log('Parsed data:', parsed.data); const { action, protocol, path, password } = parsed.data; - // if (action !== 'publish') return new Response('Action not allowed', { status: 403 }); if (action === 'publish' && protocol !== 'srt') { const key = await prisma.streamKey.findFirst({ where: { key: password, + channel: { + name: path, + } }, include: { channel: true, diff --git a/apps/web/src/components/app/StreamPlayer/StreamPlayer.tsx b/apps/web/src/components/app/StreamPlayer/StreamPlayer.tsx index fe22558..955afbe 100644 --- a/apps/web/src/components/app/StreamPlayer/StreamPlayer.tsx +++ b/apps/web/src/components/app/StreamPlayer/StreamPlayer.tsx @@ -20,11 +20,17 @@ export default function StreamPlayer() { return ( { + const user = 'skibiditoilet'; + const pass = getCookie('auth_session'); + const credentials = btoa(`${user}:${pass}`); + xhr.setRequestHeader('Authorization', `Basic ${credentials}`); + }, lowLatencyMode: true, liveSyncDurationCount: 1, liveMaxLatencyDurationCount: 2, @@ -67,3 +73,10 @@ export default function StreamPlayer() { ); } + +function getCookie(name: string): string | null { + const value = `; ${document.cookie}`; + const parts = value.split(`; ${name}=`); + if (parts.length === 2) return parts.pop()!.split(';').shift() || null; + return null; +} diff --git a/apps/web/tailwind.config.ts b/apps/web/tailwind.config.mts similarity index 94% rename from apps/web/tailwind.config.ts rename to apps/web/tailwind.config.mts index 3452678..117a30b 100644 --- a/apps/web/tailwind.config.ts +++ b/apps/web/tailwind.config.mts @@ -1,5 +1,6 @@ import type { Config } from "tailwindcss" -import { withUt } from "uploadthing/tw"; +import { uploadthingPlugin } from 'uploadthing/tw' +import * as tan from 'tailwindcss-animate' const config = { darkMode: ["class"], @@ -102,7 +103,7 @@ const config = { } } }, - plugins: [require("tailwindcss-animate")], + plugins: [tan, uploadthingPlugin], } satisfies Config -export default withUt(config) \ No newline at end of file +export default config \ No newline at end of file diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json index 4b6b903..157508e 100644 --- a/apps/web/tsconfig.json +++ b/apps/web/tsconfig.json @@ -32,8 +32,9 @@ "next-env.d.ts", "**/*.ts", "**/*.tsx", - ".next/types/**/*.ts" - ], + ".next/types/**/*.ts", + ".next/dev/types/**/*.ts" +, "tailwind.config.mts" ], "exclude": [ "node_modules" ]