ultisuite-client/lib/meet/meet-url.ts
R3D347HR4Y ad1370ea7e
Some checks are pending
E2E / Playwright e2e (push) Waiting to run
feat: enhance configuration and add new demo layouts
- Introduced turbopack alias for canvas in next.config.mjs.
- Updated package.json scripts for development and branding tasks.
- Added new dependencies for Tiptap extensions.
- Implemented new demo layouts for agenda, contacts, drive, and mail applications.
- Enhanced globals.css for improved theming and splash screen animations.
- Added OAuth callback handling for drive mounts.
- Updated layout components to integrate new demo shells and improve structure.
2026-06-12 19:10:24 +02:00

44 lines
1.3 KiB
TypeScript

/** Parse an UltiMeet / Jitsi room URL returned by the backend. */
export function parseMeetUrl(raw: string): {
room: string
jwt?: string
embedUrl: string
} | null {
const trimmed = raw.trim()
if (!trimmed) return null
try {
const url = trimmed.startsWith("http")
? new URL(trimmed)
: new URL(trimmed, "https://placeholder.local")
const pathMatch = url.pathname.match(/\/meet\/([^/]+)\/?$/i)
if (!pathMatch?.[1]) return null
const room = decodeURIComponent(pathMatch[1])
const jwt = url.searchParams.get("jwt") ?? undefined
const embedUrl = jwt
? `${url.origin}/meet/${encodeURIComponent(room)}?jwt=${encodeURIComponent(jwt)}`
: `${url.origin}/meet/${encodeURIComponent(room)}`
return { room, jwt, embedUrl }
} catch {
return null
}
}
export function isUltiMeetUrl(raw: string): boolean {
return parseMeetUrl(raw) !== null
}
/** In-app join route for agenda links (keeps users inside UltiSuite). */
export function meetJoinPath(meetUrl: string): string {
return `/meet/join?u=${encodeURIComponent(meetUrl)}`
}
export function meetRoomPath(room: string, jwt?: string): string {
const base = `/meet/${encodeURIComponent(room)}`
if (!jwt) return base
return `${base}?jwt=${encodeURIComponent(jwt)}`
}