feat: integrate Jitsi configuration and dynamic loading in CallWindow
- Added support for Jitsi configuration retrieval from the backend, allowing for dynamic room name generation based on the active configuration. - Implemented a polyfill for BlobBuilder to ensure compatibility with the lib-jitsi-meet library across different browsers. - Enhanced error handling during the loading of the Jitsi library, providing clearer feedback for missing modules and connection issues. - Updated Vite configuration to exclude lib-jitsi-meet from SSR and allow dynamic loading in the browser. - Introduced a new route for Jitsi settings in the dashboard for user configuration of Jitsi Meet parameters.
This commit is contained in:
@@ -19,11 +19,25 @@ async function getUsuarioAutenticado(ctx: QueryCtx | MutationCtx) {
|
||||
|
||||
/**
|
||||
* Gerar nome único para a sala Jitsi
|
||||
* Usa configuração do backend se disponível, senão usa padrão 'sgse'
|
||||
*/
|
||||
function gerarRoomName(conversaId: Id<'conversas'>, tipo: 'audio' | 'video'): string {
|
||||
async function gerarRoomName(
|
||||
ctx: QueryCtx | MutationCtx,
|
||||
conversaId: Id<'conversas'>,
|
||||
tipo: 'audio' | 'video'
|
||||
): Promise<string> {
|
||||
// Buscar configuração Jitsi ativa
|
||||
const configJitsi = await ctx.db
|
||||
.query('configuracaoJitsi')
|
||||
.withIndex('by_ativo', (q) => q.eq('ativo', true))
|
||||
.first();
|
||||
|
||||
const roomPrefix = configJitsi?.roomPrefix || 'sgse';
|
||||
const timestamp = Date.now();
|
||||
const random = Math.random().toString(36).substring(2, 9);
|
||||
return `sgse-${tipo}-${conversaId.replace('conversas|', '')}-${timestamp}-${random}`;
|
||||
const conversaHash = conversaId.replace('conversas|', '').replace(/[^a-zA-Z0-9]/g, '').substring(0, 10);
|
||||
|
||||
return `${roomPrefix}-${tipo}-${conversaHash}-${timestamp}-${random}`;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,7 +110,7 @@ export const criarChamada = mutation({
|
||||
if (!conversa) throw new Error('Conversa não encontrada');
|
||||
|
||||
// Gerar nome único da sala
|
||||
const roomName = gerarRoomName(args.conversaId, args.tipo);
|
||||
const roomName = await gerarRoomName(ctx, args.conversaId, args.tipo);
|
||||
|
||||
// Criar chamada
|
||||
const chamadaId = await ctx.db.insert('chamadas', {
|
||||
|
||||
Reference in New Issue
Block a user