Consume generic EveElectron host

This commit is contained in:
Meta Vens 2026-07-10 07:41:03 +01:00
commit 8975d7ebbb
7 changed files with 86 additions and 64 deletions

View file

@ -1591,9 +1591,17 @@ function renderIpcChannelLines() {
function renderPreload() {
const channelLines = renderIpcChannelLines();
const eveProviderMethods = new Set([
"eveSurface",
"eveProviderAdvertisement",
"eveDocument",
"submitEveCommand",
"windowControl",
]);
const apiLines = ipcChannels
.filter(([name]) => name !== "viewportFeedUpdate" &&
name !== "viewportFeedStop")
name !== "viewportFeedStop" &&
!eveProviderMethods.has(name))
.map(([name]) => {
if (name === "viewportFeed") {
return ` watchViewportFeed: (request, callback) => {
@ -1628,6 +1636,7 @@ function renderPreload() {
// Generated by scripts/generate-rts-bindings.mjs from the RTS IPC surface contract.
const { contextBridge, ipcRenderer } = require("electron");
const { installEveProviderBridge } = require("@gamecult/eve-electron/preload");
const channels = {
${channelLines}
@ -1636,5 +1645,17 @@ ${channelLines}
contextBridge.exposeInMainWorld("aetheriaRts", {
${apiLines}
});
installEveProviderBridge({
contextBridge,
ipcRenderer,
channels: {
providerAdvertisement: channels.eveProviderAdvertisement,
surface: channels.eveSurface,
document: channels.eveDocument,
submitCommand: channels.submitEveCommand,
windowControl: channels.windowControl,
},
});
`;
}