Impl of sys calls
This commit is contained in:
parent
6b33a6cb3e
commit
affae5b975
14
main.js
14
main.js
@ -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 hwid = require("./modules/hwid")
|
||||||
const path = require("node:path")
|
const path = require("node:path")
|
||||||
const config = require("./config.json")
|
const config = require("./config.json")
|
||||||
@ -67,4 +68,15 @@ app.whenReady().then(() => {
|
|||||||
|
|
||||||
app.on("window-all-closed", () => {
|
app.on("window-all-closed", () => {
|
||||||
app.quit()
|
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
|
||||||
|
}
|
||||||
})
|
})
|
||||||
@ -1,5 +1,6 @@
|
|||||||
const { shell, contextBridge } = require("electron")
|
const { shell, contextBridge, ipcRenderer } = require("electron")
|
||||||
|
|
||||||
contextBridge.executeInMainWorld("system", {
|
contextBridge.executeInMainWorld("system", {
|
||||||
openInBrowser: (url) => shell.openExternal(url)
|
openInBrowser: (url) => shell.openExternal(url),
|
||||||
|
call: (method, args) => ipcRenderer.send("call", { method, args })
|
||||||
})
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user