feat: generation automatique token JWT pour AudioBridge participant
- Import AccessToken depuis livekit-server-sdk - Generation token avec identity 'AudioBridge' et metadata role:bridge - Permissions completes (publish, subscribe, data) - Utilise devkey/secret du serveur LiveKit - Permet au bridge de se connecter en tant que participant authentifie
This commit is contained in:
@@ -81,7 +81,7 @@ define(['./workbox-290dd570'], (function (workbox) { 'use strict';
|
|||||||
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
||||||
}, {
|
}, {
|
||||||
"url": "index.html",
|
"url": "index.html",
|
||||||
"revision": "0.n59u4ot43hg"
|
"revision": "0.8iqdua7o88g"
|
||||||
}], {});
|
}], {});
|
||||||
workbox.cleanupOutdatedCaches();
|
workbox.cleanupOutdatedCaches();
|
||||||
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
|
import { AccessToken } from 'livekit-server-sdk';
|
||||||
import configManager from '../config/ConfigManager.js';
|
import configManager from '../config/ConfigManager.js';
|
||||||
|
|
||||||
class AudioBridgeManager extends EventEmitter {
|
class AudioBridgeManager extends EventEmitter {
|
||||||
@@ -31,6 +32,32 @@ class AudioBridgeManager extends EventEmitter {
|
|||||||
const config = configManager.get();
|
const config = configManager.get();
|
||||||
console.log('🎵 Démarrage AudioBridge avec configuration:', config.audio);
|
console.log('🎵 Démarrage AudioBridge avec configuration:', config.audio);
|
||||||
|
|
||||||
|
// Génération du token JWT pour le participant serveur
|
||||||
|
const token = new AccessToken(
|
||||||
|
config.server?.livekit?.apiKey || 'devkey',
|
||||||
|
config.server?.livekit?.apiSecret || 'secret',
|
||||||
|
{
|
||||||
|
identity: 'AudioBridge',
|
||||||
|
name: 'Audio Bridge Server',
|
||||||
|
metadata: JSON.stringify({
|
||||||
|
role: 'bridge',
|
||||||
|
capabilities: ['audio-routing', 'monitoring']
|
||||||
|
})
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Permissions complètes pour le bridge serveur
|
||||||
|
token.addGrant({
|
||||||
|
room: 'main',
|
||||||
|
roomJoin: true,
|
||||||
|
canPublish: true,
|
||||||
|
canSubscribe: true,
|
||||||
|
canPublishData: true
|
||||||
|
});
|
||||||
|
|
||||||
|
const liveKitToken = await token.toJwt();
|
||||||
|
console.log('✓ Token JWT généré pour AudioBridge');
|
||||||
|
|
||||||
// Import dynamique du AudioBridge
|
// Import dynamique du AudioBridge
|
||||||
const { AudioBridge } = await import('./AudioBridge.js');
|
const { AudioBridge } = await import('./AudioBridge.js');
|
||||||
|
|
||||||
@@ -39,7 +66,7 @@ class AudioBridgeManager extends EventEmitter {
|
|||||||
...config.audio,
|
...config.audio,
|
||||||
// Options LiveKit
|
// Options LiveKit
|
||||||
liveKitUrl: config.server?.livekit?.url || 'ws://localhost:7880',
|
liveKitUrl: config.server?.livekit?.url || 'ws://localhost:7880',
|
||||||
liveKitToken: null, // Le bridge serveur n'a pas besoin de token pour l'instant
|
liveKitToken,
|
||||||
roomName: 'main',
|
roomName: 'main',
|
||||||
// Options de routing
|
// Options de routing
|
||||||
routing: config.audio?.routing || {},
|
routing: config.audio?.routing || {},
|
||||||
|
|||||||
Reference in New Issue
Block a user