jitsi-meet-electron/app/preload/preload.js
csett86 2baa4b5282
refactor: remove dependency to deprected remote module (#593)
the remote module will be removed from electron 14 onwards,
so replace the locale detection with native browser api that
is available in the renderer.

Signed-off-by: Christoph Settgast <csett86@web.de>
2021-06-27 20:57:25 +02:00

42 lines
1.2 KiB
JavaScript

/* global process */
const createElectronStorage = require('redux-persist-electron-storage');
const { ipcRenderer } = require('electron');
const os = require('os');
const jitsiMeetElectronUtils = require('jitsi-meet-electron-utils');
const { openExternalLink } = require('../features/utils/openExternalLink');
const whitelistedIpcChannels = [ 'protocol-data-msg', 'renderer-ready' ];
window.jitsiNodeAPI = {
createElectronStorage,
osUserInfo: os.userInfo,
openExternalLink,
platform: process.platform,
jitsiMeetElectronUtils,
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);
}
}
};