skip share/unshare webcam using if not check
This commit is contained in:
parent
ba56751546
commit
9e9e85cddb
11
bigbluebutton-html5/imports/api/video/server/handlers/userSharedHtml5Webcam.js
Normal file → Executable file
11
bigbluebutton-html5/imports/api/video/server/handlers/userSharedHtml5Webcam.js
Normal file → Executable file
@ -3,17 +3,18 @@ import { check } from 'meteor/check';
|
||||
|
||||
export default function handleUserSharedHtml5Webcam({ header, body }, meetingId ) {
|
||||
const { userId, stream } = body;
|
||||
const isValidStream = Match.Where((stream) => {
|
||||
check(stream, String);
|
||||
const isValidStream = (match) => {
|
||||
// Checking if the stream name is a flash one
|
||||
const regexp = /^([A-z0-9]+)-([A-z0-9]+)-([A-z0-9]+)(-recorded)?$/;
|
||||
return !regexp.test(stream);
|
||||
});
|
||||
return !regexp.test(match);
|
||||
};
|
||||
|
||||
check(header, Object);
|
||||
check(meetingId, String);
|
||||
check(userId, String);
|
||||
check(stream, isValidStream);
|
||||
check(stream, String);
|
||||
|
||||
if (!isValidStream(stream)) return false;
|
||||
|
||||
return sharedWebcam(meetingId, userId);
|
||||
}
|
||||
|
11
bigbluebutton-html5/imports/api/video/server/handlers/userUnsharedHtml5Webcam.js
Normal file → Executable file
11
bigbluebutton-html5/imports/api/video/server/handlers/userUnsharedHtml5Webcam.js
Normal file → Executable file
@ -3,17 +3,18 @@ import { check } from 'meteor/check';
|
||||
|
||||
export default function handleUserUnsharedHtml5Webcam({ header, body }, meetingId) {
|
||||
const { userId, stream } = body;
|
||||
const isValidStream = Match.Where((stream) => {
|
||||
check(stream, String);
|
||||
const isValidStream = (match) => {
|
||||
// Checking if the stream name is a flash one
|
||||
const regexp = /^([A-z0-9]+)-([A-z0-9]+)-([A-z0-9]+)(-recorded)?$/;
|
||||
return !regexp.test(stream);
|
||||
});
|
||||
return !regexp.test(match);
|
||||
};
|
||||
|
||||
check(header, Object);
|
||||
check(meetingId, String);
|
||||
check(userId, String);
|
||||
check(stream, isValidStream);
|
||||
check(stream, String);
|
||||
|
||||
if (!isValidStream(stream)) return false;
|
||||
|
||||
return unsharedWebcam(meetingId, userId);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user