mirror of
https://github.com/A-Star100/simpliplay-desktop.git
synced 2025-09-18 06:39:44 +00:00
12 lines
438 B
JavaScript
12 lines
438 B
JavaScript
const { contextBridge, ipcRenderer } = require("electron");
|
|
|
|
contextBridge.exposeInMainWorld("electron", {
|
|
receive: (channel, callback) => {
|
|
const validChannels = ["play-media"]; // ✅ Only allow specific, safe channels
|
|
if (validChannels.includes(channel)) {
|
|
ipcRenderer.removeAllListeners(channel); // ✅ Prevent duplicate listeners
|
|
ipcRenderer.on(channel, (_event, ...args) => callback(...args));
|
|
}
|
|
},
|
|
});
|