mirror of
https://github.com/netzbegruenung/jitsi-meet-electron.git
synced 2024-04-27 22:44:50 +02:00
72 lines
1.8 KiB
JavaScript
72 lines
1.8 KiB
JavaScript
const { ipcRenderer } = require('electron');
|
|
const { RemoteControl,
|
|
setupScreenSharingRender,
|
|
setupAlwaysOnTopRender,
|
|
initPopupsConfigurationRender,
|
|
setupWiFiStats,
|
|
setupPowerMonitorRender
|
|
} = require('@jitsi/electron-sdk');
|
|
const { platform } = require('process');
|
|
const { openExternalLink } = require('../features/utils/openExternalLink');
|
|
|
|
const whitelistedIpcChannels = [ 'protocol-data-msg', 'renderer-ready' ];
|
|
|
|
/**
|
|
* Setup the renderer process.
|
|
*
|
|
* @param {*} api - API object.
|
|
* @param {*} options - Options for what to enable.
|
|
* @returns {void}
|
|
*/
|
|
function setupRenderer(api, options = {}) {
|
|
initPopupsConfigurationRender(api);
|
|
|
|
const iframe = api.getIFrame();
|
|
|
|
setupScreenSharingRender(api);
|
|
|
|
if (options.enableRemoteControl) {
|
|
new RemoteControl(iframe); // eslint-disable-line no-new
|
|
}
|
|
|
|
// Allow window to be on top if enabled in settings
|
|
if (options.enableAlwaysOnTopWindow) {
|
|
setupAlwaysOnTopRender(api, null, { showOnPrejoin: true });
|
|
}
|
|
|
|
// Disable WiFiStats on mac due to jitsi-meet-electron#585
|
|
if (platform !== 'darwin') {
|
|
setupWiFiStats(iframe);
|
|
}
|
|
|
|
setupPowerMonitorRender(api);
|
|
}
|
|
|
|
window.jitsiNodeAPI = {
|
|
openExternalLink,
|
|
setupRenderer,
|
|
ipc: {
|
|
on: (channel, listener) => {
|
|
if (!whitelistedIpcChannels.includes(channel)) {
|
|
return;
|
|
}
|
|
|
|
return ipcRenderer.on(channel, listener);
|
|
},
|
|
send: channel => {
|
|
if (!whitelistedIpcChannels.includes(channel)) {
|
|
return;
|
|
}
|
|
|
|
return ipcRenderer.send(channel);
|
|
},
|
|
removeListener: (channel, listener) => {
|
|
if (!whitelistedIpcChannels.includes(channel)) {
|
|
return;
|
|
}
|
|
|
|
return ipcRenderer.removeListener(channel, listener);
|
|
}
|
|
}
|
|
};
|