Merge pull request #8613 from antobinary/userId-stuff
Utilize Meteor session id instead of trusting client side meetingI…
This commit is contained in:
commit
4b5c6c65e9
@ -1,28 +1,17 @@
|
||||
import { getMultiUserStatus } from '/imports/api/common/server/helpers';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
import isPodPresenter from '/imports/api/presentation-pods/server/utils/isPodPresenter';
|
||||
|
||||
export default function clearWhiteboard(credentials, whiteboardId) {
|
||||
export default function clearWhiteboard(whiteboardId) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'ClearWhiteboardPubMsg';
|
||||
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
check(whiteboardId, String);
|
||||
|
||||
const allowed = isPodPresenter(meetingId, whiteboardId, requesterUserId)
|
||||
|| getMultiUserStatus(meetingId, whiteboardId);
|
||||
if (!allowed) {
|
||||
throw new Meteor.Error('not-allowed', `User ${requesterUserId} is not allowed to clear the whiteboard`);
|
||||
}
|
||||
|
||||
const payload = {
|
||||
whiteboardId,
|
||||
};
|
||||
|
@ -1,105 +1,8 @@
|
||||
import { getMultiUserStatus } from '/imports/api/common/server/helpers';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Annotations from '/imports/api/annotations';
|
||||
import sendAnnotationHelper from './sendAnnotationHelper';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
import isPodPresenter from '/imports/api/presentation-pods/server/utils/isPodPresenter';
|
||||
export default function sendAnnotation(annotation) {
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
function isLastMessage(meetingId, annotation, userId) {
|
||||
const DRAW_END = Meteor.settings.public.whiteboard.annotations.status.end;
|
||||
|
||||
if (annotation.status === DRAW_END) {
|
||||
const selector = {
|
||||
meetingId,
|
||||
id: annotation.id,
|
||||
userId,
|
||||
};
|
||||
|
||||
const _annotation = Annotations.findOne(selector);
|
||||
return _annotation !== null;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
export default function sendAnnotation(credentials, annotation) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'SendWhiteboardAnnotationPubMsg';
|
||||
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
const whiteboardId = annotation.wbId;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
check(annotation, Object);
|
||||
check(whiteboardId, String);
|
||||
|
||||
// We allow messages to pass through in 3 cases:
|
||||
// 1. When it's a standard message in presenter mode (Acl check)
|
||||
// 2. When it's a standard message in multi-user mode (getMultUserStatus check)
|
||||
// 3. When it's the last message, happens when the user is currently drawing
|
||||
// and then slide/presentation changes, the user lost presenter rights,
|
||||
// or multi-user whiteboard gets turned off
|
||||
// So we allow the last "DRAW_END" message to pass through, to finish the shape.
|
||||
const allowed = isPodPresenter(meetingId, whiteboardId, requesterUserId)
|
||||
|| getMultiUserStatus(meetingId, whiteboardId)
|
||||
|| isLastMessage(meetingId, annotation, requesterUserId);
|
||||
|
||||
if (!allowed) {
|
||||
throw new Meteor.Error('not-allowed', `User ${requesterUserId} is not allowed to send an annotation`);
|
||||
}
|
||||
|
||||
if (annotation.annotationType === 'text') {
|
||||
check(annotation, {
|
||||
id: String,
|
||||
status: String,
|
||||
annotationType: String,
|
||||
annotationInfo: {
|
||||
x: Number,
|
||||
y: Number,
|
||||
fontColor: Number,
|
||||
calcedFontSize: Number,
|
||||
textBoxWidth: Number,
|
||||
text: String,
|
||||
textBoxHeight: Number,
|
||||
id: String,
|
||||
whiteboardId: String,
|
||||
status: String,
|
||||
fontSize: Number,
|
||||
dataPoints: String,
|
||||
type: String,
|
||||
},
|
||||
wbId: String,
|
||||
userId: String,
|
||||
position: Number,
|
||||
});
|
||||
} else {
|
||||
check(annotation, {
|
||||
id: String,
|
||||
status: String,
|
||||
annotationType: String,
|
||||
annotationInfo: {
|
||||
color: Number,
|
||||
thickness: Number,
|
||||
points: Array,
|
||||
id: String,
|
||||
whiteboardId: String,
|
||||
status: String,
|
||||
type: String,
|
||||
dimensions: Match.Maybe([Number]),
|
||||
},
|
||||
wbId: String,
|
||||
userId: String,
|
||||
position: Number,
|
||||
});
|
||||
}
|
||||
|
||||
const payload = {
|
||||
annotation,
|
||||
};
|
||||
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
||||
sendAnnotationHelper(annotation, meetingId, requesterUserId);
|
||||
}
|
||||
|
@ -0,0 +1,65 @@
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
export default function sendAnnotationHelper(annotation, meetingId, requesterUserId) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'SendWhiteboardAnnotationPubMsg';
|
||||
|
||||
const whiteboardId = annotation.wbId;
|
||||
|
||||
check(annotation, Object);
|
||||
check(whiteboardId, String);
|
||||
|
||||
if (annotation.annotationType === 'text') {
|
||||
check(annotation, {
|
||||
id: String,
|
||||
status: String,
|
||||
annotationType: String,
|
||||
annotationInfo: {
|
||||
x: Number,
|
||||
y: Number,
|
||||
fontColor: Number,
|
||||
calcedFontSize: Number,
|
||||
textBoxWidth: Number,
|
||||
text: String,
|
||||
textBoxHeight: Number,
|
||||
id: String,
|
||||
whiteboardId: String,
|
||||
status: String,
|
||||
fontSize: Number,
|
||||
dataPoints: String,
|
||||
type: String,
|
||||
},
|
||||
wbId: String,
|
||||
userId: String,
|
||||
position: Number,
|
||||
});
|
||||
} else {
|
||||
check(annotation, {
|
||||
id: String,
|
||||
status: String,
|
||||
annotationType: String,
|
||||
annotationInfo: {
|
||||
color: Number,
|
||||
thickness: Number,
|
||||
points: Array,
|
||||
id: String,
|
||||
whiteboardId: String,
|
||||
status: String,
|
||||
type: String,
|
||||
dimensions: Match.Maybe([Number]),
|
||||
},
|
||||
wbId: String,
|
||||
userId: String,
|
||||
position: Number,
|
||||
});
|
||||
}
|
||||
|
||||
const payload = {
|
||||
annotation,
|
||||
};
|
||||
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
import { check } from 'meteor/check';
|
||||
import sendAnnotation from './sendAnnotation';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
import sendAnnotationHelper from './sendAnnotationHelper';
|
||||
|
||||
export default function sendBulkAnnotations(credentials, payload) {
|
||||
check(credentials, Object);
|
||||
check(payload, [Object]);
|
||||
export default function sendBulkAnnotations(payload) {
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
payload.forEach(annotation => sendAnnotation(credentials, annotation));
|
||||
payload.forEach(annotation => sendAnnotationHelper(annotation, meetingId, requesterUserId));
|
||||
}
|
||||
|
@ -1,29 +1,17 @@
|
||||
import { getMultiUserStatus } from '/imports/api/common/server/helpers';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
import isPodPresenter from '/imports/api/presentation-pods/server/utils/isPodPresenter';
|
||||
|
||||
export default function undoAnnotation(credentials, whiteboardId) {
|
||||
export default function undoAnnotation(whiteboardId) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'UndoWhiteboardPubMsg';
|
||||
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
check(whiteboardId, String);
|
||||
|
||||
const allowed = isPodPresenter(meetingId, whiteboardId, requesterUserId)
|
||||
|| getMultiUserStatus(meetingId, whiteboardId);
|
||||
|
||||
if (!allowed) {
|
||||
throw new Meteor.Error('not-allowed', `User ${requesterUserId} is not allowed to undo the annotation`);
|
||||
}
|
||||
|
||||
const payload = {
|
||||
whiteboardId,
|
||||
};
|
||||
|
@ -1,16 +1,16 @@
|
||||
import Annotations from '/imports/api/annotations';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function annotations(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
function annotations() {
|
||||
if (!this.userId) {
|
||||
return Annotations.find({ meetingId: '' });
|
||||
}
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
Logger.debug(`Publishing Annotations for ${meetingId} ${requesterUserId} ${requesterToken}`);
|
||||
Logger.debug(`Publishing Annotations for ${meetingId} ${requesterUserId}`);
|
||||
|
||||
return Annotations.find({ meetingId });
|
||||
}
|
||||
|
@ -1,21 +1,13 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function createBreakoutRoom(credentials, rooms, durationInMinutes, record = false) {
|
||||
export default function createBreakoutRoom(rooms, durationInMinutes, record = false) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
|
||||
const {
|
||||
meetingId,
|
||||
requesterUserId,
|
||||
requesterToken,
|
||||
} = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const eventName = 'CreateBreakoutRoomsCmdMsg';
|
||||
if (rooms.length > 8) return Logger.info(`Attempt to create breakout rooms with invalid number of rooms in meeting id=${meetingId}`);
|
||||
|
@ -1,20 +1,16 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function endAllBreakouts(credentials) {
|
||||
export default function endAllBreakouts() {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
|
||||
const {
|
||||
meetingId,
|
||||
requesterUserId,
|
||||
requesterToken,
|
||||
} = credentials;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
|
||||
const eventName = 'EndAllBreakoutRoomsMsg';
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, eventName, meetingId, requesterUserId, null);
|
||||
|
@ -1,16 +1,13 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function requestJoinURL(credentials, { breakoutId, userId: userIdToInvite }) {
|
||||
export default function requestJoinURL({ breakoutId, userId: userIdToInvite }) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
const userId = userIdToInvite || requesterUserId;
|
||||
const eventName = 'RequestBreakoutJoinURLReqMsg';
|
||||
|
||||
|
@ -2,14 +2,16 @@ import { Meteor } from 'meteor/meteor';
|
||||
import Breakouts from '/imports/api/breakouts';
|
||||
import Users from '/imports/api/users';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
|
||||
|
||||
function breakouts(credentials, moderator = false) {
|
||||
const {
|
||||
meetingId,
|
||||
requesterUserId,
|
||||
} = credentials;
|
||||
function breakouts(moderator = false) {
|
||||
if (!this.userId) {
|
||||
return Breakouts.find({ meetingId: '' });
|
||||
}
|
||||
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
Logger.debug(`Publishing Breakouts for ${meetingId} ${requesterUserId}`);
|
||||
|
||||
if (moderator) {
|
||||
|
@ -1,12 +1,11 @@
|
||||
import { check } from 'meteor/check';
|
||||
import Captions from '/imports/api/captions';
|
||||
import updateOwnerId from '/imports/api/captions/server/modifiers/updateOwnerId';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function takeOwnership(credentials, locale) {
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
export default function takeOwnership(locale) {
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(locale, String);
|
||||
|
||||
const pad = Captions.findOne({ meetingId, padId: { $regex: `_captions_${locale}$` } });
|
||||
|
@ -4,7 +4,7 @@ import Logger from '/imports/startup/server/logger';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
export default function editCaptions(meetingId, userId, padId) {
|
||||
export default function editCaptions(meetingId, userId, padId) { // TODO
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'UpdateCaptionOwnerPubMsg';
|
||||
|
@ -1,13 +1,13 @@
|
||||
import Captions from '/imports/api/captions';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function captions(credentials) {
|
||||
const { meetingId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
|
||||
function captions() {
|
||||
if (!this.userId) {
|
||||
return Captions.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId } = extractCredentials(this.userId);
|
||||
Logger.debug(`Publishing Captions for ${meetingId}`);
|
||||
|
||||
return Captions.find({ meetingId });
|
||||
|
@ -1,4 +1,3 @@
|
||||
import WhiteboardMultiUser from '/imports/api/whiteboard-multi-user/';
|
||||
import Users from '/imports/api/users';
|
||||
|
||||
const MSG_DIRECT_TYPE = 'DIRECT';
|
||||
@ -39,17 +38,6 @@ export const processForHTML5ServerOnly = fn => (message, ...args) => {
|
||||
return fn(message, ...args);
|
||||
};
|
||||
|
||||
|
||||
export const getMultiUserStatus = (meetingId, whiteboardId) => {
|
||||
const data = WhiteboardMultiUser.findOne({ meetingId, whiteboardId });
|
||||
|
||||
if (data) {
|
||||
return data.multiUser;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate a 32 bit FNV-1a hash
|
||||
* Found here: https://gist.github.com/vaiorabbit/5657561
|
||||
@ -75,3 +63,11 @@ export const hashFNV32a = (str, asString, seed) => {
|
||||
return hval >>> 0;
|
||||
};
|
||||
/* eslint-enable */
|
||||
|
||||
export const extractCredentials = (credentials) => {
|
||||
if (!credentials) return {};
|
||||
const credentialsArray = credentials.split('--');
|
||||
const meetingId = credentialsArray[0];
|
||||
const requesterUserId = credentialsArray[1];
|
||||
return { meetingId, requesterUserId };
|
||||
};
|
||||
|
@ -1,38 +1,10 @@
|
||||
import { getMultiUserStatus } from '/imports/api/common/server/helpers';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
import isPodPresenter from '/imports/api/presentation-pods/server/utils/isPodPresenter';
|
||||
|
||||
export default function publishCursorUpdate(credentials, payload) {
|
||||
export default function publishCursorUpdate(meetingId, requesterUserId, payload) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'SendCursorPositionPubMsg';
|
||||
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
check(payload, {
|
||||
xPercent: Number,
|
||||
yPercent: Number,
|
||||
whiteboardId: String,
|
||||
});
|
||||
|
||||
const {
|
||||
whiteboardId,
|
||||
xPercent,
|
||||
yPercent,
|
||||
} = payload;
|
||||
|
||||
const allowed = isPodPresenter(meetingId, whiteboardId, requesterUserId)
|
||||
|| getMultiUserStatus(meetingId, whiteboardId)
|
||||
|| (xPercent < 0 && yPercent < 0);
|
||||
if (!allowed) {
|
||||
throw new Meteor.Error('not-allowed', `User ${requesterUserId} is not allowed to move the cursor`);
|
||||
}
|
||||
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ export function addCursorStreamer(meetingId) {
|
||||
});
|
||||
|
||||
streamer.on('publish', (message) => {
|
||||
publishCursorUpdate(message.credentials, message.payload);
|
||||
publishCursorUpdate(meetingId, message.userId, message.payload);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -8,4 +8,4 @@ export default function destroyExternalVideo(meetingId) {
|
||||
Logger.info(`Destroying External Video streamer object for ${streamName}`);
|
||||
delete Meteor.StreamerCentral.instances[streamName];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
import Users from '/imports/api/users';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
|
||||
@ -19,10 +19,8 @@ const allowFromPresenter = (eventName, message) => {
|
||||
return ret;
|
||||
};
|
||||
|
||||
export default function initializeExternalVideo(credentials) {
|
||||
const { meetingId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
export default function initializeExternalVideo() {
|
||||
const { meetingId } = extractCredentials(this.userId);
|
||||
|
||||
const streamName = `external-videos-${meetingId}`;
|
||||
if (!Meteor.StreamerCentral.instances[streamName]) {
|
||||
|
@ -3,17 +3,16 @@ import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Meetings from '/imports/api/meetings';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function startWatchingExternalVideo(credentials, options) {
|
||||
export default function startWatchingExternalVideo(options) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'StartExternalVideoMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
const { externalVideoUrl } = options;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(externalVideoUrl, String);
|
||||
|
||||
Meetings.update({ meetingId }, { $set: { externalVideoUrl } });
|
||||
|
@ -1,19 +1,13 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Meetings from '/imports/api/meetings';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
|
||||
export default function stopWatchingExternalVideo(credentials) {
|
||||
export default function stopWatchingExternalVideo(meetingId, requesterUserId) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'StopExternalVideoMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
|
||||
const meeting = Meetings.findOne({ meetingId });
|
||||
if (!meeting || meeting.externalVideoUrl === null) return;
|
||||
|
||||
|
@ -1,19 +1,15 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function clearPublicChatHistory(credentials) {
|
||||
export default function clearPublicChatHistory() {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'ClearPublicChatHistoryPubMsg';
|
||||
const CHAT_CONFIG = Meteor.settings.public.chat;
|
||||
const PUBLIC_GROUP_CHAT_ID = CHAT_CONFIG.public_group_id;
|
||||
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const payload = {
|
||||
chatId: PUBLIC_GROUP_CHAT_ID,
|
||||
|
@ -2,6 +2,7 @@ import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import RegexWebUrl from '/imports/utils/regex-weburl';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
const HTML_SAFE_MAP = {
|
||||
'<': '<',
|
||||
@ -26,16 +27,13 @@ const parseMessage = (message) => {
|
||||
return parsedMessage;
|
||||
};
|
||||
|
||||
export default function sendGroupChatMsg(credentials, chatId, message) {
|
||||
export default function sendGroupChatMsg(chatId, message) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'SendGroupChatMessageMsg';
|
||||
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
check(message, Object);
|
||||
|
||||
const parsedMessage = parseMessage(message.message);
|
||||
|
@ -1,17 +1,16 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function startUserTyping(credentials, chatId) {
|
||||
export default function startUserTyping(chatId) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'UserTypingPubMsg';
|
||||
const CHAT_CONFIG = Meteor.settings.public.chat;
|
||||
const PUBLIC_GROUP_CHAT_ID = CHAT_CONFIG.public_group_id;
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(chatId, String);
|
||||
|
||||
const payload = {
|
||||
|
@ -1,12 +1,9 @@
|
||||
import { check } from 'meteor/check';
|
||||
import { UsersTyping } from '/imports/api/group-chat-msg';
|
||||
import stopTyping from '../modifiers/stopTyping';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function stopUserTyping(credentials) {
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
export default function stopUserTyping() {
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const userTyping = UsersTyping.findOne({
|
||||
meetingId,
|
||||
|
@ -1,20 +1,19 @@
|
||||
import { GroupChatMsg, UsersTyping } from '/imports/api/group-chat-msg';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function groupChatMsg(credentials, chatsIds) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
function groupChatMsg(chatsIds) {
|
||||
if (!this.userId) {
|
||||
return GroupChatMsg.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const CHAT_CONFIG = Meteor.settings.public.chat;
|
||||
const PUBLIC_GROUP_CHAT_ID = CHAT_CONFIG.public_group_id;
|
||||
|
||||
Logger.debug(`Publishing group-chat-msg for ${meetingId} ${requesterUserId} ${requesterToken}`);
|
||||
Logger.debug(`Publishing group-chat-msg for ${meetingId} ${requesterUserId}`);
|
||||
|
||||
return GroupChatMsg.find({
|
||||
$or: [
|
||||
@ -31,12 +30,12 @@ function publish(...args) {
|
||||
|
||||
Meteor.publish('group-chat-msg', publish);
|
||||
|
||||
function usersTyping(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
function usersTyping() {
|
||||
if (!this.userId) {
|
||||
return UsersTyping.find({ meetingId: '' });
|
||||
}
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
const { meetingId } = extractCredentials(this.userId);
|
||||
|
||||
return UsersTyping.find({ meetingId });
|
||||
}
|
||||
|
@ -2,18 +2,15 @@ import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { CHAT_ACCESS_PRIVATE } from '/imports/api/group-chat';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
|
||||
export default function createGroupChat(credentials, receiver) {
|
||||
export default function createGroupChat(receiver) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'CreateGroupChatReqMsg';
|
||||
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
check(receiver, Object);
|
||||
|
||||
const payload = {
|
||||
|
@ -1,15 +1,11 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function createGroupChat(credentials) {
|
||||
export default function createGroupChat() {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const eventName = 'DestroyGroupChatReqMsg';
|
||||
|
||||
|
@ -1,20 +1,19 @@
|
||||
import GroupChat from '/imports/api/group-chat';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function groupChat(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
function groupChat() {
|
||||
if (!this.userId) {
|
||||
return GroupChat.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const CHAT_CONFIG = Meteor.settings.public.chat;
|
||||
const PUBLIC_CHAT_TYPE = CHAT_CONFIG.type_public;
|
||||
|
||||
Logger.debug(`Publishing group-chat for ${meetingId} ${requesterUserId} ${requesterToken}`);
|
||||
Logger.debug(`Publishing group-chat for ${meetingId} ${requesterUserId}`);
|
||||
|
||||
return GroupChat.find({
|
||||
$or: [
|
||||
|
@ -2,21 +2,15 @@ import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'GuestsWaitingApprovedMsg';
|
||||
|
||||
export default function allowPendingUsers(credentials, guests, status) {
|
||||
const {
|
||||
meetingId,
|
||||
requesterUserId,
|
||||
requesterToken,
|
||||
} = credentials;
|
||||
export default function allowPendingUsers(guests, status) {
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
check(guests, Array);
|
||||
const mappedGuests = guests.map(guest => ({ status, guest: guest.intId }));
|
||||
|
||||
@ -24,7 +18,6 @@ export default function allowPendingUsers(credentials, guests, status) {
|
||||
approvedBy: requesterUserId,
|
||||
guests: mappedGuests,
|
||||
};
|
||||
|
||||
|
||||
Logger.info(`User=${requesterUserId} ${status} guests ${JSON.stringify(mappedGuests)}`);
|
||||
|
||||
|
@ -2,21 +2,15 @@ import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'SetGuestPolicyCmdMsg';
|
||||
|
||||
export default function changeGuestPolicy(credentials, policyRule) {
|
||||
const {
|
||||
meetingId,
|
||||
requesterUserId,
|
||||
requesterToken,
|
||||
} = credentials;
|
||||
export default function changeGuestPolicy(policyRule) {
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
check(policyRule, String);
|
||||
|
||||
const payload = {
|
||||
|
@ -1,16 +1,16 @@
|
||||
import GuestUsers from '/imports/api/guest-users/';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function guestUsers(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
function guestUsers() {
|
||||
if (!this.userId) {
|
||||
return GuestUsers.find({ meetingId: '' });
|
||||
}
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
Logger.info(`Publishing Slides for ${meetingId} ${requesterUserId} ${requesterToken}`);
|
||||
Logger.info(`Publishing Slides for ${meetingId} ${requesterUserId}`);
|
||||
|
||||
return GuestUsers.find({ meetingId });
|
||||
}
|
||||
|
@ -2,14 +2,13 @@ import _ from 'lodash';
|
||||
import { check } from 'meteor/check';
|
||||
import LocalSettings from '/imports/api/local-settings';
|
||||
import setChangedLocalSettings from '../modifiers/setChangedLocalSettings';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function userChangedLocalSettings(credentials, settings) {
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
export default function userChangedLocalSettings(settings) {
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
if (!meetingId || !requesterUserId) return;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(settings, Object);
|
||||
|
||||
const userLocalSettings = LocalSettings
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import LocalSettings from '/imports/api/local-settings';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function localSettings(credentials) {
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
function localSettings() {
|
||||
if (!this.userId) {
|
||||
return LocalSettings.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
Logger.debug(`Publishing local settings for user=${requesterUserId}`);
|
||||
|
||||
|
@ -11,7 +11,7 @@ const logClient = function (type, logDescription, logCode = 'was_not_provided',
|
||||
userInfo,
|
||||
};
|
||||
|
||||
if (User) {
|
||||
if (User) { // TODO--
|
||||
if ((userInfo.credentials && User.meetingId === userInfo.credentials.meetingId)
|
||||
|| ((userInfo.meetingId && User.meetingId === userInfo.meetingId))) {
|
||||
logContents.extraInfo.validUser = 'valid';
|
||||
|
@ -1,34 +1,18 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Users from '/imports/api/users';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function endMeeting(credentials) {
|
||||
export default function endMeeting() {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'LogoutAndEndMeetingCmdMsg';
|
||||
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
|
||||
const selector = {
|
||||
meetingId,
|
||||
const payload = {
|
||||
userId: requesterUserId,
|
||||
};
|
||||
const user = Users.findOne(selector);
|
||||
Logger.verbose(`Meeting '${meetingId}' is destroyed by '${requesterUserId}'`);
|
||||
|
||||
if (!!user && user.role === ROLE_MODERATOR) {
|
||||
const payload = {
|
||||
userId: requesterUserId,
|
||||
};
|
||||
|
||||
Logger.verbose(`Meeting '${meetingId}' is destroyed by '${requesterUserId}'`);
|
||||
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
||||
}
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
||||
}
|
||||
|
@ -1,16 +1,14 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function toggleLockSettings(credentials, lockSettingsProps) {
|
||||
export default function toggleLockSettings(lockSettingsProps) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'ChangeLockSettingsInMeetingCmdMsg';
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(lockSettingsProps, {
|
||||
disableCam: Boolean,
|
||||
disableMic: Boolean,
|
||||
|
@ -1,20 +1,16 @@
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { RecordMeetings } from '/imports/api/meetings';
|
||||
import Users from '/imports/api/users';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function toggleRecording(credentials) {
|
||||
export default function toggleRecording() {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
const EVENT_NAME = 'SetRecordingStatusCmdMsg';
|
||||
|
||||
let meetingRecorded;
|
||||
@ -30,7 +26,7 @@ export default function toggleRecording(credentials) {
|
||||
} = recordObject;
|
||||
|
||||
meetingRecorded = recording;
|
||||
allowedToRecord = record && allowStartStopRecording;
|
||||
allowedToRecord = record && allowStartStopRecording; // TODO-- remove some day
|
||||
}
|
||||
|
||||
const payload = {
|
||||
|
@ -1,16 +1,14 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '../../../common/server/helpers';
|
||||
|
||||
export default function toggleWebcamsOnlyForModerator(credentials, webcamsOnlyForModerator) {
|
||||
export default function toggleWebcamsOnlyForModerator(webcamsOnlyForModerator) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'UpdateWebcamsOnlyForModeratorCmdMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
check(webcamsOnlyForModerator, Boolean);
|
||||
|
||||
const payload = {
|
||||
|
@ -1,18 +1,15 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function transferUser(credentials, fromMeetingId, toMeetingId) {
|
||||
|
||||
export default function transferUser(fromMeetingId, toMeetingId) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'TransferUserToMeetingRequestMsg';
|
||||
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const payload = {
|
||||
fromMeetingId,
|
||||
|
@ -1,19 +1,18 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Meetings, { RecordMeetings, MeetingTimeRemaining } from '/imports/api/meetings';
|
||||
import Users from '/imports/api/users';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
|
||||
|
||||
function meetings(credentials, isModerator = false) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
function meetings(isModerator = false) {
|
||||
if (!this.userId) {
|
||||
return Meetings.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
|
||||
Logger.debug(`Publishing meeting =${meetingId} ${requesterUserId} ${requesterToken}`);
|
||||
Logger.debug(`Publishing meeting =${meetingId} ${requesterUserId}`);
|
||||
|
||||
const selector = {
|
||||
$or: [
|
||||
@ -47,11 +46,11 @@ function publish(...args) {
|
||||
|
||||
Meteor.publish('meetings', publish);
|
||||
|
||||
function recordMeetings(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
function recordMeetings() {
|
||||
if (!this.userId) {
|
||||
return RecordMeetings.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId } = extractCredentials(this.userId);
|
||||
|
||||
return RecordMeetings.find({ meetingId });
|
||||
}
|
||||
@ -62,11 +61,11 @@ function recordPublish(...args) {
|
||||
|
||||
Meteor.publish('record-meetings', recordPublish);
|
||||
|
||||
function meetingTimeRemaining(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
function meetingTimeRemaining() {
|
||||
if (!this.userId) {
|
||||
return MeetingTimeRemaining.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId } = extractCredentials(this.userId);
|
||||
|
||||
return MeetingTimeRemaining.find({ meetingId });
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
import { check } from 'meteor/check';
|
||||
import NetworkInformation from '/imports/api/network-information';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function userInstabilityDetected(credentials, sender) {
|
||||
const { meetingId, requesterUserId: receiver } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(receiver, String);
|
||||
export default function userInstabilityDetected(sender) {
|
||||
const { meetingId, requesterUserId: receiver } = extractCredentials(this.userId);
|
||||
check(sender, String);
|
||||
|
||||
const payload = {
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import NetworkInformation from '/imports/api/network-information';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function networkInformation(credentials) {
|
||||
const { meetingId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
function networkInformation() {
|
||||
if (!this.userId) {
|
||||
return NetworkInformation.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId } = extractCredentials(this.userId);
|
||||
|
||||
return NetworkInformation.find({
|
||||
meetingId,
|
||||
|
@ -1,16 +1,15 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Note from '/imports/api/note';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function note(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
function note() {
|
||||
if (!this.userId) {
|
||||
return Note.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
|
||||
Logger.info(`Publishing note for ${meetingId} ${requesterUserId} ${requesterToken}`);
|
||||
Logger.info(`Publishing note for ${meetingId} ${requesterUserId}`);
|
||||
|
||||
return Note.find({ meetingId });
|
||||
}
|
||||
|
@ -1,13 +1,9 @@
|
||||
import { check } from 'meteor/check';
|
||||
import Users from '/imports/api/users';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function ping(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
export default function ping() {
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const selector = {
|
||||
meetingId,
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import _ from 'lodash';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
const COLLECTION_NAME = 'ping-pong';
|
||||
const INTERVAL_IN_SETTINGS = (Meteor.settings.public.pingPong.clearUsersInSeconds) * 1000;
|
||||
@ -9,8 +10,11 @@ const PONG_INTERVAL_IN_SETTINGS = (Meteor.settings.public.pingPong.pongTimeInSec
|
||||
const PONG_INTERVAL = PONG_INTERVAL_IN_SETTINGS >= (INTERVAL_TIME / 2)
|
||||
? (INTERVAL_TIME / 2) : PONG_INTERVAL_IN_SETTINGS;
|
||||
|
||||
function pingPong(credentials) {
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
function pingPong() {
|
||||
if (!this.userId) {
|
||||
return; // TODO-- is there a more appropriate set to return?
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
const id = _.uniqueId('pong-');
|
||||
Logger.info(`Starting ping-pong publish for userId: ${requesterUserId}`);
|
||||
const pongSender = (interval) => {
|
||||
|
@ -1,18 +1,15 @@
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { check } from 'meteor/check';
|
||||
import Polls from '/imports/api/polls';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function publishPoll(credentials) {
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
export default function publishPoll() {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'ShowPollResultReqMsg';
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
|
||||
const poll = Polls.findOne({ meetingId });
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
const poll = Polls.findOne({ meetingId }); // TODO--send pollid from client
|
||||
if (!poll) {
|
||||
Logger.error(`Attempted to publish inexisting poll for meetingId: ${meetingId}`);
|
||||
return false;
|
||||
|
@ -2,14 +2,14 @@ import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { check } from 'meteor/check';
|
||||
import Polls from '/imports/api/polls';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function publishVote(credentials, id, pollAnswerId) { // TODO discuss location
|
||||
export default function publishVote(id, pollAnswerId) { // TODO discuss location
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'RespondToPollReqMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
/*
|
||||
We keep an array of people who were in the meeting at the time the poll
|
||||
was started. The poll is published to them only.
|
||||
@ -22,8 +22,6 @@ export default function publishVote(credentials, id, pollAnswerId) { // TODO dis
|
||||
id,
|
||||
});
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(pollAnswerId, Number);
|
||||
check(currentPoll, Object);
|
||||
check(currentPoll.meetingId, String);
|
||||
|
@ -1,16 +1,15 @@
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Polls from '/imports/api/polls';
|
||||
import { check } from 'meteor/check';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function startPoll(credentials, pollType, pollId, answers) {
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
export default function startPoll(pollType, pollId, answers) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
|
||||
let EVENT_NAME = 'StartPollReqMsg';
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(pollId, String);
|
||||
check(pollType, String);
|
||||
|
||||
|
@ -1,20 +1,17 @@
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { check } from 'meteor/check';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function stopPoll(credentials) {
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
export default function stopPoll() {
|
||||
const { meetingId, requesterUserId: requesterId } = extractCredentials(this.userId);
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'StopPollReqMsg';
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
|
||||
return RedisPubSub.publishUserMessage(
|
||||
CHANNEL,
|
||||
EVENT_NAME,
|
||||
meetingId,
|
||||
requesterUserId,
|
||||
({ requesterId: requesterUserId }),
|
||||
requesterId,
|
||||
({ requesterId }),
|
||||
);
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Polls from '/imports/api/polls';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
Meteor.publish('current-poll', (meetingId) => {
|
||||
check(meetingId, String);
|
||||
function currentPoll() {
|
||||
if (!this.userId) {
|
||||
return Polls.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId } = extractCredentials(this.userId);
|
||||
|
||||
const selector = {
|
||||
meetingId,
|
||||
@ -13,17 +16,24 @@ Meteor.publish('current-poll', (meetingId) => {
|
||||
Logger.debug(`Publishing poll for meeting=${meetingId}`);
|
||||
|
||||
return Polls.find(selector);
|
||||
});
|
||||
}
|
||||
|
||||
function publishCurrentPoll(...args) {
|
||||
const boundPolls = currentPoll.bind(this);
|
||||
return boundPolls(...args);
|
||||
}
|
||||
|
||||
Meteor.publish('current-poll', publishCurrentPoll);
|
||||
|
||||
|
||||
function polls(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
function polls() {
|
||||
if (!this.userId) {
|
||||
return Polls.find({ meetingId: '' });
|
||||
}
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
Logger.debug(`Publishing polls =${meetingId} ${requesterUserId} ${requesterToken}`);
|
||||
Logger.debug(`Publishing polls =${meetingId} ${requesterUserId}`);
|
||||
|
||||
const selector = {
|
||||
meetingId,
|
||||
|
@ -2,7 +2,7 @@ import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
|
||||
export default function setPresenterInPodReqMsg(credentials) {
|
||||
export default function setPresenterInPodReqMsg(credentials) { // TODO-- switch to meetingId, etc
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'SetPresenterInPodReqMsg';
|
||||
|
@ -1,16 +1,14 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import PresentationPods from '/imports/api/presentation-pods';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function presentationPods(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
|
||||
Logger.debug(`Publishing presentation-pods for ${meetingId} ${requesterUserId} ${requesterToken}`);
|
||||
function presentationPods() {
|
||||
if (!this.userId) {
|
||||
return PresentationPods.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
Logger.debug(`Publishing presentation-pods for ${meetingId} ${requesterUserId}`);
|
||||
|
||||
return PresentationPods.find({ meetingId });
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
import { Slides } from '/imports/api/slides';
|
||||
import PresentationPods from '/imports/api/presentation-pods';
|
||||
|
||||
export default function isPodPresenter(meetingId, whiteboardId, userId) {
|
||||
const slide = Slides.findOne({ meetingId, id: whiteboardId });
|
||||
const pod = PresentationPods.findOne({ meetingId, podId: slide.podId });
|
||||
|
||||
return pod.currentPresenterId === userId;
|
||||
}
|
@ -1,15 +1,13 @@
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { check } from 'meteor/check';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function requestPresentationUploadToken(credentials, podId, filename) {
|
||||
export default function requestPresentationUploadToken(podId, filename) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'PresentationUploadTokenReqMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
check(podId, String);
|
||||
check(filename, String);
|
||||
|
||||
|
@ -1,12 +1,9 @@
|
||||
import PresentationUploadToken from '/imports/api/presentation-upload-token';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { check } from 'meteor/check';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function setUsedToken(credentials, authzToken) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
export default function setUsedToken(authzToken) {
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const payload = {
|
||||
$set: {
|
||||
|
@ -2,13 +2,13 @@ import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import PresentationUploadToken from '/imports/api/presentation-upload-token';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
Meteor.publish('presentation-upload-token', (credentials, podId, filename) => {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
function presentationUploadToken(podId, filename) {
|
||||
if (!this.userId) {
|
||||
return PresentationUploadToken.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
check(podId, String);
|
||||
check(filename, String);
|
||||
|
||||
@ -19,7 +19,14 @@ Meteor.publish('presentation-upload-token', (credentials, podId, filename) => {
|
||||
filename,
|
||||
};
|
||||
|
||||
Logger.debug(`Publishing PresentationUploadToken for ${meetingId} ${requesterUserId} ${requesterToken}`);
|
||||
Logger.debug(`Publishing PresentationUploadToken for ${meetingId} ${requesterUserId}`);
|
||||
|
||||
return PresentationUploadToken.find(selector);
|
||||
});
|
||||
}
|
||||
|
||||
function publish(...args) {
|
||||
const boundPresentationUploadToken = presentationUploadToken.bind(this);
|
||||
return boundPresentationUploadToken(...args);
|
||||
}
|
||||
|
||||
Meteor.publish('presentation-upload-token', publish);
|
||||
|
@ -1,30 +1,17 @@
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { check } from 'meteor/check';
|
||||
import Presentations from '/imports/api/presentations';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function removePresentation(credentials, presentationId, podId) {
|
||||
const PRESENTATION_CONFIG = Meteor.settings.public.presentation;
|
||||
export default function removePresentation(presentationId, podId) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'RemovePresentationPubMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(presentationId, String);
|
||||
check(podId, String);
|
||||
|
||||
const presentationToDelete = Presentations.findOne({
|
||||
meetingId,
|
||||
id: presentationId,
|
||||
podId,
|
||||
});
|
||||
|
||||
if (presentationToDelete.name === PRESENTATION_CONFIG.defaultPresentationFile) {
|
||||
throw new Meteor.Error('not-allowed', 'You are not allowed to remove the default slide');
|
||||
}
|
||||
|
||||
const payload = {
|
||||
presentationId,
|
||||
podId,
|
||||
|
@ -1,39 +1,20 @@
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { check } from 'meteor/check';
|
||||
import Presentations from '/imports/api/presentations';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function setPresentation(credentials, presentationId, podId) {
|
||||
export default function setPresentation(presentationId, podId) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'SetCurrentPresentationPubMsg';
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(presentationId, String);
|
||||
check(podId, String);
|
||||
|
||||
const currentPresentation = Presentations.findOne({
|
||||
meetingId,
|
||||
id: presentationId,
|
||||
const payload = {
|
||||
presentationId,
|
||||
podId,
|
||||
});
|
||||
};
|
||||
|
||||
if (currentPresentation) {
|
||||
if (currentPresentation.current) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
const payload = {
|
||||
presentationId,
|
||||
podId,
|
||||
};
|
||||
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
||||
}
|
||||
|
||||
// did not find presentation with such id. abandon
|
||||
// return Promise.resolve(); // will close the uploading modal
|
||||
throw new Meteor.Error('presentation-not-found', `Did not find a presentation with id ${presentationId} in method setPresentation`);
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { check } from 'meteor/check';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function setPresentationDownloadable(credentials, presentationId, downloadable) {
|
||||
export default function setPresentationDownloadable(presentationId, downloadable) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'SetPresentationDownloadablePubMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(downloadable, Boolean);
|
||||
check(presentationId, String);
|
||||
|
||||
|
@ -1,16 +1,15 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Presentations from '/imports/api/presentations';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function presentations(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
function presentations() {
|
||||
if (!this.userId) {
|
||||
return Presentations.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
|
||||
Logger.debug(`Publishing Presentations for ${meetingId} ${requesterUserId} ${requesterToken}`);
|
||||
Logger.debug(`Publishing Presentations for ${meetingId} ${requesterUserId}`);
|
||||
|
||||
return Presentations.find({ meetingId });
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
import Screenshare from '/imports/api/screenshare';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function screenshare(credentials) {
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
function screenshare() {
|
||||
if (!this.userId) {
|
||||
return Screenshare.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
Logger.debug(`Publishing Screenshare for ${meetingId} ${requesterUserId}`);
|
||||
|
||||
|
@ -3,18 +3,14 @@ import { Slides } from '/imports/api/slides';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function switchSlide(credentials, slideNumber, podId) {
|
||||
export default function switchSlide(slideNumber, podId) { // TODO-- send presentationId and SlideId
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'SetCurrentPagePubMsg';
|
||||
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
check(slideNumber, Number);
|
||||
|
||||
const selector = {
|
||||
|
@ -1,20 +1,15 @@
|
||||
import Presentations from '/imports/api/presentations';
|
||||
import { Slides } from '/imports/api/slides';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function zoomSlide(credentials, slideNumber, podId, widthRatio, heightRatio, x, y) {
|
||||
export default function zoomSlide(slideNumber, podId, widthRatio, heightRatio, x, y) { // TODO-- send presentationId and SlideId
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'ResizeAndMovePagePubMsg';
|
||||
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const selector = {
|
||||
meetingId,
|
||||
|
@ -1,16 +1,14 @@
|
||||
import { Slides, SlidePositions } from '/imports/api/slides';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function slides(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
|
||||
Logger.debug(`Publishing Slides for ${meetingId} ${requesterUserId} ${requesterToken}`);
|
||||
function slides() {
|
||||
if (!this.userId) {
|
||||
return Slides.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
Logger.debug(`Publishing Slides for ${meetingId} ${requesterUserId}`);
|
||||
|
||||
return Slides.find({ meetingId });
|
||||
}
|
||||
@ -22,14 +20,13 @@ function publish(...args) {
|
||||
|
||||
Meteor.publish('slides', publish);
|
||||
|
||||
function slidePositions(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
function slidePositions() {
|
||||
if (!this.userId) {
|
||||
return SlidePositions.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
|
||||
Logger.debug(`Publishing SlidePositions for ${meetingId} ${requesterUserId} ${requesterToken}`);
|
||||
Logger.debug(`Publishing SlidePositions for ${meetingId} ${requesterUserId}`);
|
||||
|
||||
return SlidePositions.find({ meetingId });
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import UserInfos from '/imports/api/users-infos';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
|
||||
export default function removeUserInformation(credentials, meetingId, requesterUserId) {
|
||||
export default function removeUserInformation(meetingId, requesterUserId) {
|
||||
const selector = {
|
||||
meetingId,
|
||||
requesterUserId,
|
||||
|
@ -1,16 +1,14 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function getUserInformation(credentials, externalUserId) {
|
||||
export default function getUserInformation(externalUserId) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toThirdParty;
|
||||
const EVENT_NAME = 'LookUpUserReqMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
check(externalUserId, String);
|
||||
|
||||
const payload = {
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import UserInfos from '/imports/api/users-infos';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function userInfos(credentials) {
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
function userInfos() {
|
||||
if (!this.userId) {
|
||||
return UserInfos.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
Logger.debug(`Publishing user infos requested by user=${requesterUserId}`);
|
||||
|
||||
|
@ -73,9 +73,7 @@ function valueParser(val) {
|
||||
}
|
||||
}
|
||||
|
||||
export default function addUserSettings(credentials, meetingId, userId, settings) {
|
||||
check(meetingId, String);
|
||||
check(userId, String);
|
||||
export default function addUserSettings(meetingId, userId, settings) {
|
||||
check(settings, [Object]);
|
||||
|
||||
let parameters = {};
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import UserSettings from '/imports/api/users-settings';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function userSettings(credentials) {
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
function userSettings() {
|
||||
if (!this.userId) {
|
||||
return UserSettings.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
Logger.debug(`Publishing user settings for user=${requesterUserId}`);
|
||||
|
||||
|
@ -8,10 +8,6 @@ export default function userJoin(meetingId, userId, authToken) {
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'UserJoinMeetingReqMsg';
|
||||
|
||||
Logger.info(`User='${userId}' is joining meeting='${meetingId}' authToken='${authToken}' pt1`);
|
||||
|
||||
check(meetingId, String);
|
||||
check(userId, String);
|
||||
check(authToken, String);
|
||||
|
||||
const payload = {
|
||||
@ -20,7 +16,7 @@ export default function userJoin(meetingId, userId, authToken) {
|
||||
clientType: 'HTML5',
|
||||
};
|
||||
|
||||
Logger.info(`User='${userId}' is joining meeting='${meetingId}' authToken='${authToken}' pt2`);
|
||||
Logger.info(`User='${userId}' is joining meeting='${meetingId}' authToken='${authToken}'`);
|
||||
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, userId, payload);
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Users from '/imports/api/users';
|
||||
import userJoin from '../methods/userJoin';
|
||||
import userJoin from './userJoin';
|
||||
|
||||
const clearOtherSessions = (sessionUserId, current = false) => {
|
||||
const serverSessions = Meteor.server.sessions;
|
||||
|
@ -3,16 +3,14 @@ import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Users from '/imports/api/users';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function assignPresenter(credentials, userId) {
|
||||
export default function assignPresenter(userId) { // TODO-- send username from client side
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'AssignPresenterReqMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
check(userId, String);
|
||||
|
||||
const User = Users.findOne({
|
||||
|
@ -2,36 +2,25 @@ import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Users from '/imports/api/users';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function changeRole(credentials, userId, role) {
|
||||
export default function changeRole(userId, role) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'ChangeUserRoleCmdMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(userId, String);
|
||||
check(role, String);
|
||||
|
||||
const User = Users.findOne({
|
||||
meetingId,
|
||||
userId,
|
||||
});
|
||||
|
||||
if (!User) {
|
||||
throw new Meteor.Error('user-not-found', `You need a valid user to be able to set '${role}'`);
|
||||
}
|
||||
|
||||
const payload = {
|
||||
userId,
|
||||
role,
|
||||
changedBy: requesterUserId,
|
||||
};
|
||||
|
||||
Logger.verbose(`User '${userId}' setted as '${role} role by '${requesterUserId}' from meeting '${meetingId}'`);
|
||||
Logger.verbose(`User '${userId}' set as '${role} role by '${requesterUserId}' from meeting '${meetingId}'`);
|
||||
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
||||
}
|
||||
|
@ -1,22 +1,21 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function removeUser(credentials, userId) {
|
||||
export default function removeUser(userId) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'EjectUserFromMeetingCmdMsg';
|
||||
|
||||
const { requesterUserId, meetingId } = credentials;
|
||||
const { meetingId, requesterUserId: ejectedBy } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(userId, String);
|
||||
|
||||
const payload = {
|
||||
userId,
|
||||
ejectedBy: requesterUserId,
|
||||
ejectedBy,
|
||||
};
|
||||
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, ejectedBy, payload);
|
||||
}
|
||||
|
@ -2,16 +2,15 @@ import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function setEmojiStatus(credentials, userId, status) {
|
||||
export default function setEmojiStatus(userId, status) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'ChangeUserEmojiCmdMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(userId, String);
|
||||
|
||||
const payload = {
|
||||
|
@ -2,17 +2,15 @@ import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
import setEffectiveConnectionType from '../modifiers/setUserEffectiveConnectionType';
|
||||
|
||||
export default function setUserEffectiveConnectionType(credentials, effectiveConnectionType) {
|
||||
export default function setUserEffectiveConnectionType(effectiveConnectionType) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'ChangeUserEffectiveConnectionMsg';
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(effectiveConnectionType, String);
|
||||
|
||||
const payload = {
|
||||
|
@ -2,15 +2,15 @@ import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function toggleUserLock(credentials, userId, lock) {
|
||||
export default function toggleUserLock(userId, lock) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'LockUserInMeetingCmdMsg';
|
||||
|
||||
const { meetingId, requesterUserId: lockedBy } = credentials;
|
||||
const { meetingId, requesterUserId: lockedBy } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(lockedBy, String);
|
||||
check(userId, String);
|
||||
check(lock, Boolean);
|
||||
|
@ -1,19 +1,14 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Users from '/imports/api/users';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function userActivitySign(credentials) {
|
||||
export default function userActivitySign() {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'UserActivitySignCmdMsg';
|
||||
|
||||
const { meetingId, requesterUserId: userId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(userId, String);
|
||||
|
||||
const { meetingId, requesterUserId: userId } = extractCredentials(this.userId);
|
||||
const payload = {
|
||||
userId,
|
||||
};
|
||||
@ -28,7 +23,7 @@ export default function userActivitySign(credentials) {
|
||||
},
|
||||
};
|
||||
|
||||
Users.update(selector, modifier);
|
||||
Users.update(selector, modifier); // TODO-- we should move this to a modifier
|
||||
|
||||
Logger.info(`User ${userId} sent a activity sign for meeting ${meetingId}`);
|
||||
|
||||
|
@ -4,15 +4,11 @@ import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Users from '/imports/api/users';
|
||||
|
||||
export default function userLeaving(credentials, userId, connectionId) {
|
||||
export default function userLeaving(meetingId, userId, connectionId) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'UserLeaveReqMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(userId, String);
|
||||
|
||||
const selector = {
|
||||
@ -37,5 +33,5 @@ export default function userLeaving(credentials, userId, connectionId) {
|
||||
};
|
||||
|
||||
Logger.info(`User '${userId}' is leaving meeting '${meetingId}'`);
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, userId, payload);
|
||||
}
|
||||
|
@ -1,16 +1,10 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Users from '/imports/api/users';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function userLeftMeeting(credentials) {
|
||||
const {
|
||||
meetingId,
|
||||
requesterUserId,
|
||||
} = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
export default function userLeftMeeting() { // TODO-- spread the code to method/modifier/handler
|
||||
// so we don't update the db in a method
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const selector = {
|
||||
meetingId,
|
||||
|
@ -1,23 +1,16 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Users from '/imports/api/users';
|
||||
import createDummyUser from '../modifiers/createDummyUser';
|
||||
import setConnectionIdAndAuthToken from '../modifiers/setConnectionIdAndAuthToken';
|
||||
|
||||
export default function validateAuthToken(credentials) {
|
||||
export default function validateAuthToken(meetingId, requesterUserId, requesterToken) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'ValidateAuthTokenReqMsg';
|
||||
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
|
||||
const sessionId = `${meetingId}-${requesterUserId}`;
|
||||
const sessionId = `${meetingId}--${requesterUserId}`;
|
||||
this.setUserId(sessionId);
|
||||
|
||||
const User = Users.findOne({
|
||||
|
@ -5,16 +5,23 @@ import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
|
||||
import userLeaving from './methods/userLeaving';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
|
||||
|
||||
Meteor.publish('current-user', function currentUserPub(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
function currentUser() {
|
||||
if (!this.userId) {
|
||||
return Users.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
|
||||
const connectionId = this.connection.id;
|
||||
const onCloseConnection = Meteor.bindEnvironment(() => {
|
||||
try {
|
||||
userLeaving(credentials, requesterUserId, connectionId);
|
||||
userLeaving(meetingId, requesterUserId, connectionId);
|
||||
} catch (e) {
|
||||
Logger.error(`Exception while executing userLeaving: ${e}`);
|
||||
}
|
||||
@ -22,35 +29,33 @@ Meteor.publish('current-user', function currentUserPub(credentials) {
|
||||
|
||||
this._session.socket.on('close', _.debounce(onCloseConnection, 100));
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
|
||||
const selector = {
|
||||
meetingId,
|
||||
userId: requesterUserId,
|
||||
authToken: requesterToken,
|
||||
};
|
||||
|
||||
const options = {
|
||||
fields: {
|
||||
user: false,
|
||||
authToken: false, // Not asking for authToken from client side but also not exposing it
|
||||
},
|
||||
};
|
||||
|
||||
return Users.find(selector, options);
|
||||
});
|
||||
}
|
||||
|
||||
function users(credentials, isModerator = false) {
|
||||
const {
|
||||
meetingId,
|
||||
requesterUserId,
|
||||
requesterToken,
|
||||
} = credentials;
|
||||
function publishCurrentUser(...args) {
|
||||
const boundUsers = currentUser.bind(this);
|
||||
return boundUsers(...args);
|
||||
}
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
Meteor.publish('current-user', publishCurrentUser);
|
||||
|
||||
function users(isModerator = false) {
|
||||
if (!this.userId) {
|
||||
return Users.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const selector = {
|
||||
$or: [
|
||||
@ -76,7 +81,7 @@ function users(credentials, isModerator = false) {
|
||||
},
|
||||
};
|
||||
|
||||
Logger.debug(`Publishing Users for ${meetingId} ${requesterUserId} ${requesterToken}`);
|
||||
Logger.debug(`Publishing Users for ${meetingId} ${requesterUserId}`);
|
||||
|
||||
return Users.find(selector, options);
|
||||
}
|
||||
|
@ -2,19 +2,16 @@ import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function userShareWebcam(credentials, stream) {
|
||||
export default function userShareWebcam(stream) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'UserBroadcastCamStartMsg';
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
Logger.info(`user sharing webcam: ${meetingId} ${requesterUserId}`);
|
||||
|
||||
Logger.info(' user sharing webcam: ', credentials);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
check(stream, String);
|
||||
|
||||
// const actionName = 'joinVideo';
|
||||
|
@ -2,19 +2,16 @@ import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function userUnshareWebcam(credentials, stream) {
|
||||
export default function userUnshareWebcam(stream) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'UserBroadcastCamStopMsg';
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
Logger.info(`user unsharing webcam: ${meetingId} ${requesterUserId}`);
|
||||
|
||||
Logger.info(' user unsharing webcam: ', credentials);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
check(stream, String);
|
||||
|
||||
// const actionName = 'joinVideo';
|
||||
|
@ -1,14 +1,13 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import VideoStreams from '/imports/api/video-streams';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function videoStreams(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
function videoStreams() {
|
||||
if (!this.userId) {
|
||||
return VideoStreams.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId } = extractCredentials(this.userId);
|
||||
|
||||
Logger.debug(`video users of meeting id=${meetingId}`);
|
||||
|
||||
|
@ -7,7 +7,6 @@ import ejectUserFromVoice from './methods/ejectUserFromVoice';
|
||||
|
||||
Meteor.methods({
|
||||
listenOnlyToggle,
|
||||
toggleSelfVoice: (credentials) => { muteToggle(credentials, credentials.requesterUserId); },
|
||||
toggleVoice: muteToggle,
|
||||
muteAllUsers: muteAllToggle,
|
||||
muteAllExceptPresenter: muteAllExceptPresenterToggle,
|
||||
|
@ -1,16 +1,14 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function ejectUserFromVoice(credentials, userId) {
|
||||
export default function ejectUserFromVoice(userId) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'EjectUserFromVoiceCmdMsg';
|
||||
|
||||
const { requesterUserId, meetingId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
check(userId, String);
|
||||
|
||||
const payload = {
|
||||
|
@ -4,15 +4,14 @@ import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import Meetings from '/imports/api/meetings';
|
||||
import VoiceUsers from '/imports/api/voice-users';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function listenOnlyToggle(credentials, isJoining = true) {
|
||||
export default function listenOnlyToggle(isJoining = true) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(isJoining, Boolean);
|
||||
|
||||
let EVENT_NAME;
|
||||
|
@ -1,17 +1,15 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Meetings from '/imports/api/meetings';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function muteAllExceptPresenterToggle(credentials) {
|
||||
export default function muteAllExceptPresenterToggle() {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'MuteAllExceptPresentersCmdMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
const meeting = Meetings.findOne({ meetingId });
|
||||
const toggleMeetingMuted = !meeting.voiceProp.muteOnStart;
|
||||
|
||||
|
@ -1,17 +1,15 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Meetings from '/imports/api/meetings';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function muteAllToggle(credentials) {
|
||||
export default function muteAllToggle() {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'MuteMeetingCmdMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
const meeting = Meetings.findOne({ meetingId });
|
||||
const toggleMeetingMuted = !meeting.voiceProp.muteOnStart;
|
||||
|
||||
|
@ -1,18 +1,16 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Users from '/imports/api/users';
|
||||
import VoiceUsers from '/imports/api/voice-users';
|
||||
|
||||
export default function muteToggle(credentials, userId) {
|
||||
export default function muteToggle(uId) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'MuteUserCmdMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
const userToMute = uId || requesterUserId;
|
||||
|
||||
const requester = Users.findOne({
|
||||
meetingId,
|
||||
@ -20,7 +18,7 @@ export default function muteToggle(credentials, userId) {
|
||||
});
|
||||
|
||||
const voiceUser = VoiceUsers.findOne({
|
||||
intId: userId,
|
||||
intId: userToMute,
|
||||
});
|
||||
|
||||
if (!requester || !voiceUser) return;
|
||||
@ -29,7 +27,7 @@ export default function muteToggle(credentials, userId) {
|
||||
if (listenOnly) return;
|
||||
|
||||
const payload = {
|
||||
userId,
|
||||
userId: userToMute,
|
||||
mutedBy: requesterUserId,
|
||||
mute: !muted,
|
||||
};
|
||||
|
@ -1,13 +1,13 @@
|
||||
import VoiceUsers from '/imports/api/voice-users';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function voiceUser(credentials) {
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
function voiceUser() {
|
||||
if (!this.userId) {
|
||||
return VoiceUsers.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
Logger.debug(`Publishing Voice User for ${meetingId} ${requesterUserId}`);
|
||||
|
||||
|
@ -1,17 +1,15 @@
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
export default function changeWhiteboardAccess(credentials, multiUser, whiteboardId) {
|
||||
export default function changeWhiteboardAccess(multiUser, whiteboardId) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'ModifyWhiteboardAccessPubMsg';
|
||||
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
check(multiUser, Boolean);
|
||||
check(whiteboardId, String);
|
||||
|
||||
|
@ -1,18 +1,20 @@
|
||||
import WhiteboardMultiUser from '/imports/api/whiteboard-multi-user/';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
|
||||
function whiteboardMultiUser(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
function whiteboardMultiUser() {
|
||||
if (!this.userId) {
|
||||
return WhiteboardMultiUser.find({ meetingId: '' });
|
||||
}
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
|
||||
Logger.debug(`Publishing whiteboard-multi-user for ${meetingId} ${requesterUserId} ${requesterToken}`);
|
||||
Logger.debug(`Publishing whiteboard-multi-user for ${meetingId} ${requesterUserId}`);
|
||||
|
||||
return WhiteboardMultiUser.find({ meetingId });
|
||||
}
|
||||
|
||||
|
||||
function publish(...args) {
|
||||
const boundMultiUser = whiteboardMultiUser.bind(this);
|
||||
return boundMultiUser(...args);
|
||||
|
@ -88,10 +88,9 @@ Meteor.startup(() => {
|
||||
Logger.info('Removing inactive users');
|
||||
users.forEach((user) => {
|
||||
Logger.info(`Detected inactive user, userId:${user.userId}, meetingId:${user.meetingId}`);
|
||||
user.requesterUserId = user.userId;
|
||||
return userLeaving(user, user.userId, user.connectionId);
|
||||
return userLeaving(user.meetingId, user.userId, user.connectionId);
|
||||
});
|
||||
return Logger.info('All inactive user have been removed');
|
||||
return Logger.info('All inactive users have been removed');
|
||||
}, INTERVAL_TIME);
|
||||
|
||||
Logger.warn(`SERVER STARTED.\nENV=${env},\nnodejs version=${process.version}\nCDN=${CDN_URL}\n`, APP_CONFIG);
|
||||
|
@ -14,7 +14,7 @@ const AudioControlsContainer = props => <AudioControls {...props} />;
|
||||
const processToggleMuteFromOutside = (e) => {
|
||||
switch (e.data) {
|
||||
case 'c_mute': {
|
||||
makeCall('toggleSelfVoice');
|
||||
makeCall('toggleVoice');
|
||||
break;
|
||||
}
|
||||
case 'get_audio_joined_status': {
|
||||
|
@ -50,13 +50,13 @@ const toggleMuteMicrophone = () => {
|
||||
logCode: 'audiomanager_unmute_audio',
|
||||
extraInfo: { logType: 'user_action' },
|
||||
}, 'microphone unmuted by user');
|
||||
makeCall('toggleSelfVoice');
|
||||
makeCall('toggleVoice');
|
||||
} else {
|
||||
logger.info({
|
||||
logCode: 'audiomanager_mute_audio',
|
||||
extraInfo: { logType: 'user_action' },
|
||||
}, 'microphone muted by user');
|
||||
makeCall('toggleSelfVoice');
|
||||
makeCall('toggleVoice');
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -68,7 +68,9 @@ class AuthenticatedHandler extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (Session.get('codeError')) return this.changeState(true);
|
||||
if (Session.get('codeError')) {
|
||||
this.setState({ authenticated: true });
|
||||
}
|
||||
AuthenticatedHandler.authenticatedRouteHandler((value, error) => {
|
||||
if (error) AuthenticatedHandler.setError(error);
|
||||
this.setState({ authenticated: true });
|
||||
|
@ -26,7 +26,7 @@ export function publishCursorUpdate(payload) {
|
||||
const throttledEmit = throttle(cursorStreamListener.emit.bind(cursorStreamListener), 30, { trailing: true });
|
||||
|
||||
throttledEmit('publish', {
|
||||
credentials: Auth.credentials,
|
||||
userId: Auth.userID,
|
||||
payload,
|
||||
});
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import { styles } from './styles';
|
||||
const intlMessages = defineMessages({
|
||||
500: {
|
||||
id: 'app.error.500',
|
||||
defaultMessage: 'Ops, something went wrong',
|
||||
defaultMessage: 'Oops, something went wrong',
|
||||
},
|
||||
410: {
|
||||
id: 'app.error.410',
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user