bigbluebutton-Github/bigbluebutton-html5/imports/ui/services/features/index.js

148 lines
5.7 KiB
JavaScript
Raw Normal View History

2022-02-07 21:22:52 +08:00
import Auth from '/imports/ui/services/auth';
import Meetings from '/imports/api/meetings';
import useMeeting from '../../core/hooks/useMeeting';
2022-02-07 21:22:52 +08:00
export function getDisabledFeatures() {
const selector = {
meetingId: Auth.meetingID,
};
const meetingData = Meetings.findOne(selector, { fields: { disabledFeatures: 1 } });
const disabledFeatures = (meetingData || {}).disabledFeatures || [];
2022-02-07 21:22:52 +08:00
return disabledFeatures;
}
export function useDisabledFeatures() {
const { data: meetingData } = useMeeting((m) => ({
disabledFeatures: m.disabledFeatures,
}));
const disabledFeatures = meetingData?.disabledFeatures || [];
return disabledFeatures;
}
2022-02-07 21:22:52 +08:00
export function isScreenSharingEnabled() {
return getDisabledFeatures().indexOf('screenshare') === -1 && window.meetingClientSettings.public.kurento.enableScreensharing;
2022-02-07 21:22:52 +08:00
}
export function useIsScreenSharingEnabled() {
return useDisabledFeatures().indexOf('screenshare') === -1 && window.meetingClientSettings.public.kurento.enableScreensharing;
}
export function isLearningDashboardEnabled() {
return getDisabledFeatures().indexOf('learningDashboard') === -1;
}
2022-03-09 02:05:24 +08:00
export function isPollingEnabled() {
return getDisabledFeatures().indexOf('polls') === -1 && window.meetingClientSettings.public.poll.enabled;
2022-03-09 02:05:24 +08:00
}
export function useIsPollingEnabled() {
return useDisabledFeatures().indexOf('polls') === -1 && window.meetingClientSettings.public.poll.enabled;
}
export function isExternalVideoEnabled() {
return getDisabledFeatures().indexOf('externalVideos') === -1 && window.meetingClientSettings.public.externalVideoPlayer.enabled;
}
2022-03-09 22:19:25 +08:00
export function isChatEnabled() {
return getDisabledFeatures().indexOf('chat') === -1 && window.meetingClientSettings.public.chat.enabled;
2022-03-09 22:19:25 +08:00
}
2022-03-15 21:40:02 +08:00
export function isSharedNotesEnabled() {
return getDisabledFeatures().indexOf('sharedNotes') === -1 && window.meetingClientSettings.public.notes.enabled;
}
2022-03-11 02:02:20 +08:00
export function isCaptionsEnabled() {
return getDisabledFeatures().indexOf('captions') === -1 && window.meetingClientSettings.public.captions.enabled;
2022-03-11 02:02:20 +08:00
}
export function isLiveTranscriptionEnabled() {
return getDisabledFeatures().indexOf('liveTranscription') === -1 && window.meetingClientSettings.public.app.audioCaptions.enabled;
}
export function isBreakoutRoomsEnabled() {
return getDisabledFeatures().indexOf('breakoutRooms') === -1;
}
2022-03-15 21:40:02 +08:00
export function isLayoutsEnabled() {
return getDisabledFeatures().indexOf('layouts') === -1;
}
export function isVirtualBackgroundsEnabled() {
return getDisabledFeatures().indexOf('virtualBackgrounds') === -1 && window.meetingClientSettings.public.virtualBackgrounds.enabled;
}
export function isCustomVirtualBackgroundsEnabled() {
return getDisabledFeatures().indexOf('customVirtualBackgrounds') === -1;
}
export function isDownloadPresentationWithAnnotationsEnabled() {
return getDisabledFeatures().indexOf('downloadPresentationWithAnnotations') === -1 && window.meetingClientSettings.public.presentation.allowDownloadWithAnnotations;
}
export function useIsDownloadPresentationWithAnnotationsEnabled() {
return getDisabledFeatures().indexOf('downloadPresentationWithAnnotations') === -1 && window.meetingClientSettings.public.presentation.allowDownloadWithAnnotations;
}
export function isDownloadPresentationConvertedToPdfEnabled() {
return getDisabledFeatures().indexOf('downloadPresentationConvertedToPdf') === -1;
}
export function useIsDownloadPresentationConvertedToPdfEnabled() {
return getDisabledFeatures().indexOf('downloadPresentationConvertedToPdf') === -1;
}
export function isDownloadPresentationOriginalFileEnabled() {
return getDisabledFeatures().indexOf('downloadPresentationOriginalFile') === -1 && window.meetingClientSettings.public.presentation.allowDownloadOriginal;
}
export function useIsDownloadPresentationOriginalFileEnabled() {
return useDisabledFeatures().indexOf('downloadPresentationOriginalFile') === -1 && window.meetingClientSettings.public.presentation.allowDownloadOriginal;
}
2023-06-07 20:35:56 +08:00
export function isSnapshotOfCurrentSlideEnabled() {
return getDisabledFeatures().indexOf('snapshotOfCurrentSlide') === -1 && window.meetingClientSettings.public.presentation.allowSnapshotOfCurrentSlide;
}
export function isImportPresentationWithAnnotationsFromBreakoutRoomsEnabled() {
return getDisabledFeatures().indexOf('importPresentationWithAnnotationsFromBreakoutRooms') === -1;
}
export function isImportSharedNotesFromBreakoutRoomsEnabled() {
return getDisabledFeatures().indexOf('importSharedNotesFromBreakoutRooms') === -1;
}
export function isPresentationEnabled() {
return getDisabledFeatures().indexOf('presentation') === -1;
}
export function useIsPresentationEnabled() {
return useDisabledFeatures().indexOf('presentation') === -1;
}
export function isReactionsEnabled() {
const USER_REACTIONS_ENABLED = window.meetingClientSettings.public.userReaction.enabled;
const REACTIONS_BUTTON_ENABLED = window.meetingClientSettings.public.app.reactionsButton.enabled;
return getDisabledFeatures().indexOf('reactions') === -1 && USER_REACTIONS_ENABLED && REACTIONS_BUTTON_ENABLED;
}
export function useIsReactionsEnabled() {
const USER_REACTIONS_ENABLED = window.meetingClientSettings.public.userReaction.enabled;
const REACTIONS_BUTTON_ENABLED = window.meetingClientSettings.public.app.reactionsButton.enabled;
return useDisabledFeatures().indexOf('reactions') === -1 && USER_REACTIONS_ENABLED && REACTIONS_BUTTON_ENABLED;
}
export function isTimerFeatureEnabled() {
return getDisabledFeatures().indexOf('timer') === -1 && window.meetingClientSettings.public.timer.enabled;
2023-06-15 03:47:57 +08:00
}
export function isCameraAsContentEnabled() {
return (
getDisabledFeatures().indexOf('cameraAsContent') === -1
&& window.meetingClientSettings.public.app.enableCameraAsContent
2023-06-15 03:47:57 +08:00
);
}