2020-02-13 19:30:58 +07:00
|
|
|
const electron = require("electron");
|
|
|
|
const { app, BrowserWindow } = electron;
|
2021-08-09 09:58:19 +07:00
|
|
|
const os = require("os");
|
2021-08-09 11:04:43 +07:00
|
|
|
const APP_URL = require("./lib");
|
2020-02-13 19:30:58 +07:00
|
|
|
|
2021-08-09 11:04:43 +07:00
|
|
|
const URL = APP_URL || "https://clinic.cubetiqs.com";
|
2021-08-09 09:58:19 +07:00
|
|
|
const MAIN_URL = `${URL}?platform=desktop&offline=true&os=${os.platform()}&hostname=${os.hostname()}&arch=${os.arch()}&source=${process.env.USERNAME || "unknown"}`
|
2021-08-09 11:04:43 +07:00
|
|
|
const APP_TITLE = "Clinic System";
|
2020-02-13 19:30:58 +07:00
|
|
|
|
|
|
|
let mainApp;
|
|
|
|
app.allowRendererProcessReuse = true;
|
|
|
|
app.on("ready", () => {
|
|
|
|
mainApp = new BrowserWindow({
|
2020-09-26 13:09:02 +07:00
|
|
|
width: 1024,
|
|
|
|
height: 768,
|
2021-08-09 11:04:43 +07:00
|
|
|
title: APP_TITLE,
|
2020-02-13 19:30:58 +07:00
|
|
|
});
|
|
|
|
|
2020-09-26 13:09:02 +07:00
|
|
|
mainApp.webContents.executeJavaScript(
|
|
|
|
`localStorage.setItem("author", "Sambo Chea <sombochea@cubetiqs.com>")`
|
|
|
|
);
|
2021-08-09 09:58:19 +07:00
|
|
|
|
2020-09-26 13:09:02 +07:00
|
|
|
mainApp.webContents.executeJavaScript(
|
|
|
|
`localStorage.setItem("IS_ELECTRON", true)`
|
|
|
|
);
|
|
|
|
|
|
|
|
mainApp.setFullScreen(true);
|
2021-08-09 09:58:19 +07:00
|
|
|
mainApp.setTitle(APP_TITLE);
|
2020-02-13 19:30:58 +07:00
|
|
|
|
2021-08-09 09:58:19 +07:00
|
|
|
console.log("Starting from:", MAIN_URL);
|
|
|
|
mainApp.loadURL(MAIN_URL);
|
2020-02-13 19:30:58 +07:00
|
|
|
|
|
|
|
mainApp.on("closed", () => {
|
|
|
|
mainApp = null;
|
|
|
|
});
|
|
|
|
});
|