Impl of sys calls

This commit is contained in:
Gilles Lazures 2025-04-26 12:46:25 +02:00
parent 6b33a6cb3e
commit affae5b975
2 changed files with 16 additions and 3 deletions

14
main.js
View File

@ -1,4 +1,5 @@
const { BrowserWindow, app, net, dialog } = require("electron")
const { BrowserWindow, app, net, dialog, ipcMain } = require("electron")
const os = require("os")
const hwid = require("./modules/hwid")
const path = require("node:path")
const config = require("./config.json")
@ -68,3 +69,14 @@ app.whenReady().then(() => {
app.on("window-all-closed", () => {
app.quit()
})
ipcMain.on("call", (event, data) => {
switch (data.method) {
case "hardware::ramInformation":
launcherWindow.webContents.send("hardware::ramInformation", {
totalRam: Math.round(os.totalmem() / 1024 / 1024 * 100) / 100,
avaibleRam: Math.round(os.freemem() / 1024 / 1024 * 100) / 100,
})
break
}
})

View File

@ -1,5 +1,6 @@
const { shell, contextBridge } = require("electron")
const { shell, contextBridge, ipcRenderer } = require("electron")
contextBridge.executeInMainWorld("system", {
openInBrowser: (url) => shell.openExternal(url)
openInBrowser: (url) => shell.openExternal(url),
call: (method, args) => ipcRenderer.send("call", { method, args })
})