bigbluebutton-Github/bigbluebutton-html5/imports/api/video-streams/server/publisher.js
2020-11-24 15:13:09 +00:00

31 lines
972 B
JavaScript

import { Meteor } from 'meteor/meteor';
import Logger from '/imports/startup/server/logger';
import VideoStreams from '/imports/api/video-streams';
import AuthTokenValidation, { ValidationStates } from '/imports/api/auth-token-validation';
function videoStreams() {
const tokenValidation = AuthTokenValidation.findOne({ connectionId: this.connection.id });
if (!tokenValidation || tokenValidation.validationStatus !== ValidationStates.VALIDATED) {
Logger.warn(`Publishing VideoStreams was requested by unauth connection ${this.connection.id}`);
return VideoStreams.find({ meetingId: '' });
}
const { meetingId, userId } = tokenValidation;
Logger.debug('Publishing VideoStreams', { meetingId, userId });
const selector = {
meetingId,
};
return VideoStreams.find(selector);
}
function publish(...args) {
const boundVideoStreams = videoStreams.bind(this);
return boundVideoStreams(...args);
}
Meteor.publish('video-streams', publish);