2021-09-13 19:34:03 +08:00
|
|
|
import React, { Component } from 'react';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2017-06-06 20:33:53 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2017-03-11 02:33:46 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
|
|
|
import AppContainer from '/imports/ui/components/app/container';
|
2017-03-11 04:47:23 +08:00
|
|
|
import ErrorScreen from '/imports/ui/components/error-screen/component';
|
2017-12-15 03:03:34 +08:00
|
|
|
import MeetingEnded from '/imports/ui/components/meeting-ended/component';
|
2022-02-15 22:55:08 +08:00
|
|
|
import LoadingScreen from '/imports/ui/components/common/loading-screen/component';
|
2017-04-06 20:36:59 +08:00
|
|
|
import Settings from '/imports/ui/services/settings';
|
2018-07-12 06:03:56 +08:00
|
|
|
import logger from '/imports/startup/client/logger';
|
2021-10-20 04:35:39 +08:00
|
|
|
import Users from '/imports/api/users';
|
2018-10-13 01:05:30 +08:00
|
|
|
import { Session } from 'meteor/session';
|
2021-04-27 07:04:34 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
2021-10-20 04:35:39 +08:00
|
|
|
import Meetings from '/imports/api/meetings';
|
2019-03-20 04:06:13 +08:00
|
|
|
import AppService from '/imports/ui/components/app/service';
|
2020-01-30 05:40:00 +08:00
|
|
|
import deviceInfo from '/imports/utils/deviceInfo';
|
|
|
|
import getFromUserSettings from '/imports/ui/services/users-settings';
|
2021-09-11 04:48:52 +08:00
|
|
|
import { layoutSelectInput, layoutDispatch } from '../../ui/components/layout/context';
|
2020-04-23 22:07:44 +08:00
|
|
|
import VideoService from '/imports/ui/components/video-provider/service';
|
2021-04-27 07:04:34 +08:00
|
|
|
import DebugWindow from '/imports/ui/components/debug-window/component';
|
2021-05-18 04:25:07 +08:00
|
|
|
import { ACTIONS, PANELS } from '../../ui/components/layout/enums';
|
2022-03-09 22:19:25 +08:00
|
|
|
import { isChatEnabled } from '/imports/ui/services/features';
|
2022-10-07 20:15:00 +08:00
|
|
|
import { makeCall } from '/imports/ui/services/api';
|
2023-02-18 02:15:39 +08:00
|
|
|
import BBBStorage from '/imports/ui/services/storage';
|
2020-01-30 05:40:00 +08:00
|
|
|
|
2020-03-06 07:14:22 +08:00
|
|
|
const CHAT_CONFIG = Meteor.settings.public.chat;
|
|
|
|
const PUBLIC_CHAT_ID = CHAT_CONFIG.public_id;
|
2023-02-18 02:15:39 +08:00
|
|
|
const USER_WAS_EJECTED = 'userWasEjected';
|
2019-01-22 03:28:37 +08:00
|
|
|
|
2019-04-11 23:04:10 +08:00
|
|
|
const HTML = document.getElementsByTagName('html')[0];
|
2018-08-06 20:05:07 +08:00
|
|
|
|
2021-03-18 02:01:08 +08:00
|
|
|
let checkedUserSettings = false;
|
2018-08-06 20:05:07 +08:00
|
|
|
|
2017-06-06 20:33:53 +08:00
|
|
|
const propTypes = {
|
2019-04-23 22:22:11 +08:00
|
|
|
subscriptionsReady: PropTypes.bool,
|
2018-08-11 01:51:12 +08:00
|
|
|
approved: PropTypes.bool,
|
2019-04-06 02:10:05 +08:00
|
|
|
meetingHasEnded: PropTypes.bool.isRequired,
|
2019-02-07 18:56:29 +08:00
|
|
|
meetingExist: PropTypes.bool,
|
2017-06-06 20:33:53 +08:00
|
|
|
};
|
2017-03-11 02:33:46 +08:00
|
|
|
|
2017-06-06 20:33:53 +08:00
|
|
|
const defaultProps = {
|
2019-06-05 03:23:44 +08:00
|
|
|
approved: false,
|
2019-02-07 18:56:29 +08:00
|
|
|
meetingExist: false,
|
2019-04-23 22:22:11 +08:00
|
|
|
subscriptionsReady: false,
|
2017-06-06 20:33:53 +08:00
|
|
|
};
|
2017-03-11 02:33:46 +08:00
|
|
|
|
2019-03-12 21:56:05 +08:00
|
|
|
const fullscreenChangedEvents = [
|
|
|
|
'fullscreenchange',
|
|
|
|
'webkitfullscreenchange',
|
|
|
|
'mozfullscreenchange',
|
|
|
|
'MSFullscreenChange',
|
|
|
|
];
|
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
class Base extends Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2017-03-11 02:33:46 +08:00
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
this.state = {
|
|
|
|
loading: false,
|
|
|
|
meetingExisted: false,
|
2022-04-14 04:53:10 +08:00
|
|
|
userRemoved: false,
|
2021-09-13 19:34:03 +08:00
|
|
|
};
|
|
|
|
this.updateLoadingState = this.updateLoadingState.bind(this);
|
2021-11-20 03:26:04 +08:00
|
|
|
this.handleFullscreenChange = this.handleFullscreenChange.bind(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
handleFullscreenChange() {
|
|
|
|
const { layoutContextDispatch } = this.props;
|
|
|
|
|
|
|
|
if (document.fullscreenElement
|
|
|
|
|| document.webkitFullscreenElement
|
|
|
|
|| document.mozFullScreenElement
|
|
|
|
|| document.msFullscreenElement) {
|
|
|
|
Session.set('isFullscreen', true);
|
|
|
|
} else {
|
|
|
|
layoutContextDispatch({
|
|
|
|
type: ACTIONS.SET_FULLSCREEN_ELEMENT,
|
|
|
|
value: {
|
|
|
|
element: '',
|
|
|
|
group: '',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
Session.set('isFullscreen', false);
|
|
|
|
}
|
2021-09-13 19:34:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
2021-09-16 20:25:51 +08:00
|
|
|
const { animations, usersVideo, layoutContextDispatch } = this.props;
|
|
|
|
|
|
|
|
layoutContextDispatch({
|
|
|
|
type: ACTIONS.SET_NUM_CAMERAS,
|
|
|
|
value: usersVideo.length,
|
|
|
|
});
|
2019-04-11 23:04:10 +08:00
|
|
|
|
|
|
|
if (animations) HTML.classList.add('animationsEnabled');
|
|
|
|
if (!animations) HTML.classList.add('animationsDisabled');
|
|
|
|
|
2019-03-12 00:21:12 +08:00
|
|
|
fullscreenChangedEvents.forEach((event) => {
|
2021-11-20 03:26:04 +08:00
|
|
|
document.addEventListener(event, this.handleFullscreenChange);
|
2019-03-12 00:21:12 +08:00
|
|
|
});
|
2019-03-13 01:05:32 +08:00
|
|
|
Session.set('isFullscreen', false);
|
2021-09-13 19:34:03 +08:00
|
|
|
}
|
2019-03-12 00:21:12 +08:00
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
componentDidUpdate(prevProps, prevState) {
|
|
|
|
const {
|
|
|
|
approved,
|
|
|
|
meetingExist,
|
|
|
|
animations,
|
|
|
|
ejected,
|
|
|
|
isMeteorConnected,
|
|
|
|
subscriptionsReady,
|
|
|
|
layoutContextDispatch,
|
|
|
|
sidebarContentPanel,
|
|
|
|
usersVideo,
|
2022-04-14 04:53:10 +08:00
|
|
|
User,
|
2021-09-13 19:34:03 +08:00
|
|
|
} = this.props;
|
|
|
|
const {
|
|
|
|
loading,
|
|
|
|
meetingExisted,
|
|
|
|
} = this.state;
|
2021-07-20 21:19:48 +08:00
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
if (usersVideo !== prevProps.usersVideo) {
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-05-18 04:25:07 +08:00
|
|
|
type: ACTIONS.SET_NUM_CAMERAS,
|
|
|
|
value: usersVideo.length,
|
|
|
|
});
|
2020-06-09 11:09:46 +08:00
|
|
|
}
|
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
if (!prevProps.subscriptionsReady && subscriptionsReady) {
|
2019-03-11 20:56:41 +08:00
|
|
|
logger.info({ logCode: 'startup_client_subscriptions_ready' }, 'Subscriptions are ready');
|
|
|
|
}
|
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
if (prevProps.meetingExist && !meetingExist && !meetingExisted) {
|
|
|
|
this.setMeetingExisted(true);
|
2019-01-18 02:31:04 +08:00
|
|
|
}
|
|
|
|
|
2019-03-20 04:06:13 +08:00
|
|
|
// In case the meteor restart avoid error log
|
2021-09-13 19:34:03 +08:00
|
|
|
if (isMeteorConnected && (prevState.meetingExisted !== meetingExisted) && meetingExisted) {
|
|
|
|
this.setMeetingExisted(false);
|
2019-01-22 03:28:37 +08:00
|
|
|
}
|
|
|
|
|
2023-02-18 02:31:19 +08:00
|
|
|
// In case the meeting delayed to load
|
2019-04-06 02:10:05 +08:00
|
|
|
if (!subscriptionsReady || !meetingExist) return;
|
2019-01-18 02:31:04 +08:00
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
if (approved && loading) this.updateLoadingState(false);
|
2019-01-03 01:31:57 +08:00
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
if (prevProps.ejected || ejected) {
|
2019-01-03 01:31:57 +08:00
|
|
|
Session.set('codeError', '403');
|
|
|
|
Session.set('isMeetingEnded', true);
|
|
|
|
}
|
2019-01-25 00:16:23 +08:00
|
|
|
|
2022-04-14 04:53:10 +08:00
|
|
|
if (prevProps.User && !User) {
|
|
|
|
this.setUserRemoved(true);
|
|
|
|
}
|
|
|
|
|
2019-02-07 18:56:29 +08:00
|
|
|
// In case the meteor restart avoid error log
|
2021-09-13 19:34:03 +08:00
|
|
|
if (isMeteorConnected && (prevState.meetingExisted !== meetingExisted)) {
|
|
|
|
this.setMeetingExisted(false);
|
2019-02-07 18:56:29 +08:00
|
|
|
}
|
|
|
|
|
2021-10-20 04:35:39 +08:00
|
|
|
if ((prevProps.isMeteorConnected !== isMeteorConnected) && !isMeteorConnected) {
|
|
|
|
Session.set('globalIgnoreDeletes', true);
|
|
|
|
}
|
|
|
|
|
2019-04-11 23:04:10 +08:00
|
|
|
const enabled = HTML.classList.contains('animationsEnabled');
|
|
|
|
const disabled = HTML.classList.contains('animationsDisabled');
|
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
if (animations && animations !== prevProps.animations) {
|
2019-04-11 23:04:10 +08:00
|
|
|
if (disabled) HTML.classList.remove('animationsDisabled');
|
|
|
|
HTML.classList.add('animationsEnabled');
|
2021-09-13 19:34:03 +08:00
|
|
|
} else if (!animations && animations !== prevProps.animations) {
|
2019-04-11 23:04:10 +08:00
|
|
|
if (enabled) HTML.classList.remove('animationsEnabled');
|
|
|
|
HTML.classList.add('animationsDisabled');
|
2019-01-25 00:16:23 +08:00
|
|
|
}
|
2021-07-20 21:19:48 +08:00
|
|
|
|
2022-12-01 02:32:47 +08:00
|
|
|
if (Session.equals('layoutReady', true) && (sidebarContentPanel === PANELS.NONE || Session.equals('subscriptionsReady', true))) {
|
2021-07-20 21:19:48 +08:00
|
|
|
if (!checkedUserSettings) {
|
|
|
|
if (getFromUserSettings('bbb_show_participants_on_login', Meteor.settings.public.layout.showParticipantsOnLogin) && !deviceInfo.isPhone) {
|
2022-03-09 22:19:25 +08:00
|
|
|
if (isChatEnabled() && getFromUserSettings('bbb_show_public_chat_on_login', !Meteor.settings.public.chat.startClosed)) {
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-20 21:19:48 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_NAVIGATION_IS_OPEN,
|
|
|
|
value: true,
|
|
|
|
});
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-20 21:19:48 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
|
|
|
value: true,
|
|
|
|
});
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-20 21:19:48 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_PANEL,
|
|
|
|
value: PANELS.CHAT,
|
|
|
|
});
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-20 21:19:48 +08:00
|
|
|
type: ACTIONS.SET_ID_CHAT_OPEN,
|
|
|
|
value: PUBLIC_CHAT_ID,
|
|
|
|
});
|
|
|
|
} else {
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-20 21:19:48 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_NAVIGATION_IS_OPEN,
|
|
|
|
value: true,
|
|
|
|
});
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-20 21:19:48 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
|
|
|
value: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} else {
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-20 21:19:48 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_NAVIGATION_IS_OPEN,
|
|
|
|
value: false,
|
|
|
|
});
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-20 21:19:48 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
|
|
|
value: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Session.equals('subscriptionsReady', true)) {
|
|
|
|
checkedUserSettings = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-09-13 19:34:03 +08:00
|
|
|
}
|
2019-01-22 03:28:37 +08:00
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
componentWillUnmount() {
|
|
|
|
fullscreenChangedEvents.forEach((event) => {
|
2021-11-20 03:26:04 +08:00
|
|
|
document.removeEventListener(event, this.handleFullscreenChange);
|
2021-09-13 19:34:03 +08:00
|
|
|
});
|
|
|
|
}
|
2017-03-11 02:33:46 +08:00
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
setMeetingExisted(meetingExisted) {
|
|
|
|
this.setState({ meetingExisted });
|
|
|
|
}
|
|
|
|
|
2022-04-14 04:53:10 +08:00
|
|
|
setUserRemoved(userRemoved) {
|
|
|
|
this.setState({ userRemoved });
|
|
|
|
}
|
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
updateLoadingState(loading = false) {
|
|
|
|
this.setState({
|
|
|
|
loading,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-10-07 20:15:00 +08:00
|
|
|
static async setExitReason(reason) {
|
2022-10-07 21:38:50 +08:00
|
|
|
return await makeCall('setExitReason', reason);
|
2022-10-07 20:15:00 +08:00
|
|
|
}
|
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
renderByState() {
|
2023-01-19 22:32:00 +08:00
|
|
|
const { loading, userRemoved } = this.state;
|
2021-09-13 19:34:03 +08:00
|
|
|
const {
|
|
|
|
codeError,
|
|
|
|
ejected,
|
2023-01-19 22:32:00 +08:00
|
|
|
ejectedReason,
|
2021-09-13 19:34:03 +08:00
|
|
|
meetingExist,
|
|
|
|
meetingHasEnded,
|
|
|
|
meetingEndedReason,
|
|
|
|
meetingIsBreakout,
|
|
|
|
subscriptionsReady,
|
2023-02-27 22:51:08 +08:00
|
|
|
userWasEjected,
|
2021-09-13 19:34:03 +08:00
|
|
|
} = this.props;
|
2019-01-22 03:28:37 +08:00
|
|
|
|
2019-04-27 00:01:58 +08:00
|
|
|
if ((loading || !subscriptionsReady) && !meetingHasEnded && meetingExist) {
|
2019-04-06 02:10:05 +08:00
|
|
|
return (<LoadingScreen>{loading}</LoadingScreen>);
|
|
|
|
}
|
2023-01-17 22:30:25 +08:00
|
|
|
|
2023-01-19 22:32:00 +08:00
|
|
|
if (( meetingHasEnded || ejected || userRemoved ) && meetingIsBreakout) {
|
2022-10-14 21:27:23 +08:00
|
|
|
Base.setExitReason('breakoutEnded').finally(() => {
|
2022-10-07 21:38:50 +08:00
|
|
|
Meteor.disconnect();
|
|
|
|
window.close();
|
|
|
|
});
|
2020-05-27 00:41:22 +08:00
|
|
|
return null;
|
|
|
|
}
|
2023-01-19 22:32:00 +08:00
|
|
|
|
2023-02-27 22:51:08 +08:00
|
|
|
if (ejected || userWasEjected) {
|
2023-01-19 22:32:00 +08:00
|
|
|
return (
|
|
|
|
<MeetingEnded
|
|
|
|
code="403"
|
|
|
|
ejectedReason={ejectedReason}
|
|
|
|
callback={() => Base.setExitReason('ejected')}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2019-03-20 04:06:13 +08:00
|
|
|
|
2023-02-27 22:51:08 +08:00
|
|
|
if ((meetingHasEnded && !meetingIsBreakout) || userWasEjected) {
|
2021-08-09 22:24:02 +08:00
|
|
|
return (
|
|
|
|
<MeetingEnded
|
|
|
|
code={codeError}
|
|
|
|
endedReason={meetingEndedReason}
|
2022-10-08 03:21:43 +08:00
|
|
|
callback={() => Base.setExitReason('meetingEnded')}
|
2021-08-09 22:24:02 +08:00
|
|
|
/>
|
|
|
|
);
|
2018-10-13 01:05:30 +08:00
|
|
|
}
|
|
|
|
|
2023-02-27 22:51:08 +08:00
|
|
|
if ((codeError && !meetingHasEnded) || userWasEjected) {
|
2022-10-07 21:38:50 +08:00
|
|
|
// 680 is set for the codeError when the user requests a logout.
|
2019-05-25 06:56:17 +08:00
|
|
|
if (codeError !== '680') {
|
2022-10-08 03:21:43 +08:00
|
|
|
return (<ErrorScreen code={codeError} callback={() => Base.setExitReason('error')} />);
|
2019-05-25 06:56:17 +08:00
|
|
|
}
|
2022-10-08 03:21:43 +08:00
|
|
|
return (<MeetingEnded code={codeError} callback={() => Base.setExitReason('logout')} />);
|
2019-04-27 00:01:58 +08:00
|
|
|
}
|
2020-08-03 20:44:21 +08:00
|
|
|
|
2023-04-04 21:47:32 +08:00
|
|
|
return (<AppContainer {...this.props} />);
|
2021-09-13 19:34:03 +08:00
|
|
|
}
|
2017-03-11 02:33:46 +08:00
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
meetingExist,
|
2022-11-18 02:59:13 +08:00
|
|
|
codeError,
|
2021-09-13 19:34:03 +08:00
|
|
|
} = this.props;
|
|
|
|
const { meetingExisted } = this.state;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{meetingExist && Auth.loggedIn && <DebugWindow />}
|
|
|
|
{
|
2022-11-18 02:59:13 +08:00
|
|
|
(!meetingExisted && !meetingExist && Auth.loggedIn && !codeError)
|
2021-09-13 19:34:03 +08:00
|
|
|
? <LoadingScreen />
|
|
|
|
: this.renderByState()
|
|
|
|
}
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2017-03-11 02:33:46 +08:00
|
|
|
|
2017-06-06 20:33:53 +08:00
|
|
|
Base.propTypes = propTypes;
|
|
|
|
Base.defaultProps = defaultProps;
|
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
const BaseContainer = (props) => {
|
|
|
|
const sidebarContent = layoutSelectInput((i) => i.sidebarContent);
|
|
|
|
const { sidebarContentPanel } = sidebarContent;
|
|
|
|
const layoutContextDispatch = layoutDispatch();
|
|
|
|
|
|
|
|
return <Base {...{ sidebarContentPanel, layoutContextDispatch, ...props }} />;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default withTracker(() => {
|
2019-11-14 06:36:23 +08:00
|
|
|
const {
|
|
|
|
animations,
|
|
|
|
} = Settings.application;
|
|
|
|
|
|
|
|
const {
|
|
|
|
credentials,
|
|
|
|
loggedIn,
|
|
|
|
} = Auth;
|
|
|
|
|
2019-04-25 04:48:16 +08:00
|
|
|
const { meetingId } = credentials;
|
2018-11-22 00:27:01 +08:00
|
|
|
let breakoutRoomSubscriptionHandler;
|
2019-03-08 00:33:34 +08:00
|
|
|
let meetingModeratorSubscriptionHandler;
|
2019-03-20 04:06:13 +08:00
|
|
|
|
2019-07-25 02:57:39 +08:00
|
|
|
const fields = {
|
2019-07-25 01:59:04 +08:00
|
|
|
approved: 1,
|
|
|
|
authed: 1,
|
|
|
|
ejected: 1,
|
2020-08-03 20:44:21 +08:00
|
|
|
ejectedReason: 1,
|
2019-07-25 01:59:04 +08:00
|
|
|
color: 1,
|
|
|
|
effectiveConnectionType: 1,
|
|
|
|
extId: 1,
|
|
|
|
guest: 1,
|
|
|
|
intId: 1,
|
|
|
|
locked: 1,
|
|
|
|
loggedOut: 1,
|
|
|
|
meetingId: 1,
|
|
|
|
userId: 1,
|
2020-08-03 20:44:21 +08:00
|
|
|
inactivityCheck: 1,
|
|
|
|
responseDelay: 1,
|
2022-05-14 03:18:51 +08:00
|
|
|
currentConnectionId: 1,
|
2022-05-18 00:09:41 +08:00
|
|
|
connectionIdUpdateTime: 1,
|
2019-07-25 01:59:04 +08:00
|
|
|
};
|
2019-07-25 02:57:39 +08:00
|
|
|
const User = Users.findOne({ intId: credentials.requesterUserId }, { fields });
|
|
|
|
const meeting = Meetings.findOne({ meetingId }, {
|
|
|
|
fields: {
|
|
|
|
meetingEnded: 1,
|
2021-07-08 22:51:00 +08:00
|
|
|
meetingEndedReason: 1,
|
2019-09-19 04:06:59 +08:00
|
|
|
meetingProp: 1,
|
2019-07-25 02:57:39 +08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
if (meeting && meeting.meetingEnded) {
|
|
|
|
Session.set('codeError', '410');
|
2019-03-20 04:06:13 +08:00
|
|
|
}
|
|
|
|
|
2020-08-06 01:16:41 +08:00
|
|
|
const approved = User?.approved && User?.guest;
|
|
|
|
const ejected = User?.ejected;
|
2020-08-03 20:44:21 +08:00
|
|
|
const ejectedReason = User?.ejectedReason;
|
2021-07-08 22:51:00 +08:00
|
|
|
const meetingEndedReason = meeting?.meetingEndedReason;
|
2022-05-14 03:18:51 +08:00
|
|
|
const currentConnectionId = User?.currentConnectionId;
|
2022-05-18 00:09:41 +08:00
|
|
|
const { connectionID, connectionAuthTime } = Auth;
|
|
|
|
const connectionIdUpdateTime = User?.connectionIdUpdateTime;
|
2023-02-18 02:15:39 +08:00
|
|
|
|
|
|
|
if (ejected) {
|
2023-07-11 21:00:24 +08:00
|
|
|
// use the connectionID to block users, so we can detect if the user was
|
|
|
|
// blocked by the current connection. This is the case when a a user is
|
|
|
|
// ejected from a meeting but not permanently ejected. Permanent ejects are
|
|
|
|
// managed by the server, not by the client.
|
|
|
|
BBBStorage.setItem(USER_WAS_EJECTED, connectionID);
|
2023-02-18 02:15:39 +08:00
|
|
|
}
|
2022-05-14 03:18:51 +08:00
|
|
|
|
2022-05-18 00:09:41 +08:00
|
|
|
if (currentConnectionId && currentConnectionId !== connectionID && connectionIdUpdateTime > connectionAuthTime) {
|
2022-10-07 20:18:07 +08:00
|
|
|
Session.set('codeError', '409');
|
2022-05-14 03:18:51 +08:00
|
|
|
Session.set('errorMessageDescription', 'joined_another_window_reason')
|
|
|
|
}
|
2020-08-03 20:44:21 +08:00
|
|
|
|
2019-02-08 03:40:27 +08:00
|
|
|
let userSubscriptionHandler;
|
2018-01-11 19:19:56 +08:00
|
|
|
|
2020-06-03 03:47:26 +08:00
|
|
|
const codeError = Session.get('codeError');
|
2021-03-02 22:56:10 +08:00
|
|
|
const { streams: usersVideo } = VideoService.getVideoStreams();
|
2020-04-23 22:07:44 +08:00
|
|
|
|
2017-03-11 02:33:46 +08:00
|
|
|
return {
|
2023-07-11 21:00:24 +08:00
|
|
|
userWasEjected: (BBBStorage.getItem(USER_WAS_EJECTED) == connectionID),
|
2019-04-24 20:20:38 +08:00
|
|
|
approved,
|
|
|
|
ejected,
|
2020-08-03 20:44:21 +08:00
|
|
|
ejectedReason,
|
2019-02-08 03:40:27 +08:00
|
|
|
userSubscriptionHandler,
|
2018-11-22 00:27:01 +08:00
|
|
|
breakoutRoomSubscriptionHandler,
|
2019-03-08 00:33:34 +08:00
|
|
|
meetingModeratorSubscriptionHandler,
|
2019-01-25 00:16:23 +08:00
|
|
|
animations,
|
2019-01-22 03:28:37 +08:00
|
|
|
User,
|
2019-06-27 00:29:34 +08:00
|
|
|
isMeteorConnected: Meteor.status().connected,
|
2019-04-11 02:20:31 +08:00
|
|
|
meetingExist: !!meeting,
|
2019-04-06 02:10:05 +08:00
|
|
|
meetingHasEnded: !!meeting && meeting.meetingEnded,
|
2021-07-08 22:51:00 +08:00
|
|
|
meetingEndedReason,
|
2019-04-06 02:10:05 +08:00
|
|
|
meetingIsBreakout: AppService.meetingIsBreakout(),
|
2019-04-25 04:48:16 +08:00
|
|
|
subscriptionsReady: Session.get('subscriptionsReady'),
|
2019-04-23 22:22:11 +08:00
|
|
|
loggedIn,
|
2020-06-03 03:47:26 +08:00
|
|
|
codeError,
|
2020-04-23 22:07:44 +08:00
|
|
|
usersVideo,
|
2017-03-11 02:33:46 +08:00
|
|
|
};
|
2021-09-13 19:34:03 +08:00
|
|
|
})(BaseContainer);
|