944edf2ccf
Hardcoded pt-BR prototype for closed captions generated by the browser's WebSpeech API.
26 lines
958 B
JavaScript
26 lines
958 B
JavaScript
import AudioCaptions from '/imports/api/audio-captions';
|
|
import { Meteor } from 'meteor/meteor';
|
|
import Logger from '/imports/startup/server/logger';
|
|
import AuthTokenValidation, { ValidationStates } from '/imports/api/auth-token-validation';
|
|
|
|
function audioCaptions() {
|
|
const tokenValidation = AuthTokenValidation.findOne({ connectionId: this.connection.id });
|
|
|
|
if (!tokenValidation || tokenValidation.validationStatus !== ValidationStates.VALIDATED) {
|
|
Logger.warn(`Publishing AudioCaptions was requested by unauth connection ${this.connection.id}`);
|
|
return AudioCaptions.find({ meetingId: '' });
|
|
}
|
|
|
|
const { meetingId, userId } = tokenValidation;
|
|
Logger.debug('Publishing AudioCaptions', { meetingId, requestedBy: userId });
|
|
|
|
return AudioCaptions.find({ meetingId });
|
|
}
|
|
|
|
function publish(...args) {
|
|
const boundAudioCaptions = audioCaptions.bind(this);
|
|
return boundAudioCaptions(...args);
|
|
}
|
|
|
|
Meteor.publish('audio-captions', publish);
|