2021-05-22 11:44:10 +02:00
|
|
|
/* global process */
|
|
|
|
|
2021-06-27 20:57:25 +02:00
|
|
|
const { ipcRenderer } = require('electron');
|
2020-04-07 11:55:54 +02:00
|
|
|
const os = require('os');
|
2021-11-11 21:35:17 +01:00
|
|
|
const jitsiMeetElectronUtils = require('@jitsi/electron-sdk');
|
2020-06-30 11:16:21 +02:00
|
|
|
const { openExternalLink } = require('../features/utils/openExternalLink');
|
2020-04-07 11:55:54 +02:00
|
|
|
|
2020-06-04 09:54:18 +02:00
|
|
|
|
2020-06-10 14:21:13 +02:00
|
|
|
const whitelistedIpcChannels = [ 'protocol-data-msg', 'renderer-ready' ];
|
2020-06-04 09:54:18 +02:00
|
|
|
|
2020-04-07 11:55:54 +02:00
|
|
|
window.jitsiNodeAPI = {
|
|
|
|
osUserInfo: os.userInfo,
|
2020-06-04 09:54:18 +02:00
|
|
|
openExternalLink,
|
2021-05-22 11:44:10 +02:00
|
|
|
platform: process.platform,
|
2020-06-10 14:21:13 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
2020-04-07 11:55:54 +02:00
|
|
|
};
|