bigbluebutton-Github/bigbluebutton-html5/imports/api/meetings/server/modifiers/addMeeting.js

226 lines
6.2 KiB
JavaScript
Raw Normal View History

2017-10-12 06:17:42 +08:00
import flat from 'flat';
2019-03-20 04:06:13 +08:00
import {
check,
Match,
} from 'meteor/check';
import SanitizeHTML from 'sanitize-html';
import Meetings, {
RecordMeetings,
ExternalVideoMeetings,
} from '/imports/api/meetings';
2016-10-22 00:27:47 +08:00
import Logger from '/imports/startup/server/logger';
import { initPads } from '/imports/api/common/server/etherpad';
2019-10-23 09:26:25 +08:00
import { addAnnotationsStreamer } from '/imports/api/annotations/server/streamer';
2019-10-25 04:48:03 +08:00
import { addCursorStreamer } from '/imports/api/cursor/server/streamer';
Committer: Antonio Guirado <amguirado73@gmail.com> Changes to be committed: new file: akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/externalvideo/ExternalVideoApp2x.scala new file: akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/externalvideo/StartExternalVideoPubMsgHdlr.scala new file: akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/externalvideo/StopExternalVideoPubMsgHdlr.scala new file: akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/externalvideo/UpdateExternalVideoPubMsgHdlr.scala modified: akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala modified: akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala modified: akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/FromAkkaAppsMsgSenderActor.scala new file: bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/ExternalVideoMsgs.scala new file: bigbluebutton-html5/imports/api/external-videos/server/eventHandlers.js new file: bigbluebutton-html5/imports/api/external-videos/server/handlers/startExternalVideo.js new file: bigbluebutton-html5/imports/api/external-videos/server/handlers/stopExternalVideo.js new file: bigbluebutton-html5/imports/api/external-videos/server/handlers/updateExternalVideo.js modified: bigbluebutton-html5/imports/api/external-videos/server/index.js modified: bigbluebutton-html5/imports/api/external-videos/server/methods.js modified: bigbluebutton-html5/imports/api/external-videos/server/methods/emitExternalVideoEvent.js modified: bigbluebutton-html5/imports/api/external-videos/server/methods/startWatchingExternalVideo.js modified: bigbluebutton-html5/imports/api/external-videos/server/methods/stopWatchingExternalVideo.js new file: bigbluebutton-html5/imports/api/external-videos/server/streamer.js modified: bigbluebutton-html5/imports/api/meetings/server/handlers/meetingDestruction.js modified: bigbluebutton-html5/imports/api/meetings/server/modifiers/addMeeting.js modified: bigbluebutton-html5/imports/api/meetings/server/modifiers/meetingHasEnded.js modified: bigbluebutton-html5/imports/api/users/server/handlers/validateAuthToken.js modified: bigbluebutton-html5/imports/api/users/server/store/bannedUsers.js modified: bigbluebutton-html5/imports/startup/server/index.js modified: bigbluebutton-html5/imports/startup/server/redis.js modified: bigbluebutton-html5/imports/ui/components/external-video-player/service.js modified: bigbluebutton-html5/private/config/settings.yml
2020-08-28 18:58:55 +08:00
import { addExternalVideoStreamer } from '/imports/api/external-videos/server/streamer';
import { LAYOUT_TYPE } from '/imports/ui/components/layout/enums';
2016-10-22 00:27:47 +08:00
const addExternalVideo = (meetingId) => {
const selector = { meetingId };
const modifier = {
meetingId,
externalVideoUrl: null,
};
try {
const { numberAffected } = ExternalVideoMeetings.upsert(selector, modifier);
if (numberAffected) {
Logger.verbose(`Added external video meetingId=${meetingId}`);
}
} catch (err) {
Logger.error(`Adding external video: ${err}`);
}
};
2016-10-22 00:27:47 +08:00
export default function addMeeting(meeting) {
2017-10-12 06:17:42 +08:00
const meetingId = meeting.meetingProp.intId;
2016-10-22 00:27:47 +08:00
check(meetingId, String);
2017-10-12 06:17:42 +08:00
check(meeting, {
breakoutProps: {
sequence: Number,
freeJoin: Boolean,
2017-10-12 06:17:42 +08:00
breakoutRooms: Array,
parentId: String,
2019-04-10 21:44:34 +08:00
enabled: Boolean,
record: Boolean,
privateChatEnabled: Boolean,
2017-10-12 06:17:42 +08:00
},
meetingProp: {
intId: String,
extId: String,
isBreakout: Boolean,
learningDashboardEnabled: Boolean,
2017-10-12 06:17:42 +08:00
name: String,
},
usersProp: {
webcamsOnlyForModerator: Boolean,
guestPolicy: String,
authenticatedGuest: Boolean,
2017-10-12 06:17:42 +08:00
maxUsers: Number,
allowModsToUnmuteUsers: Boolean,
allowModsToEjectCameras: Boolean,
meetingLayout: String,
2017-10-12 06:17:42 +08:00
},
durationProps: {
createdTime: Number,
duration: Number,
createdDate: String,
meetingExpireIfNoUserJoinedInMinutes: Number,
meetingExpireWhenLastUserLeftInMinutes: Number,
userInactivityInspectTimerInMinutes: Number,
userInactivityThresholdInMinutes: Number,
userActivitySignResponseDelayInMinutes: Number,
2021-05-18 04:52:59 +08:00
endWhenNoModerator: Boolean,
endWhenNoModeratorDelayInMinutes: Number,
timeRemaining: Number,
2017-10-12 06:17:42 +08:00
},
welcomeProp: {
welcomeMsg: String,
modOnlyMessage: String,
welcomeMsgTemplate: String,
},
recordProp: Match.ObjectIncluding({
2017-10-12 06:17:42 +08:00
allowStartStopRecording: Boolean,
autoStartRecording: Boolean,
2019-02-20 06:29:23 +08:00
record: Boolean,
}),
2017-10-12 06:17:42 +08:00
password: {
viewerPass: String,
moderatorPass: String,
learningDashboardAccessToken: String,
2017-10-12 06:17:42 +08:00
},
voiceProp: {
voiceConf: String,
dialNumber: String,
telVoice: String,
muteOnStart: Boolean,
2017-10-12 06:17:42 +08:00
},
screenshareProps: {
red5ScreenshareIp: String,
red5ScreenshareApp: String,
screenshareConf: String,
},
metadataProp: Object,
2019-04-10 21:44:34 +08:00
lockSettingsProps: {
disableCam: Boolean,
disableMic: Boolean,
disablePrivateChat: Boolean,
disablePublicChat: Boolean,
disableNote: Boolean,
hideUserList: Boolean,
2019-04-10 21:44:34 +08:00
lockOnJoin: Boolean,
lockOnJoinConfigurable: Boolean,
lockedLayout: Boolean,
},
systemProps: {
html5InstanceId: Number,
},
2017-10-12 06:17:42 +08:00
});
2016-10-22 00:27:47 +08:00
const {
recordProp,
...restProps
} = meeting;
const newMeeting = restProps;
2019-02-20 06:29:23 +08:00
2016-10-22 00:27:47 +08:00
const selector = {
2016-10-24 19:20:30 +08:00
meetingId,
2016-10-22 00:27:47 +08:00
};
2019-04-10 21:44:34 +08:00
newMeeting.lockSettingsProps = Object.assign(meeting.lockSettingsProps, { setBy: 'temp' });
2019-04-06 02:33:09 +08:00
const meetingEnded = false;
2019-03-20 04:06:13 +08:00
let { welcomeMsg } = newMeeting.welcomeProp;
const sanitizeTextInChat = original => SanitizeHTML(original, {
allowedTags: ['a', 'b', 'br', 'i', 'img', 'li', 'small', 'span', 'strong', 'u', 'ul'],
allowedAttributes: {
a: ['href', 'name', 'target'],
img: ['src', 'width', 'height'],
},
allowedSchemes: ['https'],
});
const sanitizedWelcomeText = sanitizeTextInChat(welcomeMsg);
welcomeMsg = sanitizedWelcomeText.replace(
2019-02-23 06:08:44 +08:00
'href="event:',
'href="',
);
2019-02-26 01:01:28 +08:00
const insertBlankTarget = (s, i) => `${s.substr(0, i)} target="_blank"${s.substr(i)}`;
const linkWithoutTarget = new RegExp('<a href="(.*?)">', 'g');
linkWithoutTarget.test(welcomeMsg);
2019-02-26 01:01:28 +08:00
if (linkWithoutTarget.lastIndex > 0) {
welcomeMsg = insertBlankTarget(
welcomeMsg,
2019-02-26 01:01:28 +08:00
linkWithoutTarget.lastIndex - 1,
);
}
2019-02-20 06:29:23 +08:00
newMeeting.welcomeProp.welcomeMsg = welcomeMsg;
// note: as of July 2020 `modOnlyMessage` is not published to the client side.
// We are sanitizing this data simply to prevent future potential usage
// At the moment `modOnlyMessage` is obtained from client side as a response to Enter API
newMeeting.welcomeProp.modOnlyMessage = sanitizeTextInChat(newMeeting.welcomeProp.modOnlyMessage);
2016-10-22 00:27:47 +08:00
const modifier = {
2019-03-20 04:06:13 +08:00
$set: Object.assign({
meetingId,
2019-04-06 02:33:09 +08:00
meetingEnded,
layout: LAYOUT_TYPE[meeting.usersProp.meetingLayout] || 'smart',
publishedPoll: false,
guestLobbyMessage: '',
Fancy random viewer selection (#11297) * Revert "Delete bbb-icons-ori.woff" This reverts commit 84937a0d076f79076d8df201e3edb278374df0d0. * Revert "Add files via upload" This reverts commit 391434445ab286a160fde63533fa843175e9e8a0. * Revert "Delete bbb-icons.woff" This reverts commit 7c245c666d9adc7a8a1b1dc88b01bce749109b2f. * Revert "Add files via upload" This reverts commit 6f8c764c4bc35d646d9691cec8298d0ad3b98b11. * Revert "Delete tmp.woff" This reverts commit 5141e653599b4d83ddff6123ed59c1e4eb4d18e0. * Revert "Add files via upload" This reverts commit c8f7b17b0483910b6fa2750b2138cc3895e57145. * Revert "Create tmp.woff" This reverts commit 73c45065944d96f7779971b3535943c96feb2897. * Revert "Delete bbb-icons.woff" This reverts commit 9d01d58527bac04ebbf9be61140a13e7e14d7cc8. * Revert "Revert "Delete bbb-icons.woff"" This reverts commit d221d290cd5ad33b3c455b09f9da36d5788ee152. * Revert "Revert "Revert "Delete bbb-icons.woff""" This reverts commit c415ff02d1bd710e6f8804667c69d3c7d2e4caf1. * Revert "Revert "Delete bbb-icons.woff"" This reverts commit d221d290cd5ad33b3c455b09f9da36d5788ee152. * Revert "Revert "Create tmp.woff"" This reverts commit 267dc412d561c3d2eac49959e4b0ada77b8364bd. * Revert "Delete bbb-icons-ori.woff" This reverts commit 84937a0d076f79076d8df201e3edb278374df0d0. * Revert "Delete bbb-icons.woff" This reverts commit 7c245c666d9adc7a8a1b1dc88b01bce749109b2f. * Revert "Add files via upload" This reverts commit 6f8c764c4bc35d646d9691cec8298d0ad3b98b11. * Revert "Add files via upload" This reverts commit c8f7b17b0483910b6fa2750b2138cc3895e57145. * Revert "Create tmp.woff" This reverts commit 73c45065944d96f7779971b3535943c96feb2897. * Revert "Delete bbb-icons.woff" This reverts commit 9d01d58527bac04ebbf9be61140a13e7e14d7cc8. * Revert "Revert "Delete bbb-icons.woff"" This reverts commit 64a48f2bd6d76ca7fe31bc606682700ec1078592. * Revert "Revert "Revert "Delete bbb-icons.woff""" This reverts commit 9d1b4a068ae4de2ca3ad2e842884c910e16af0b9. * Revert "Revert "Revert "Revert "Delete bbb-icons.woff"""" This reverts commit b60491d933c2c984a5a64fa162026430d5f51485. * Revert "Revert "Revert "Revert "Revert "Delete bbb-icons.woff""""" This reverts commit 16e357091d558afe07bf17c7fedaa13ac8905f27. * Revert "Revert "Revert "Revert "Revert "Revert "Delete bbb-icons.woff"""""" This reverts commit e0b70f20554884f7c9e64104a3f942d3d09bfe24. * Revert "Revert "Revert "Revert "Revert "Revert "Revert "Delete bbb-icons.woff""""""" This reverts commit 7b1bde97edbed7985beb63646d39c3ddc82138e6. * Update UsersMgs.scala * Update selectRandomViewer.js * Update clearRandomlySelectedUser.js * Update addMeeting.js * Update updateRandomViewer.js * Update component.jsx * Update container.jsx * Update component.jsx * Update container.jsx * Update styles.scss * Update en.json * Update SelectRandomViewerReqMsgHdlr.scala * code simplification * in case only one person to be selected * Update en.json * Create en.json * Update en.json * Update component.jsx * Update styles.scss * Update en.json * Update updateRandomViewer.js Fix a typo * Update component.jsx When the presenter is moved to a viewer, in the modal of ex-presenter "somebody is selected" should be displayed. Before this modification, "somebody is the only viewer" was displayed. * add a comment explaining why a condition is needed. * Update en.json * Update en.json * revert (due to the rename UserMgs -> UserMsgs) * Update UsersMsgs.scala
2021-04-15 23:12:10 +08:00
randomlySelectedUser: [],
2019-03-20 04:06:13 +08:00
}, flat(newMeeting, {
safe: true,
2019-04-06 02:33:09 +08:00
})),
2016-10-22 00:27:47 +08:00
};
if (!process.env.BBB_HTML5_ROLE || process.env.BBB_HTML5_ROLE === 'frontend') {
addAnnotationsStreamer(meetingId);
addCursorStreamer(meetingId);
addExternalVideoStreamer(meetingId);
// we don't want to fully process the create meeting message in frontend since it can lead to duplication of meetings in mongo.
if (process.env.BBB_HTML5_ROLE === 'frontend') {
return;
}
}
try {
const { insertedId, numberAffected } = RecordMeetings.upsert(selector, { meetingId, ...recordProp });
if (insertedId) {
Logger.info(`Added record prop id=${meetingId}`);
} else if (numberAffected) {
Logger.info(`Upserted record prop id=${meetingId}`);
2016-10-22 00:27:47 +08:00
}
} catch (err) {
Logger.error(`Adding record prop to collection: ${err}`);
}
addExternalVideo(meetingId);
try {
const { insertedId, numberAffected } = Meetings.upsert(selector, modifier);
2016-10-22 00:27:47 +08:00
if (insertedId) {
Logger.info(`Added meeting id=${meetingId}`);
const { html5InstanceId } = meeting.systemProps;
initPads(meetingId, html5InstanceId);
} else if (numberAffected) {
Logger.info(`Upserted meeting id=${meetingId}`);
2016-10-22 00:27:47 +08:00
}
} catch (err) {
Logger.error(`Adding meeting to collection: ${err}`);
}
2017-06-03 03:25:02 +08:00
}