Merged info with anton's branch
This commit is contained in:
parent
83e14e8206
commit
86d3e27d47
@ -1,20 +1,7 @@
|
|||||||
import RedisPubSub from '/imports/startup/server/redis2x';
|
import RedisPubSub from '/imports/startup/server/redis2x';
|
||||||
// import handleMeetingDestruction from './handlers/meetingDestruction';
|
|
||||||
// import handleRecordingStatusChange from './handlers/recordingStatusChange';
|
|
||||||
// import handlePermissionSettingsChange from './handlers/permissionSettingsChange';
|
|
||||||
import handleMeetingCreation from './handlers/meetingCreation';
|
import handleMeetingCreation from './handlers/meetingCreation';
|
||||||
// import handleGetAllMeetings from './handlers/getAllMeetings';
|
import handleGetAllMeetings from './handlers/getAllMeetings';
|
||||||
// import handleStunTurnReply from './handlers/stunTurnReply';
|
|
||||||
|
|
||||||
// RedisPubSub.on('meeting_destroyed_event', handleMeetingDestruction);
|
|
||||||
// RedisPubSub.on('meeting_ended_message', handleMeetingDestruction);
|
|
||||||
// RedisPubSub.on('end_and_kick_all_message', handleMeetingDestruction);
|
|
||||||
// RedisPubSub.on('disconnect_all_users_message', handleMeetingDestruction);
|
|
||||||
// RedisPubSub.on('recording_status_changed_message', handleRecordingStatusChange);
|
|
||||||
// RedisPubSub.on('new_permission_settings', handlePermissionSettingsChange);
|
|
||||||
// RedisPubSub.on('meeting_created_message', handleMeetingCreation);
|
|
||||||
// RedisPubSub.on('get_all_meetings_reply_message', handleGetAllMeetings);
|
|
||||||
// RedisPubSub.on('send_stun_turn_info_reply_message', handleStunTurnReply);
|
|
||||||
|
|
||||||
// 2x
|
// 2x
|
||||||
RedisPubSub.on('MeetingCreatedEvtMsg', handleMeetingCreation);
|
RedisPubSub.on('MeetingCreatedEvtMsg', handleMeetingCreation);
|
||||||
|
RedisPubSub.on('SyncGetMeetingInfoRespMsg', handleGetAllMeetings);
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
import { inReplyToHTML5Client } from '/imports/api/common/server/helpers';
|
||||||
|
import handleMeetingCreation from './meetingCreation';
|
||||||
|
|
||||||
|
export default function handleGetAllMeetings({ envelope, body }) {
|
||||||
|
if (!inReplyToHTML5Client(envelope)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return handleMeetingCreation({ body });
|
||||||
|
}
|
@ -1,10 +1,6 @@
|
|||||||
import RedisPubSub from '/imports/startup/server/redis2x';
|
import RedisPubSub from '/imports/startup/server/redis2x';
|
||||||
// import handlePresentationRemove from './handlers/presentationRemove';
|
|
||||||
import handlePresentationChange from './handlers/presentationChange';
|
import handlePresentationChange from './handlers/presentationChange';
|
||||||
import handlePresentationInfoReply from './handlers/presentationInfoReply';
|
import handlePresentationInfoReply from './handlers/presentationInfoReply';
|
||||||
|
|
||||||
// RedisPubSub.on('presentation_removed_message', handlePresentationRemove);
|
|
||||||
RedisPubSub.on('NewPresentationEvtMsg', handlePresentationChange);
|
|
||||||
// RedisPubSub.on('get_presentation_info_reply', handlePresentationInfoReply);
|
|
||||||
|
|
||||||
RedisPubSub.on('SyncGetPresentationInfoRespMsg', handlePresentationInfoReply);
|
RedisPubSub.on('SyncGetPresentationInfoRespMsg', handlePresentationInfoReply);
|
||||||
|
RedisPubSub.on('NewPresentationEvtMsg', handlePresentationChange);
|
||||||
|
@ -1,15 +1,22 @@
|
|||||||
import { check } from 'meteor/check';
|
import { check } from 'meteor/check';
|
||||||
import Presentations from '/imports/api/2.0/presentations';
|
import Presentations from '/imports/api/2.0/presentations';
|
||||||
|
|
||||||
|
import { inReplyToHTML5Client } from '/imports/api/common/server/helpers';
|
||||||
import addPresentation from '../modifiers/addPresentation';
|
import addPresentation from '../modifiers/addPresentation';
|
||||||
import removePresentation from '../modifiers/removePresentation';
|
import removePresentation from '../modifiers/removePresentation';
|
||||||
|
|
||||||
export default function handlePresentationInfoReply({ body }, meetingId) {
|
export default function handlePresentationInfoReply({ envelope, body }, meetingId) {
|
||||||
|
if (!inReplyToHTML5Client(envelope)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const presentations = body.presentations;
|
const presentations = body.presentations;
|
||||||
|
|
||||||
|
check(meetingId, String);
|
||||||
check(presentations, Array);
|
check(presentations, Array);
|
||||||
|
|
||||||
const presentationsIds = presentations.map(_ => _.id);
|
const presentationsIds = presentations.map(presentation => presentation.id);
|
||||||
|
|
||||||
const presentationsToRemove = Presentations.find({
|
const presentationsToRemove = Presentations.find({
|
||||||
meetingId,
|
meetingId,
|
||||||
'presentation.id': { $nin: presentationsIds },
|
'presentation.id': { $nin: presentationsIds },
|
||||||
|
@ -11,7 +11,7 @@ function presentations(credentials) {
|
|||||||
check(requesterUserId, String);
|
check(requesterUserId, String);
|
||||||
check(requesterToken, String);
|
check(requesterToken, String);
|
||||||
|
|
||||||
Logger.info(`Publishing Presentations for ${meetingId} ${requesterUserId} ${requesterToken}`);
|
Logger.info(`Publishing Presentations2x for ${meetingId} ${requesterUserId} ${requesterToken}`);
|
||||||
|
|
||||||
return Presentations.find({ meetingId });
|
return Presentations.find({ meetingId });
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import handleValidateAuthToken from './handlers/validateAuthToken';
|
|||||||
import handleVoiceUpdate from './handlers/voiceUpdate';
|
import handleVoiceUpdate from './handlers/voiceUpdate';
|
||||||
import handlePresenterAssigned from './handlers/presenterAssigned';
|
import handlePresenterAssigned from './handlers/presenterAssigned';
|
||||||
import handleEmojiStatus from './handlers/emojiStatus';
|
import handleEmojiStatus from './handlers/emojiStatus';
|
||||||
|
import handleGetUsers from './handlers/getUsers';
|
||||||
|
|
||||||
RedisPubSub.on('PresenterAssignedEvtMsg', handlePresenterAssigned);
|
RedisPubSub.on('PresenterAssignedEvtMsg', handlePresenterAssigned);
|
||||||
RedisPubSub.on('UserJoinedMeetingEvtMsg', handleUserJoined);
|
RedisPubSub.on('UserJoinedMeetingEvtMsg', handleUserJoined);
|
||||||
@ -13,3 +14,4 @@ RedisPubSub.on('UserLeftVoiceConfToClientEvtMsg', handleVoiceUpdate);
|
|||||||
RedisPubSub.on('UserJoinedVoiceConfToClientEvtMsg', handleVoiceUpdate);
|
RedisPubSub.on('UserJoinedVoiceConfToClientEvtMsg', handleVoiceUpdate);
|
||||||
RedisPubSub.on('ValidateAuthTokenRespMsg', handleValidateAuthToken);
|
RedisPubSub.on('ValidateAuthTokenRespMsg', handleValidateAuthToken);
|
||||||
RedisPubSub.on('UserEmojiChangedEvtMsg', handleEmojiStatus);
|
RedisPubSub.on('UserEmojiChangedEvtMsg', handleEmojiStatus);
|
||||||
|
RedisPubSub.on('SyncGetUsersMeetingRespMsg', handleGetUsers);
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
import { check } from 'meteor/check';
|
||||||
|
import Logger from '/imports/startup/server/logger';
|
||||||
|
import Users from '/imports/api/2.0/users/';
|
||||||
|
import addUser from '../modifiers/addUser';
|
||||||
|
import removeUser from '../modifiers/removeUser';
|
||||||
|
import { inReplyToHTML5Client } from '/imports/api/common/server/helpers';
|
||||||
|
|
||||||
|
export default function handleGetUsers({ envelope, body }, meetingId) {
|
||||||
|
if (!inReplyToHTML5Client(envelope)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const { users } = body;
|
||||||
|
|
||||||
|
check(meetingId, String);
|
||||||
|
check(users, Array);
|
||||||
|
|
||||||
|
const usersIds = users.map(m => m.intId);
|
||||||
|
|
||||||
|
const usersToRemove = Users.find({
|
||||||
|
meetingId,
|
||||||
|
userId: { $nin: usersIds },
|
||||||
|
}).fetch();
|
||||||
|
|
||||||
|
usersToRemove.forEach(user => removeUser(meetingId, user.userId));
|
||||||
|
|
||||||
|
const usersAdded = [];
|
||||||
|
users.forEach((user) => {
|
||||||
|
usersAdded.push(addUser(meetingId, user));
|
||||||
|
});
|
||||||
|
|
||||||
|
return usersAdded;
|
||||||
|
}
|
10
bigbluebutton-html5/imports/api/2.0/users/server/modifiers/clearUsers.js
Executable file
10
bigbluebutton-html5/imports/api/2.0/users/server/modifiers/clearUsers.js
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
import Users from './../../';
|
||||||
|
import Logger from '/imports/startup/server/logger';
|
||||||
|
|
||||||
|
export default function clearUsers(meetingId) {
|
||||||
|
if (meetingId) {
|
||||||
|
return Users.remove({ meetingId }, Logger.info(`Cleared Users (${meetingId})`));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Users.remove({}, Logger.info('Cleared Users (all)'));
|
||||||
|
}
|
@ -35,8 +35,6 @@ export const translateHTML5ToFlash = function (message) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
// when requesting for history information we pass this made up requesterID
|
|
||||||
// We want to handle only the reports we requested
|
|
||||||
export const inReplyToHTML5Client = function (arg) {
|
export const inReplyToHTML5Client = function (arg) {
|
||||||
return arg.payload.requester_id === 'nodeJSapp';
|
return arg.routing.userId === 'nodeJSapp';
|
||||||
};
|
};
|
||||||
|
@ -109,6 +109,7 @@ class RedisPubSub2x {
|
|||||||
handleTask(data, next) {
|
handleTask(data, next) {
|
||||||
const { header } = data.parsedMessage.core;
|
const { header } = data.parsedMessage.core;
|
||||||
const { body } = data.parsedMessage.core;
|
const { body } = data.parsedMessage.core;
|
||||||
|
const { envelope } = data.parsedMessage;
|
||||||
const eventName = header.name;
|
const eventName = header.name;
|
||||||
const meetingId = header.meetingId;
|
const meetingId = header.meetingId;
|
||||||
|
|
||||||
@ -118,7 +119,7 @@ class RedisPubSub2x {
|
|||||||
try {
|
try {
|
||||||
this._debug(`${eventName} emitted`);
|
this._debug(`${eventName} emitted`);
|
||||||
return this.emitter
|
return this.emitter
|
||||||
.emitAsync(eventName, { header, body }, meetingId)
|
.emitAsync(eventName, { envelope, header, body }, meetingId)
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
this._debug(`${eventName} completed`);
|
this._debug(`${eventName} completed`);
|
||||||
return next();
|
return next();
|
||||||
|
Loading…
Reference in New Issue
Block a user