add and remove

This commit is contained in:
Sambo Chea 2020-02-13 19:30:26 +07:00
parent 0228160053
commit 5cb5ff7087
5 changed files with 26 additions and 7 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules node_modules
package-lock.json package-lock.json
yarn.lock
dist dist

1
electron-builder.dev.yml Normal file
View File

@ -0,0 +1 @@
DR_URL=http://clinic.cubetiq.online?platform=desktop

View File

@ -0,0 +1 @@
DR_URL=http://sandbox.clinic.cubetiq.online?platform=desktop

11
main.js
View File

@ -1,10 +1,11 @@
const electron = require("electron"); const electron = require("electron");
const { app, BrowserWindow } = 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; let mainApp;
app.allowRendererProcessReuse = true; app.allowRendererProcessReuse = true;
app.on("ready", () => { app.on("ready", () => {
mainApp = new BrowserWindow({ mainApp = new BrowserWindow({
@ -16,8 +17,10 @@ app.on("ready", () => {
mainApp.webContents.executeJavaScript(`localStorage.setItem("IS_ELECTRON", true)`) mainApp.webContents.executeJavaScript(`localStorage.setItem("IS_ELECTRON", true)`)
mainApp.setFullScreen(true) mainApp.setFullScreen(true)
mainApp.setTitle("DR PROFESSIONAL CLINIC"); mainApp.setTitle(DR_TITLE);
mainApp.loadURL(process.env.DR_URL);
console.log("Starting from:", DR_URL)
mainApp.loadURL(DR_URL);
mainApp.on("closed", () => { mainApp.on("closed", () => {
mainApp = null; mainApp = null;

View File

@ -3,6 +3,20 @@
"version": "1.0.0", "version": "1.0.0",
"description": "Clinic Application", "description": "Clinic Application",
"main": "main.js", "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": { "devDependencies": {
"cross-env": "^7.0.0", "cross-env": "^7.0.0",
"electron": "^8.0.0", "electron": "^8.0.0",
@ -10,10 +24,9 @@
}, },
"scripts": { "scripts": {
"postinstall": "electron-builder install-app-deps", "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", "pack": "electron-builder --dir",
"dist": "cross-env DR_URL=http://clinic.cubetiq.online?platform=desktop electron-builder --config ./config/electron-builder-dev.json", "dist": "electron-builder",
"sandbox": "cross-env DR_URL=http://sandbox.clinic.cubetiq.online?platform=desktop electron-builder --config ./config/electron-builder-sandbox.json",
"builder-help": "electron-builder --help", "builder-help": "electron-builder --help",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },