2018-01-04 03:54:06 +08:00
|
|
|
import { check } from 'meteor/check';
|
2018-06-19 02:59:35 +08:00
|
|
|
import sharedWebcam from '../modifiers/sharedWebcam';
|
2018-01-04 03:54:06 +08:00
|
|
|
|
2018-06-19 02:59:35 +08:00
|
|
|
export default function handleUserSharedHtml5Webcam({ header, body }, meetingId) {
|
2018-01-04 03:54:06 +08:00
|
|
|
const { userId, stream } = body;
|
2018-06-19 02:59:35 +08:00
|
|
|
const isValidStream = (testString) => {
|
2018-01-04 03:54:06 +08:00
|
|
|
// Checking if the stream name is a flash one
|
2018-01-20 16:34:11 +08:00
|
|
|
const regexp = /^([A-z0-9]+)-([A-z0-9]+)-([A-z0-9]+)(-recorded)?$/;
|
2018-06-19 02:59:35 +08:00
|
|
|
return !regexp.test(testString);
|
2018-06-19 02:35:27 +08:00
|
|
|
};
|
2017-09-01 23:26:57 +08:00
|
|
|
|
2017-12-09 00:52:37 +08:00
|
|
|
check(header, Object);
|
2017-09-01 23:26:57 +08:00
|
|
|
check(meetingId, String);
|
2017-12-09 00:52:37 +08:00
|
|
|
check(userId, String);
|
2018-06-19 02:35:27 +08:00
|
|
|
check(stream, String);
|
|
|
|
|
|
|
|
if (!isValidStream(stream)) return false;
|
2017-09-01 23:26:57 +08:00
|
|
|
|
|
|
|
return sharedWebcam(meetingId, userId);
|
|
|
|
}
|