diff --git a/.gitignore b/.gitignore index 897cb9f..6047073 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules package-lock.json +yarn.lock dist \ No newline at end of file diff --git a/electron-builder.dev.yml b/electron-builder.dev.yml new file mode 100644 index 0000000..29c85db --- /dev/null +++ b/electron-builder.dev.yml @@ -0,0 +1 @@ +DR_URL=http://clinic.cubetiq.online?platform=desktop \ No newline at end of file diff --git a/electron-builder.prod.yml b/electron-builder.prod.yml new file mode 100644 index 0000000..e89ccd1 --- /dev/null +++ b/electron-builder.prod.yml @@ -0,0 +1 @@ +DR_URL=http://sandbox.clinic.cubetiq.online?platform=desktop \ No newline at end of file diff --git a/main.js b/main.js index 001d024..0669433 100644 --- a/main.js +++ b/main.js @@ -1,10 +1,11 @@ const electron = require("electron"); const { app, BrowserWindow } = electron; +const DR_URL = process.env.DR_URL || "http://sandbox.clinic.cubetiq.online?platform=desktop&offline=true&source=" + (process.env.USERNAME || "unknown"); +const DR_TITLE = "DR PROFESSIONAL CLINIC" + let mainApp; - app.allowRendererProcessReuse = true; - app.on("ready", () => { mainApp = new BrowserWindow({ @@ -16,8 +17,10 @@ app.on("ready", () => { mainApp.webContents.executeJavaScript(`localStorage.setItem("IS_ELECTRON", true)`) mainApp.setFullScreen(true) - mainApp.setTitle("DR PROFESSIONAL CLINIC"); - mainApp.loadURL(process.env.DR_URL); + mainApp.setTitle(DR_TITLE); + + console.log("Starting from:", DR_URL) + mainApp.loadURL(DR_URL); mainApp.on("closed", () => { mainApp = null; diff --git a/package.json b/package.json index 732a95e..725423e 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,20 @@ "version": "1.0.0", "description": "Clinic Application", "main": "main.js", + "build": { + "productName": "Clinic-Sandbox", + "appId": "com.cubetiqs.clinic", + "mac": { + "category": "com.cubetiqs.pro.clinic" + }, + "linux": { + "category": "com.cubetiqs.pro.clinic", + "target": ["AppImage", "deb"] + }, + "win": { + "target": "nsis" + } + }, "devDependencies": { "cross-env": "^7.0.0", "electron": "^8.0.0", @@ -10,10 +24,9 @@ }, "scripts": { "postinstall": "electron-builder install-app-deps", - "start": "yarn && electron ./main", + "start": "yarn && cross-env DR_URL=http://clinic.cubetiq.online?platform=desktop electron ./main", "pack": "electron-builder --dir", - "dist": "cross-env DR_URL=http://clinic.cubetiq.online?platform=desktop electron-builder --config ./config/electron-builder-dev.json", - "sandbox": "cross-env DR_URL=http://sandbox.clinic.cubetiq.online?platform=desktop electron-builder --config ./config/electron-builder-sandbox.json", + "dist": "electron-builder", "builder-help": "electron-builder --help", "test": "echo \"Error: no test specified\" && exit 1" },