From 57dc55b559def635b8bdddb792cac2036b146eb0 Mon Sep 17 00:00:00 2001 From: Anton Georgiev <anto.georgiev@gmail.com> Date: Tue, 23 Oct 2018 20:44:17 +0000 Subject: [PATCH] drop metadata configs; use userdata configs for autoSwap --- .../server/methods/addUserSettings.js | 4 ++- .../imports/startup/client/auth.js | 28 +------------------ .../imports/ui/components/media/container.jsx | 14 ++++++---- .../imports/ui/components/media/service.js | 12 ++++---- .../private/config/settings.yml | 4 +++ 5 files changed, 23 insertions(+), 39 deletions(-) diff --git a/bigbluebutton-html5/imports/api/users-settings/server/methods/addUserSettings.js b/bigbluebutton-html5/imports/api/users-settings/server/methods/addUserSettings.js index 1d49ce718b..debe0a6d59 100644 --- a/bigbluebutton-html5/imports/api/users-settings/server/methods/addUserSettings.js +++ b/bigbluebutton-html5/imports/api/users-settings/server/methods/addUserSettings.js @@ -1,4 +1,3 @@ -import { Meteor } from 'meteor/meteor'; import { check } from 'meteor/check'; import addUserSetting from '/imports/api/users-settings/server/modifiers/addUserSetting'; @@ -30,6 +29,9 @@ export default function addUserSettings(credentials, meetingId, userId, settings 'multiUserPenOnly', 'presenterTools', 'multiUserTools', + 'autoSwapLayout', + 'autoShareWebcam', + 'hidePresentation', ]; if (!handledHTML5Parameters.includes(key)) { return acc; diff --git a/bigbluebutton-html5/imports/startup/client/auth.js b/bigbluebutton-html5/imports/startup/client/auth.js index 723816d386..ea5de6e496 100755 --- a/bigbluebutton-html5/imports/startup/client/auth.js +++ b/bigbluebutton-html5/imports/startup/client/auth.js @@ -1,5 +1,4 @@ import Auth from '/imports/ui/services/auth'; -import SessionStorage from '/imports/ui/services/storage/session'; import { setCustomLogoUrl } from '/imports/ui/components/user-list/service'; import { log, makeCall } from '/imports/ui/services/api'; import deviceInfo from '/imports/utils/deviceInfo'; @@ -7,7 +6,6 @@ import logger from '/imports/startup/client/logger'; // disconnected and trying to open a new connection const STATUS_CONNECTING = 'connecting'; -const METADATA_KEY = 'metadata'; export function joinRouteHandler(nextState, replace, callback) { const { sessionToken } = nextState.location.query; @@ -27,7 +25,7 @@ export function joinRouteHandler(nextState, replace, callback) { .then(response => response.json()) .then(({ response }) => { const { - returncode, meetingID, internalUserID, authToken, logoutUrl, customLogoURL, metadata, + returncode, meetingID, internalUserID, authToken, logoutUrl, customLogoURL, externUserID, fullname, confname, customdata, } = response; @@ -38,34 +36,10 @@ export function joinRouteHandler(nextState, replace, callback) { setCustomLogoUrl(customLogoURL); - const metakeys = metadata.length - ? metadata.reduce((acc, meta) => { - const key = Object.keys(meta).shift(); - - const handledHTML5Parameters = [ - 'html5autoswaplayout', 'html5autosharewebcam', 'html5hidepresentation', - ]; - if (handledHTML5Parameters.indexOf(key) === -1) { - return acc; - } - - /* this reducer transforms array of objects in a single object and - forces the metadata a be boolean value */ - let value = meta[key]; - try { - value = JSON.parse(meta[key]); - } catch (e) { - log('error', `Caught: ${e.message}`); - } - return { ...acc, [key]: value }; - }, {}) : {}; - if (customdata.length) { makeCall('addUserSettings', meetingID, internalUserID, customdata); } - SessionStorage.setItem(METADATA_KEY, metakeys); - Auth.set( meetingID, internalUserID, authToken, logoutUrl, sessionToken, fullname, externUserID, confname, diff --git a/bigbluebutton-html5/imports/ui/components/media/container.jsx b/bigbluebutton-html5/imports/ui/components/media/container.jsx index efb3eb2812..ec7a174ab6 100755 --- a/bigbluebutton-html5/imports/ui/components/media/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/media/container.jsx @@ -1,6 +1,5 @@ import React, { Component } from 'react'; import { withTracker } from 'meteor/react-meteor-data'; -import SessionStorage from '/imports/ui/services/storage/session'; import Settings from '/imports/ui/services/settings'; import { defineMessages, injectIntl } from 'react-intl'; import { notify } from '/imports/ui/services/notification'; @@ -12,6 +11,9 @@ import PresentationPodsContainer from '../presentation-pod/container'; import ScreenshareContainer from '../screenshare/container'; import DefaultContent from '../presentation/default-content/component'; +const LAYOUT_CONFIG = Meteor.settings.public.layout; +const KURENTO_CONFIG = Meteor.settings.public.kurento; + const intlMessages = defineMessages({ screenshareStarted: { id: 'app.media.screenshare.start', @@ -66,8 +68,8 @@ class MediaContainer extends Component { installChromeExtension() { const { intl } = this.props; - const CHROME_DEFAULT_EXTENSION_LINK = Meteor.settings.public.kurento.chromeDefaultExtensionLink; - const CHROME_CUSTOM_EXTENSION_LINK = Meteor.settings.public.kurento.chromeExtensionLink; + const CHROME_DEFAULT_EXTENSION_LINK = KURENTO_CONFIG.chromeDefaultExtensionLink; + const CHROME_CUSTOM_EXTENSION_LINK = KURENTO_CONFIG.chromeExtensionLink; const CHROME_EXTENSION_LINK = CHROME_CUSTOM_EXTENSION_LINK === 'LINK' ? CHROME_DEFAULT_EXTENSION_LINK : CHROME_CUSTOM_EXTENSION_LINK; notify(<div> @@ -92,7 +94,7 @@ export default withTracker(() => { const { dataSaving } = Settings; const { viewParticipantsWebcams, viewScreenshare } = dataSaving; - const hidePresentation = SessionStorage.getItem('metadata').html5hidepresentation || false; + const hidePresentation = getFromUserSettings('hidePresentation', LAYOUT_CONFIG.hidePresentation) || false; const data = { children: <DefaultContent />, }; @@ -121,8 +123,8 @@ export default withTracker(() => { data.hideOverlay = hidePresentation; } - const enableVideo = getFromUserSettings('enableVideo', Meteor.settings.public.kurento.enableVideo); - const autoShareWebcam = SessionStorage.getItem('metadata').html5autosharewebcam || false; + const enableVideo = getFromUserSettings('enableVideo', KURENTO_CONFIG.enableVideo); + const autoShareWebcam = getFromUserSettings('autoShareWebcam', KURENTO_CONFIG.autoShareWebcam) || false; if (enableVideo && autoShareWebcam) { data.willMount = VideoService.joinVideo; diff --git a/bigbluebutton-html5/imports/ui/components/media/service.js b/bigbluebutton-html5/imports/ui/components/media/service.js index 5b2866c8cb..d3bac4dfa2 100755 --- a/bigbluebutton-html5/imports/ui/components/media/service.js +++ b/bigbluebutton-html5/imports/ui/components/media/service.js @@ -1,4 +1,3 @@ -import SessionStorage from '/imports/ui/services/storage/session'; import Presentations from '/imports/api/presentations'; import { isVideoBroadcasting } from '/imports/ui/components/screenshare/service'; import Auth from '/imports/ui/services/auth'; @@ -8,6 +7,9 @@ import VideoService from '/imports/ui/components/video-provider/service'; import PollingService from '/imports/ui/components/polling/service'; import getFromUserSettings from '/imports/ui/services/users-settings'; +const LAYOUT_CONFIG = Meteor.settings.public.layout; +const KURENTO_CONFIG = Meteor.settings.public.kurento; + const getPresentationInfo = () => { const currentPresentation = Presentations.findOne({ current: true, @@ -25,11 +27,11 @@ function shouldShowWhiteboard() { } function shouldShowScreenshare() { - return isVideoBroadcasting() && getFromUserSettings('enableScreensharing', Meteor.settings.public.kurento.enableScreensharing); + return isVideoBroadcasting() && getFromUserSettings('enableScreensharing', KURENTO_CONFIG.enableScreensharing); } function shouldShowOverlay() { - return getFromUserSettings('enableVideo', Meteor.settings.public.kurento.enableVideo); + return getFromUserSettings('enableVideo', KURENTO_CONFIG.enableVideo); } const swapLayout = { @@ -54,8 +56,8 @@ export const shouldEnableSwapLayout = () => { export const getSwapLayout = () => { swapLayout.tracker.depend(); - const metaAutoSwapLayout = SessionStorage.getItem('metadata').html5autoswaplayout || false; - return metaAutoSwapLayout || (swapLayout.value && shouldEnableSwapLayout()); + const autoSwapLayout = getFromUserSettings('autoSwapLayout', LAYOUT_CONFIG.autoSwapLayout); + return autoSwapLayout || (swapLayout.value && shouldEnableSwapLayout()); }; export default { diff --git a/bigbluebutton-html5/private/config/settings.yml b/bigbluebutton-html5/private/config/settings.yml index 48206359d7..85b9e71740 100644 --- a/bigbluebutton-html5/private/config/settings.yml +++ b/bigbluebutton-html5/private/config/settings.yml @@ -98,6 +98,7 @@ public: enableVideo: false enableVideoStats: false enableListenOnly: false + autoShareWebcam: false acl: viewer: subscriptions: @@ -170,6 +171,9 @@ public: path_route: users/chat/ system_messages_keys: chat_clear: PUBLIC_CHAT_CLEAR + layout: + autoSwapLayout: false + hidePresentation: false media: WebRTCHangupRetryInterval: 2000 vertoServerAddress: HOST -- GitLab