feat: add AI summary / transcript integration for recordings
Build & Push Docker Image / build (push) Successful in 4m17s
Build & Push Docker Image / build (release) Successful in 3m57s

Ported from greenlight-tm: when TRANSCRIPTION_API_URL and
TRANSCRIPTION_API_KEY are set in the .env and the per-room
"AI summary / transcript" setting is enabled, Redlight POSTs to
${TRANSCRIPTION_API_URL}/prompt (header X-Api-Key) as soon as the
"video" format of a recording becomes available.

- transcription.js: service with env gating, timeout and logging
- bbb.js: pass meta_bbb-recording-ready-url on meeting create when the
  room has the setting enabled
- recordings.js: unauthenticated /recording-ready callback that
  verifies BBB's signed_parameters JWT (HS256, shared secret), caches
  the recording and requests the transcription once per recording
  (deduped via transcript_requested_at)
- rooms: new recording_transcript column, accepted on create/update
- branding endpoint exposes transcriptionEnabled so the UI only shows
  the toggle when the server is configured
- RoomDetail: toggle under "Allow recording" (disabled when recording
  is off), de/en i18n
- chore: bump version to 2.4.0

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 11:56:45 +02:00
co-authored by Claude Opus 4.8
parent dffb68efe5
commit 51b42cfee5
13 changed files with 187 additions and 7 deletions
+6
View File
@@ -2,6 +2,7 @@
import xml2js from 'xml2js';
import { log, fmtDuration, fmtStatus, fmtMethod, fmtReturncode, sanitizeBBBParams } from './logger.js';
import { t } from './emaili18n.js';
import { isTranscriptionEnabled } from './transcription.js';
const BBB_URL = process.env.BBB_URL || 'https://your-bbb-server.com/bigbluebutton/api/';
const BBB_SECRET = process.env.BBB_SECRET || '';
@@ -115,6 +116,11 @@ export async function createMeeting(room, logoutURL, loginURL = null, presentati
if (analyticsCallbackURL) {
params['meta_analytics-callback-url'] = analyticsCallbackURL;
}
// BBB posts a signed recording-ready callback there once recording formats
// are processed; used to trigger the AI summary/transcript integration.
if (logoutURL && room.recording_transcript && isTranscriptionEnabled()) {
params['meta_bbb-recording-ready-url'] = `${logoutURL}/api/recordings/recording-ready`;
}
// Build optional presentation XML body - escape URL to prevent XML injection
let xmlBody = null;
+12
View File
@@ -879,6 +879,18 @@ export async function initDatabase() {
`);
}
// ── Recording transcription / AI summary ────────────────────────────────
if (!(await db.columnExists('rooms', 'recording_transcript'))) {
await db.exec('ALTER TABLE rooms ADD COLUMN recording_transcript INTEGER DEFAULT 0');
}
if (!(await db.columnExists('recordings', 'transcript_requested_at'))) {
if (isPostgres) {
await db.exec('ALTER TABLE recordings ADD COLUMN transcript_requested_at TIMESTAMP DEFAULT NULL');
} else {
await db.exec('ALTER TABLE recordings ADD COLUMN transcript_requested_at DATETIME DEFAULT NULL');
}
}
// ── Default admin (only on very first start) ────────────────────────────
const adminAlreadySeeded = await db.get("SELECT value FROM settings WHERE key = 'admin_seeded'");
if (!adminAlreadySeeded) {
+68
View File
@@ -0,0 +1,68 @@
import { log } from './logger.js';
/**
* Recording transcription / AI summarization integration.
*
* When the per-room "recording transcript" setting is enabled, Redlight POSTs
* to ${TRANSCRIPTION_API_URL}/prompt with header `X-Api-Key: ${TRANSCRIPTION_API_KEY}`
* as soon as the "video" format of a recording becomes available (delivered via
* BBB's recording-ready callback). Leave both env vars empty to disable the
* integration entirely.
*/
const TRANSCRIPTION_API_URL = process.env.TRANSCRIPTION_API_URL || '';
const TRANSCRIPTION_API_KEY = process.env.TRANSCRIPTION_API_KEY || '';
const DEFAULT_PROMPT = 'Summarise the key decisions made in this meeting.';
export function isTranscriptionEnabled() {
return !!(TRANSCRIPTION_API_URL && TRANSCRIPTION_API_KEY);
}
/**
* Request a summary/transcript for a recording. Never throws — failures are
* logged and reported via the boolean return value.
*
* @param {object} opts
* @param {string} opts.meetingId Room UID / BBB meeting ID
* @param {string} opts.recordingId BBB record ID
* @param {string} [opts.prompt] Optional custom prompt
* @returns {Promise<boolean>} true if the request was accepted
*/
export async function requestTranscription({ meetingId, recordingId, prompt }) {
if (!isTranscriptionEnabled()) {
log.server.warn('Transcription request skipped: TRANSCRIPTION_API_URL or TRANSCRIPTION_API_KEY is not configured');
return false;
}
const base = TRANSCRIPTION_API_URL.endsWith('/') ? TRANSCRIPTION_API_URL : `${TRANSCRIPTION_API_URL}/`;
const url = new URL('prompt', base).toString();
try {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': TRANSCRIPTION_API_KEY,
},
body: JSON.stringify({
prompt: prompt || DEFAULT_PROMPT,
meeting_id: meetingId,
recording_id: recordingId,
}),
signal: AbortSignal.timeout(15_000),
});
if (!response.ok) {
const body = await response.text().catch(() => '');
log.server.error(`Transcription request failed: status=${response.status} body=${body.slice(0, 200)}`);
return false;
}
log.server.info(`Transcription requested for recording ${recordingId} (meeting: ${meetingId})`);
return true;
} catch (err) {
log.server.error(`Transcription request error: ${err.message}`);
return false;
}
}
+2
View File
@@ -7,6 +7,7 @@ import { getDb } from '../config/database.js';
import { authenticateToken, requireAdmin } from '../middleware/auth.js';
import { log } from '../config/logger.js';
import { getOAuthConfig } from '../config/oauth.js';
import { isTranscriptionEnabled } from '../config/transcription.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
@@ -121,6 +122,7 @@ router.get('/', async (req, res) => {
oauthEnabled,
oauthDisplayName,
hideAppName: hideAppName === 'true',
transcriptionEnabled: isTranscriptionEnabled(),
});
} catch (err) {
log.branding.error('Get branding error:', err);
+1 -1
View File
@@ -41,7 +41,7 @@ export function wellKnownHandler(req, res) {
federation_api: '/api/federation',
public_key: getPublicKey(),
software: 'Redlight',
version: '2.3.0',
version: '2.4.0',
});
}
+64 -1
View File
@@ -1,7 +1,9 @@
import { Router } from 'express';
import { Router, urlencoded } from 'express';
import jwt from 'jsonwebtoken';
import { authenticateToken } from '../middleware/auth.js';
import { getDb } from '../config/database.js';
import { log } from '../config/logger.js';
import { isTranscriptionEnabled, requestTranscription } from '../config/transcription.js';
import {
getRecordings,
getRecordingByRecordId,
@@ -9,6 +11,8 @@ import {
publishRecording,
} from '../config/bbb.js';
const BBB_SECRET = process.env.BBB_SECRET || '';
const router = Router();
/**
@@ -176,6 +180,65 @@ async function fetchAndSyncRecordings(meetingID, fallbackName) {
}
}
// POST /api/recordings/recording-ready - BBB recording-ready callback (unauthenticated)
// BBB posts `signed_parameters`, a JWT signed with the shared BBB secret.
// Fires once per playback format; the transcription request is only sent when
// the "video" format first becomes available and the room has the setting on.
router.post('/recording-ready', urlencoded({ extended: false }), async (req, res) => {
try {
const signed = req.body?.signed_parameters;
if (!signed || typeof signed !== 'string') {
return res.status(400).json({ error: 'signed_parameters is required' });
}
let payload;
try {
payload = jwt.verify(signed, BBB_SECRET, { algorithms: ['HS256'] });
} catch {
return res.status(403).json({ error: 'Invalid signature' });
}
const recordId = payload.record_id;
const meetingId = payload.meeting_id;
if (!recordId || !meetingId) {
return res.status(400).json({ error: 'record_id and meeting_id are required' });
}
// Always answer 200 from here on so BBB does not keep retrying —
// "nothing to do" is a valid outcome for this callback.
const db = getDb();
const room = await db.get('SELECT id, uid, name, recording_transcript FROM rooms WHERE uid = ?', [meetingId]);
if (!room || !room.recording_transcript || !isTranscriptionEnabled()) {
return res.json({});
}
const rec = await getRecordingByRecordId(recordId).catch(() => null);
if (!rec) return res.json({});
const formatted = formatBbbRecording(rec, room.name);
const hasVideo = formatted.formats.some(f => f.type === 'video');
// Cache the recording so the dedupe marker below has a row to live on
await upsertRecording(db, formatted);
if (!hasVideo) return res.json({});
// Dedupe: BBB fires the callback once per format
const cached = await db.get('SELECT transcript_requested_at FROM recordings WHERE record_id = ?', [recordId]);
if (cached?.transcript_requested_at) return res.json({});
const ok = await requestTranscription({ meetingId, recordingId: recordId });
if (ok) {
await db.run('UPDATE recordings SET transcript_requested_at = CURRENT_TIMESTAMP WHERE record_id = ?', [recordId]);
}
res.json({});
} catch (err) {
log.recordings.error(`Recording-ready callback error: ${err.message}`);
res.status(500).json({ error: 'Error processing recording-ready callback' });
}
});
// GET /api/recordings - Get recordings for a room (by meetingID/uid)
router.get('/', authenticateToken, async (req, res) => {
try {
+7 -2
View File
@@ -193,6 +193,7 @@ router.post('/', authenticateToken, async (req, res) => {
record_meeting,
guest_access,
moderator_code,
recording_transcript,
} = req.body;
if (!name || name.trim().length === 0) {
@@ -227,8 +228,8 @@ router.post('/', authenticateToken, async (req, res) => {
const db = getDb();
const result = await db.run(`
INSERT INTO rooms (uid, name, user_id, welcome_message, max_participants, access_code, mute_on_join, require_approval, anyone_can_start, all_join_moderator, record_meeting, guest_access, moderator_code)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
INSERT INTO rooms (uid, name, user_id, welcome_message, max_participants, access_code, mute_on_join, require_approval, anyone_can_start, all_join_moderator, record_meeting, guest_access, moderator_code, recording_transcript)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`, [
uid,
name.trim(),
@@ -243,6 +244,7 @@ router.post('/', authenticateToken, async (req, res) => {
record_meeting !== false ? 1 : 0,
guest_access ? 1 : 0,
moderator_code || null,
recording_transcript ? 1 : 0,
]);
const room = await db.get('SELECT * FROM rooms WHERE id = ?', [result.lastInsertRowid]);
@@ -277,6 +279,7 @@ router.put('/:uid', authenticateToken, async (req, res) => {
moderator_code,
learning_analytics,
analytics_visibility,
recording_transcript,
} = req.body;
// M12: field length limits (same as create)
@@ -318,6 +321,7 @@ router.put('/:uid', authenticateToken, async (req, res) => {
moderator_code = ?,
learning_analytics = COALESCE(?, learning_analytics),
analytics_visibility = COALESCE(?, analytics_visibility),
recording_transcript = COALESCE(?, recording_transcript),
updated_at = CURRENT_TIMESTAMP
WHERE uid = ?
`, [
@@ -334,6 +338,7 @@ router.put('/:uid', authenticateToken, async (req, res) => {
moderator_code !== undefined ? (moderator_code || null) : room.moderator_code,
learning_analytics !== undefined ? (learning_analytics ? 1 : 0) : null,
analytics_visibility && ['owner', 'shared'].includes(analytics_visibility) ? analytics_visibility : null,
recording_transcript !== undefined ? (recording_transcript ? 1 : 0) : null,
req.params.uid,
]);