2022-03-04 17:53:18 +00:00
|
|
|
import {contextBridge, ipcRenderer} from "electron";
|
|
|
|
import {getDisplayMediaSelector} from "./capturer";
|
|
|
|
import {injectTitlebar} from "./titlebar";
|
2021-12-26 21:41:09 +00:00
|
|
|
|
2021-12-24 21:56:49 +00:00
|
|
|
contextBridge.exposeInMainWorld("armcord", {
|
2022-03-04 17:53:18 +00:00
|
|
|
window: {
|
|
|
|
show: () => ipcRenderer.send("win-show"),
|
|
|
|
hide: () => ipcRenderer.send("win-hide"),
|
|
|
|
minimize: () => ipcRenderer.send("win-minimize"),
|
|
|
|
maximize: () => ipcRenderer.send("win-maximize")
|
|
|
|
},
|
|
|
|
titlebar: {
|
|
|
|
injectTitlebar: () => injectTitlebar(),
|
|
|
|
isTitlebar: ipcRenderer.sendSync("titlebar")
|
|
|
|
},
|
|
|
|
electron: process.versions.electron,
|
|
|
|
channel: ipcRenderer.sendSync("channel"),
|
2022-08-25 12:57:28 +00:00
|
|
|
setPingCount: (pingCount: number) => ipcRenderer.send("setPing", pingCount),
|
|
|
|
setTrayIcon: (favicon: string) => ipcRenderer.send("sendTrayIcon", favicon),
|
2022-06-12 18:59:59 +00:00
|
|
|
getLang: (toGet: string) =>
|
|
|
|
ipcRenderer.invoke("getLang", toGet).then((result) => {
|
|
|
|
return result;
|
|
|
|
}),
|
2022-03-04 17:53:18 +00:00
|
|
|
version: ipcRenderer.sendSync("get-app-version", "app-version"),
|
2022-08-22 09:24:55 +00:00
|
|
|
packageVersion: ipcRenderer.sendSync("get-package-version", "app-version"),
|
2022-03-04 17:53:18 +00:00
|
|
|
getDisplayMediaSelector: getDisplayMediaSelector,
|
2022-08-24 15:25:12 +00:00
|
|
|
splashEnd: () => ipcRenderer.send("splashEnd"),
|
2022-03-04 17:53:18 +00:00
|
|
|
openSettingsWindow: () => ipcRenderer.send("openSettingsWindow")
|
2021-12-26 21:41:09 +00:00
|
|
|
});
|
2022-01-30 19:48:32 +00:00
|
|
|
//to be only used inside armcord internal setup/splash etc
|
2022-03-04 17:53:18 +00:00
|
|
|
if (window.location.href.indexOf("splash.html") > -1 || window.location.href.indexOf("setup.html") > -1) {
|
|
|
|
contextBridge.exposeInMainWorld("armcordinternal", {
|
|
|
|
restart: () => ipcRenderer.send("restart"),
|
2022-08-24 15:25:12 +00:00
|
|
|
saveSettings: (...args: any) => ipcRenderer.send("saveSettings", ...args)
|
2022-03-04 17:53:18 +00:00
|
|
|
});
|
|
|
|
}
|