bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/app/service.js

65 lines
1.4 KiB
JavaScript
Raw Normal View History

Refactor: Make bundle using webpack (#20811) * Refactor: Make bundle using webpack * Fix: restore after install codes and a few settings * Fix: build script folder permission * Refactor: Remove support to async import on audio bridges * Upgrade npm using nvm * Avoid questions on npm ci execution * Let npm ci install dev dependencies (as we need the build tools here) * Fix: enconding * Fix: old lock files * Remove: bbb-config dependency to bbb-html5 service, bbb-html5 isn't a service anymore * Fix: TS errors * Fix: eslint * Fix: chat styles * npm install with "lockfileVersion": 3 (newer npm) * build: allow nodejs 22 * node 22; drop meteor from CI and bbb-conf * TEMP: use bbb-install without mongo but with node 22 and newer image * build: relax nodejs condition to not trip 22.6 * build: ensure dir /usr/share/bigbluebutton/nginx exists * init sites-available/bbb; drop disable-transparent- * nginx complaining of missing file and ; * TMP: print status of services * WIP: tweak nginx location to debug * Fix: webcam widgets alignments * akka-apps -- update location of settings.yml * build: add locales path for nginx * docs and config changes for removal of meteor * Fix: build encoding and locales enpoint folder path * build: set wss url for media * Add: Enable minimizer and modify to Terser * Fix: TS errors --------- Co-authored-by: Tiago Jacobs <tiago.jacobs@gmail.com> Co-authored-by: Anton Georgiev <anto.georgiev@gmail.com> Co-authored-by: Anton Georgiev <antobinary@users.noreply.github.com>
2024-08-10 01:58:44 +08:00
import * as DarkReader from 'darkreader';
2024-07-03 01:58:58 +08:00
import Styled from './styles';
import logger from '/imports/startup/client/logger';
import useMeeting from '../../core/hooks/useMeeting';
import Storage from '/imports/ui/services/storage/session';
const CUSTOM_LOGO_URL_KEY = 'CustomLogoUrl';
const CUSTOM_DARK_LOGO_URL_KEY = 'CustomDarkLogoUrl';
const equalURLs = () => (
Storage.getItem(CUSTOM_LOGO_URL_KEY) === Storage.getItem(CUSTOM_DARK_LOGO_URL_KEY)
);
export function useMeetingIsBreakout() {
const { data: meeting } = useMeeting((m) => ({
isBreakout: m.isBreakout,
}));
return meeting && meeting.isBreakout;
}
2023-07-25 02:56:40 +08:00
export const setDarkTheme = (value) => {
let invert = [Styled.DtfInvert];
if(equalURLs()) {
invert = [Styled.DtfBrandingInvert];
}
if (value && !DarkReader.isEnabled()) {
2023-07-25 02:56:40 +08:00
DarkReader.enable(
{ brightness: 100, contrast: 90 },
{
invert,
2023-07-25 02:56:40 +08:00
ignoreInlineStyle: [Styled.DtfCss],
ignoreImageAnalysis: [Styled.DtfImages],
2024-07-03 01:58:58 +08:00
},
2023-07-25 02:56:40 +08:00
);
logger.info(
{
logCode: 'dark_mode',
2023-07-25 02:56:40 +08:00
},
2024-07-03 01:58:58 +08:00
'Dark mode is on.',
2023-07-25 02:56:40 +08:00
);
}
2023-07-25 02:56:40 +08:00
if (!value && DarkReader.isEnabled()) {
DarkReader.disable();
2023-07-25 02:56:40 +08:00
logger.info(
{
logCode: 'dark_mode',
},
2024-07-03 01:58:58 +08:00
'Dark mode is off.',
2023-07-25 02:56:40 +08:00
);
}
2023-07-25 02:56:40 +08:00
};
2024-07-03 01:58:58 +08:00
export const isDarkThemeEnabled = () => DarkReader.isEnabled();
2023-07-25 02:56:40 +08:00
export default {
setDarkTheme,
isDarkThemeEnabled,
useMeetingIsBreakout,
2016-05-12 23:41:51 +08:00
};