09b39a8d63
Associate pads with meetings so session validation is restricted to the meeting's valid session tokens. Meteor will dispatch new redis events on shared notes and closed captions pads creation. This event will go through apps and reach web to populate a new meeting's pad collection that contains all valid pad id's for that session. Nginx will use this collection to check if the user's session token belongs to the pad's authorized users. Besides these modifications, an extra change will be needed at notes.nginx. Location /pad/p/ needs to change it's auth_request: from /bigbluebutton/connection/checkAuthorization; to /bigbluebutton/connection/validatePad;
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
import { check } from 'meteor/check';
|
|
import Logger from '/imports/startup/server/logger';
|
|
import {
|
|
generatePadId,
|
|
isEnabled,
|
|
getLocalesURL,
|
|
} from '/imports/api/captions/server/helpers';
|
|
import addCaption from '/imports/api/captions/server/modifiers/addCaption';
|
|
import addCaptionsPads from '/imports/api/captions/server/methods/addCaptionsPads';
|
|
import axios from 'axios';
|
|
|
|
export default function createCaptions(meetingId) {
|
|
// Avoid captions creation if this feature is disabled
|
|
if (!isEnabled()) {
|
|
Logger.warn(`Captions are disabled for ${meetingId}`);
|
|
return;
|
|
}
|
|
|
|
check(meetingId, String);
|
|
|
|
axios({
|
|
method: 'get',
|
|
url: getLocalesURL(),
|
|
responseType: 'json',
|
|
}).then((response) => {
|
|
const { status } = response;
|
|
if (status !== 200) {
|
|
Logger.error(`Could not get locales info for ${meetingId} ${status}`);
|
|
return;
|
|
}
|
|
const padIds = [];
|
|
const locales = response.data;
|
|
locales.forEach((locale) => {
|
|
const padId = generatePadId(meetingId, locale.locale);
|
|
addCaption(meetingId, padId, locale);
|
|
padIds.push(padId);
|
|
});
|
|
addCaptionsPads(meetingId, padIds);
|
|
}).catch(error => Logger.error(`Could not create captions for ${meetingId}: ${error}`));
|
|
}
|