bigbluebutton-Github/bigbluebutton-html5/imports/api/video-streams/server/publisher.js

31 lines
976 B
JavaScript
Raw Normal View History

import { Meteor } from 'meteor/meteor';
import Logger from '/imports/startup/server/logger';
2019-09-07 00:50:31 +08:00
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 for ${meetingId} ${userId}`);
const selector = {
meetingId,
};
2019-09-07 00:50:31 +08:00
return VideoStreams.find(selector);
}
function publish(...args) {
2019-09-07 00:50:31 +08:00
const boundVideoStreams = videoStreams.bind(this);
return boundVideoStreams(...args);
}
2019-09-07 00:50:31 +08:00
Meteor.publish('video-streams', publish);