bigbluebutton-Github/bigbluebutton-html5/imports/api/users-settings/server/methods/addUserSettings.js

137 lines
3.9 KiB
JavaScript
Raw Normal View History

import { check } from 'meteor/check';
import addUserSetting from '/imports/api/users-settings/server/modifiers/addUserSetting';
import logger from '/imports/startup/server/logger';
2020-04-29 12:41:16 +08:00
import { extractCredentials } from '/imports/api/common/server/helpers';
const oldParameters = {
2019-11-07 04:53:24 +08:00
askForFeedbackOnLogout: 'bbb_ask_for_feedback_on_logout',
autoJoin: 'bbb_auto_join_audio',
autoShareWebcam: 'bbb_auto_share_webcam',
clientTitle: 'bbb_client_title',
2019-11-07 04:53:24 +08:00
customStyle: 'bbb_custom_style',
customStyleUrl: 'bbb_custom_style_url',
displayBrandingArea: 'bbb_display_branding_area',
enableVideo: 'bbb_enable_video',
2019-11-07 04:53:24 +08:00
forceListenOnly: 'bbb_force_listen_only',
hidePresentationOnJoin: 'bbb_hide_presentation',
2019-11-07 04:53:24 +08:00
listenOnlyMode: 'bbb_listen_only_mode',
multiUserPenOnly: 'bbb_multi_user_pen_only',
multiUserTools: 'bbb_multi_user_tools',
2019-11-07 04:53:24 +08:00
presenterTools: 'bbb_presenter_tools',
shortcuts: 'bbb_shortcuts',
skipCheck: 'bbb_skip_check_audio',
};
const oldParametersKeys = Object.keys(oldParameters);
const currentParameters = [
2019-07-18 21:22:39 +08:00
// APP
2019-11-07 04:53:24 +08:00
'bbb_ask_for_feedback_on_logout',
'bbb_override_default_locale',
'bbb_auto_join_audio',
2019-11-07 04:53:24 +08:00
'bbb_client_title',
'bbb_force_listen_only',
2019-11-07 04:53:24 +08:00
'bbb_listen_only_mode',
'bbb_skip_check_audio',
'bbb_skip_check_audio_on_first_join',
'bbb_fullaudio_bridge',
feat(audio): add experimental transparent listen only mode This is an initial, experimental implementation of the feature proposed in https://github.com/bigbluebutton/bigbluebutton/issues/14021. The intention is to phase out the explicit listen only mode with two overarching goals: - Reduce UX friction and increase familiarity: the existence of a separate listen only mode is a source of confusion for the majority of users Reduce average server-side CPU usage while also making it possible for having full audio-only meetings. The proof-of-concept works based on the assumption that a "many concurrent active talkers" scenario is both rare and not useful. With that in mind, this including two server-side triggers: - On microphone inactivity (currently mute action that is sustained for 4 seconds, configurable): FreeSWITCH channels are held (which translates to much lower CPU usage, virtually 0%). Receiving channels are switched, server side, to a listening mode (SFU, mediasoup). * This required an extension to mediasoup two allow re-assigning producers to already established consumers. No re-negotiation is done. - On microphone activity (currently unmute action, immediate): FreeSWITCH channels are unheld, listening mode is deactivated and the mute state is updated accordingly (in this order). This is *off by default*. It needs to be enabled in two places: - `/etc/bigbluebutton/bbb-webrtc-sfu/production.yml` -> `transparentListenOnly: true` - End users: * Server wide: `/etc/bigbluebutton/bbb-html5.yml` -> `public.media.transparentListenOnly: true` * Per user: `userdata-bbb_transparent_listen_only=true`
2023-08-08 02:28:17 +08:00
'bbb_transparent_listen_only',
2019-07-18 21:22:39 +08:00
// BRANDING
'bbb_display_branding_area',
2019-07-18 21:22:39 +08:00
// SHORTCUTS
'bbb_shortcuts',
2019-07-18 21:22:39 +08:00
// KURENTO
2019-11-07 04:53:24 +08:00
'bbb_auto_share_webcam',
2019-11-08 04:55:04 +08:00
'bbb_preferred_camera_profile',
'bbb_enable_video',
'bbb_record_video',
'bbb_skip_video_preview',
'bbb_skip_video_preview_on_first_join',
'bbb_mirror_own_webcam',
// PRESENTATION
'bbb_force_restore_presentation_on_new_events',
2019-07-18 21:22:39 +08:00
// WHITEBOARD
'bbb_multi_user_pen_only',
'bbb_presenter_tools',
'bbb_multi_user_tools',
2019-07-18 21:22:39 +08:00
// SKINNING/THEMMING
'bbb_custom_style',
'bbb_custom_style_url',
2019-07-18 21:22:39 +08:00
// LAYOUT
'bbb_hide_presentation_on_join',
'bbb_show_participants_on_login',
'bbb_show_public_chat_on_login',
'bbb_hide_actions_bar',
'bbb_hide_nav_bar',
'bbb_change_layout',
2023-11-07 20:54:17 +08:00
'bbb_direct_leave_button',
feat: Initial implementation of Gladia transcriptions to BBB 2.7 (#19091) * Demo changes * Revert "feat(captions): no longer writes in the pad" This reverts commit a76de8c4585c08dadd4f423b3df9299d4b87ce24. * feat(transcriptoin): Add config options for the transcription backend * feat(transcription): Add autodetect option to cc chevron * feat(transcription): Move transcription options into settings modal * feat(transcription): Set transcription options via userdata * fix(transcription): Correct userdata for settings transcription params * feat(transcriptions): options to auto enable caption button * feat(transcriptions): Option to hide old CC pad funcionality * fix(transcription): Fix PR comments * fix(transcription): Refactor updateTranscript to prevent null user and make it more readable * feat(transcription): bbb_transcription_provider can be set via userdata * fix(transcription): Use base10 for parseInt * fix(transcriptions): Fix CC language divider when using webspeech * fix(transcriptions): Use a default pad in the settings instead of hardcoding 'en' We still need to use a language pad such as 'en', but in the future we can better separate these systems. * fix(transcription): Add a special permission for automatic transcription updates to the pad and restore old per user updates permission * feature(transcriptions): Include transcriptions submenu and locales * chore: bump bbb-transcription-controller to v0.2.0 * fix(transcription): Add missing menu files * fix(transcription): Fix transcription provider options in settings.yml * fix: setting password for bbb-transcription-controller * build: add gladia-proxy.log for transcription-controller * fix(transcriptions): Remove transcript splitting and floor logic from akka apps * fix(captions): Show long utterances as split captions, show multiple speaker captions * chore: bump bbb-transcription-controller to 0.2.1 --------- Co-authored-by: Anton Georgiev <anto.georgiev@gmail.com>
2023-11-30 23:10:36 +08:00
// TRANSCRIPTION
'bbb_transcription_partial_utterances',
'bbb_transcription_min_utterance_length',
'bbb_transcription_provider',
2019-07-18 21:22:39 +08:00
];
function valueParser(val) {
try {
const parsedValue = JSON.parse(val.toLowerCase().trim());
return parsedValue;
} catch (error) {
logger.warn(`addUserSettings:Parameter ${val} could not be parsed (was not json)`);
return val;
}
}
2020-04-29 12:41:16 +08:00
export default function addUserSettings(settings) {
try {
check(settings, [Object]);
2018-09-20 04:32:17 +08:00
const { meetingId, requesterUserId: userId } = extractCredentials(this.userId);
2020-04-29 12:41:16 +08:00
check(meetingId, String);
check(userId, String);
let parameters = {};
2018-09-20 04:32:17 +08:00
settings.forEach((el) => {
const settingKey = Object.keys(el).shift();
const normalizedKey = settingKey.trim();
2019-07-27 01:55:40 +08:00
if (currentParameters.includes(normalizedKey)) {
if (!Object.keys(parameters).includes(normalizedKey)) {
parameters = {
[normalizedKey]: valueParser(el[settingKey]),
...parameters,
};
} else {
parameters[normalizedKey] = el[settingKey];
}
return;
2019-07-18 21:22:39 +08:00
}
2018-09-20 04:32:17 +08:00
if (oldParametersKeys.includes(normalizedKey)) {
const matchingNewKey = oldParameters[normalizedKey];
if (!Object.keys(parameters).includes(matchingNewKey)) {
parameters = {
[matchingNewKey]: valueParser(el[settingKey]),
...parameters,
};
}
return;
2019-07-18 21:22:39 +08:00
}
logger.warn(`Parameter ${normalizedKey} not handled`);
});
2018-09-18 01:05:39 +08:00
const settingsAdded = [];
Object.entries(parameters).forEach((el) => {
const setting = el[0];
const value = el[1];
settingsAdded.push(addUserSetting(meetingId, userId, setting, value));
});
2018-09-18 01:05:39 +08:00
return settingsAdded;
} catch (err) {
logger.error(`Exception while invoking method addUserSettings ${err.stack}`);
}
}