spt-launcher/src/preload/preload.ts

27 lines
1.3 KiB
TypeScript

import { contextBridge, ipcRenderer } from "electron";
console.info("[spt-launcher] preload loaded");
contextBridge.exposeInMainWorld("sptLauncher", {
appName: "SPT Launcher",
checkServerHealth: () => ipcRenderer.invoke("spt:checkServerHealth"),
checkGitTools: () => ipcRenderer.invoke("spt:checkGitTools"),
getGitPaths: () => ipcRenderer.invoke("spt:getGitPaths"),
installGitTools: () => ipcRenderer.invoke("spt:installGitTools"),
getModVersionStatus: () => ipcRenderer.invoke("spt:getModVersionStatus"),
setLocalModVersion: (payload: { tag: string }) =>
ipcRenderer.invoke("spt:setLocalModVersion", payload),
runModSync: (payload: { targetDir: string; tag: string; cleanRepo?: boolean }) =>
ipcRenderer.invoke("spt:runModSync", payload),
getSptInstallInfo: () => ipcRenderer.invoke("spt:getSptInstallInfo"),
setSptInstallPath: (payload: { path: string; allowMissing?: boolean }) =>
ipcRenderer.invoke("spt:setSptInstallPath", payload),
pickSptInstallPath: () => ipcRenderer.invoke("spt:pickSptInstallPath"),
fetchProfile: (payload: { username: string }) =>
ipcRenderer.invoke("spt:fetchProfile", payload),
downloadProfile: (payload: { username: string }) =>
ipcRenderer.invoke("spt:downloadProfile", payload),
resetProfile: (payload: { username: string }) =>
ipcRenderer.invoke("spt:resetProfile", payload)
});