mirror of
https://github.com/jely2002/youtube-dl-gui.git
synced 2021-11-01 22:46:21 +03:00
50 lines
1.4 KiB
JavaScript
50 lines
1.4 KiB
JavaScript
const { contextBridge, ipcRenderer } = require('electron')
|
|
|
|
contextBridge.exposeInMainWorld(
|
|
"main",
|
|
{
|
|
invoke: async (channel, data) => {
|
|
let validChannels = [
|
|
"platform",
|
|
"messageBox",
|
|
"errorReport",
|
|
"titlebarClick",
|
|
"openInputMenu",
|
|
"openCopyMenu",
|
|
"settingsAction",
|
|
"videoAction",
|
|
"cookieFile",
|
|
"downloadFolder",
|
|
"installUpdate",
|
|
"iconProgress",
|
|
"theme",
|
|
"restoreTaskList",
|
|
"getDoneActions",
|
|
"setDoneAction",
|
|
"getSubtitles",
|
|
"getSelectedSubtitles"
|
|
];
|
|
if (validChannels.includes(channel)) {
|
|
return await ipcRenderer.invoke(channel, data);
|
|
}
|
|
},
|
|
receive: (channel, cb) => {
|
|
let validChannels = [
|
|
"log",
|
|
"error",
|
|
"toast",
|
|
"maximized",
|
|
"videoAction",
|
|
"updateGlobalButtons",
|
|
"totalSize",
|
|
"binaryLock"
|
|
];
|
|
if (validChannels.includes(channel)) {
|
|
ipcRenderer.on(channel, (event, arg) => {
|
|
cb(arg)
|
|
});
|
|
}
|
|
}
|
|
}
|
|
);
|