Merge pull request #2194 from NAmorim/develop

Contribution: Standalone applications
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-10-22 03:12:49 -04:00
commit e6f7afd9b9
6 files changed
+39 -20

No files matched your search

+4 -4
View File
@@ -28,10 +28,10 @@ exports.newEnvironment = function () {
PATH_TO_FONTS: path.join(basePath, './Platform/WebServer/Fonts')
}
if (process.env.PORTABLE_EXECUTABLE_DIR) {
thisObject.PATH_TO_DATA_STORAGE = path.join(process.env.PORTABLE_USER_DOCUMENTS, '/Superalgos/Platform/My-Data-Storage')
thisObject.PATH_TO_LOG_FILES = path.join(process.env.PORTABLE_USER_DOCUMENTS, '/Superalgos/Platform/My-Log-Files')
thisObject.PATH_TO_MY_WORKSPACES = path.join(process.env.PORTABLE_USER_DOCUMENTS, '/Superalgos/Platform/My-Workspaces')
if (process.env.DATA_PATH) {
thisObject.PATH_TO_DATA_STORAGE = path.join(process.env.DATA_PATH, '/Superalgos_Data/My-Data-Storage')
thisObject.PATH_TO_LOG_FILES = path.join(process.env.DATA_PATH, '/Superalgos_Data/My-Log-Files')
thisObject.PATH_TO_MY_WORKSPACES = path.join(process.env.DATA_PATH, '/Superalgos_Data/My-Workspaces')
}
return thisObject
+2 -2
View File
@@ -598,7 +598,7 @@ exports.newHttpInterface = function newHttpInterface() {
function createNewDir(path) {
try {
fs.mkdirSync(path)
fs.mkdirSync(path, {recursive: true})
} catch (err) {
if (err.message.indexOf('file already exists') < 0) {
throw (err)
@@ -1805,7 +1805,7 @@ exports.newHttpInterface = function newHttpInterface() {
/* Create Dir if it does not exist */
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
fs.mkdirSync(dir, {recursive: true});
}
fs.writeFile(filePath, fileContent, onFileWritten)
+4
View File
@@ -15,6 +15,7 @@ The SA object is accesible everywhere at the Superalgos Desktop App.
It provides access to all modules built for Superalgos in general.
*/
global.SA = {}
/* Load Environment Variables */
let ENVIRONMENT = require('./Environment.js');
let ENVIRONMENT_MODULE = ENVIRONMENT.newEnvironment()
@@ -84,4 +85,7 @@ async function run(initialWorkspace) {
PL.app = require('./Platform/PlatformApp.js').newPlatformApp()
await PL.app.run(initialWorkspace)
console.log('Superalgos Platform App is Running!')
if(process.send) {
process.send("Running")
}
}
+20 -4
View File
@@ -22,7 +22,11 @@
{
"target": "nsis",
"arch": "x64"
}
},
{
"target": "portable",
"arch": "x64"
}
],
"artifactName": "${productName}-${os}-${version}.${ext}",
"icon": "./build/superalgos.ico"
@@ -44,9 +48,21 @@
"artifactName": "${productName}_Setup_${os}_${version}.${ext}"
},
"mac": {
"artifactName": "${productName}-${os}-${version}.${ext}",
"artifactName": "${productName}-${os}-${arch}-${version}.${ext}",
"category": "public.app-category.finance",
"target": "default",
"icon": "build/icon.icns"
"icon": "./build/icon.icns",
"target": [
{
"target": "dmg",
"arch": "x64"
},
{
"target": "dmg",
"arch": "arm64"
}
]
},
"extraMetadata": {
"main": "electron-wrapper.js"
}
}
+8 -9
View File
@@ -8,6 +8,7 @@ const {autoUpdater} = require("electron-updater")
// Enable non contribution mode (test)
process.env.SA_MODE = 'gitDisable'
process.env.PACKAGED_PATH = app.getAppPath()
process.env.DATA_PATH = app.getPath('documents')
const WINDOW_WIDTH = null
const WINDOW_HEIGHT = null
@@ -22,21 +23,19 @@ const port = 34248 // Default HTTP port
run()
function run() {
if (process.env.PORTABLE_EXECUTABLE_DIR) {
process.env.PORTABLE_USER_DOCUMENTS = app.getPath("userData")
}
const { fork } = require('child_process')
fork(path.join(__dirname, '/PlatformRoot.js'), ["noBrowser"])
server_ready = true
if (app_ready) open()
const platform = fork(path.join(__dirname, '/PlatformRoot.js'), ["noBrowser"], {stdio: ['pipe', 'pipe', 'pipe', 'ipc'], env: process.env})
platform.on('message', message => {
if(message == "Running") {
open()
}
})
}
function open () {
let bw_options = {
width: WINDOW_WIDTH ? WINDOW_WIDTH : 1280,
height: WINDOW_HEIGHT ? WINDOW_HEIGHT : 720,
height: WINDOW_HEIGHT ? WINDOW_HEIGHT : 768,
resizable: true
}
+1 -1
View File
@@ -10,7 +10,7 @@
"scripts": {
"start": "node platform minMemo noBrowser",
"setup": "node setup noShortcuts",
"dist": "electron-builder",
"dist": "electron-builder -c build/electron-builder.json",
"postinstall": "electron-builder install-app-deps"
},
"dependencies": {