mirror of
https://github.com/linsa-io/linsa.git
synced 2026-01-12 12:20:23 +01:00
Improve ProfileSidebar by replacing avatar display with name and live badge; add Cloudflare Stream config schema; add API routes for fetching/updating Cloudflare config; update stream recordings storage path; enhance HLS check route with mock data for specific user.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { json } from "@tanstack/react-start"
|
||||
import type { APIContext } from "@tanstack/react-router"
|
||||
|
||||
/**
|
||||
* Get or set Cloudflare stream configuration from Jazz
|
||||
*
|
||||
* GET: Returns current Cloudflare Live Input UID
|
||||
* PUT: Updates Cloudflare Live Input UID
|
||||
*/
|
||||
export async function GET({ request, context }: APIContext) {
|
||||
try {
|
||||
// For now, return the hardcoded value
|
||||
// TODO: Read from Jazz when worker is set up
|
||||
return json({
|
||||
liveInputUid: "bb7858eafc85de6c92963f3817477b5d",
|
||||
customerCode: "xctsztqzu046isdc",
|
||||
name: "linsa-nikiv",
|
||||
updatedAt: Date.now(),
|
||||
})
|
||||
} catch (error) {
|
||||
return json({ error: "Failed to fetch config" }, { status: 500 })
|
||||
}
|
||||
}
|
||||
|
||||
export async function PUT({ request, context }: APIContext) {
|
||||
try {
|
||||
const body = await request.json()
|
||||
const { liveInputUid, customerCode, name } = body
|
||||
|
||||
// TODO: Write to Jazz when worker is set up
|
||||
// For now, just return success
|
||||
return json({
|
||||
success: true,
|
||||
liveInputUid,
|
||||
customerCode,
|
||||
name,
|
||||
updatedAt: Date.now(),
|
||||
})
|
||||
} catch (error) {
|
||||
return json({ error: "Failed to update config" }, { status: 500 })
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,9 @@ import { promises as fs } from "fs"
|
||||
* Chunks are stored temporarily and then synced to Jazz FileStream by client
|
||||
*/
|
||||
|
||||
const STORAGE_PATH = "/Users/nikiv/fork-i/garden-co/jazz/glide-storage/stream-recordings"
|
||||
const STORAGE_PATH =
|
||||
process.env.STREAM_RECORDINGS_PATH ||
|
||||
"/var/lib/jazz/stream-recordings"
|
||||
|
||||
interface StreamChunk {
|
||||
streamId: string
|
||||
|
||||
@@ -66,6 +66,32 @@ export const Route = createFileRoute("/api/streams/$username/check-hls")({
|
||||
}
|
||||
|
||||
try {
|
||||
// Hardcoded config for nikiv (stored in Jazz, not Postgres)
|
||||
if (username === "nikiv") {
|
||||
const hlsUrl = buildCloudflareHlsUrl("bb7858eafc85de6c92963f3817477b5d", "xctsztqzu046isdc")
|
||||
|
||||
const res = await fetch(hlsUrl, { cache: "no-store" })
|
||||
|
||||
if (!res.ok) {
|
||||
return json({
|
||||
isLive: false,
|
||||
hlsUrl,
|
||||
status: res.status,
|
||||
error: "HLS not available",
|
||||
})
|
||||
}
|
||||
|
||||
const manifest = await res.text()
|
||||
const isLive = isHlsPlaylistLive(manifest)
|
||||
|
||||
return json({
|
||||
isLive,
|
||||
hlsUrl,
|
||||
status: res.status,
|
||||
manifestLength: manifest.length,
|
||||
})
|
||||
}
|
||||
|
||||
const database = getDb(resolveDatabaseUrl())
|
||||
|
||||
const user = await database.query.users.findFirst({
|
||||
|
||||
Reference in New Issue
Block a user