diff --git a/Client/WebServer/css/docs.css b/Client/WebServer/css/docs.css index 3c378553e..7dda8e3f2 100644 --- a/Client/WebServer/css/docs.css +++ b/Client/WebServer/css/docs.css @@ -62,11 +62,6 @@ margin-bottom: 0px; margin-top: 0px; border: 0px solid #cdcdcd; padding: 5px; - -/* DELETE candidate -margin: auto; -margin-right: 20px; -*/ } .docs-table-cell{ @@ -126,7 +121,7 @@ cursor: pointer; .docs-tooltip { position: relative; display: inline-block; -border-bottom: 1px dashed #0295aa; +border-bottom: 1px dashed #999; cursor: pointer; line-height: inherit; } @@ -569,9 +564,9 @@ margin: 0 0 0 15px; code.docs-code { color: #d9534f; -background-color: rgba(230, 234, 234, 1); +background-color: rgba(230, 234, 234, .5); /* border: 1px solid rgba(205, 212, 213, 0.5); DELETE Candidate*/ -border: 1px solid rgba(54, 85, 88, .3); +border: 1px solid rgba(54, 85, 88, .1); border-radius: 3px; padding: 0 5; } @@ -817,7 +812,6 @@ padding-left: 180px; margin-top: 20px; } - .docs-search-results-header-tabs-container > input { display: none; } @@ -858,7 +852,8 @@ display: none; #tab4:checked ~ .docs-search-result-content #content4, #tab5:checked ~ .docs-search-result-content #content5, #tab6:checked ~ .docs-search-result-content #content6, -#tab7:checked ~ .docs-search-result-content #content7 { +#tab7:checked ~ .docs-search-result-content #content7, +#tab8:checked ~ .docs-search-result-content #content8 { display: block; } @@ -887,6 +882,36 @@ text-decoration: underline; cursor: pointer; } +.docs-search-result-content-record-topic { +font-size: 90%; +color: #31708f; +} + +.docs-search-result-content-record-tutorial { +font-size: 90%; +color: #31708f; +} + +.docs-search-result-content-record-review { +font-size: 90%; +color: #31708f; +} + +.docs-search-result-content-record-topic { +font-size: 90%; +color: #31708f; +} + +.docs-search-result-content-record-tutorial { +font-size: 90%; +color: #31708f; +} + +.docs-search-result-content-record-review { +font-size: 90%; +color: #31708f; +} + .docs-search-result-content-record-title { font-size: 120%; font-weight: 500; diff --git a/Client/WebServer/index.html b/Client/WebServer/index.html index d98447b00..ee58a9f06 100644 --- a/Client/WebServer/index.html +++ b/Client/WebServer/index.html @@ -56,16 +56,16 @@ onresize="onResize()">
The UI is loading...
-Superalgos is free and open-source, and is +
Superalgos is and will always be free and open-source, and is constantly improving thanks to the involvement of contributors:
Luis Fernando Molina, Julian Molina, Andreja Cobeljic, Matías Benitez, Ira Miller, Eduardo Remis, Jeff Braun, rico4dev, 9808us, Barry Low, Nikola Bjelogrlic, Hirajin Koizuko, Francisco J. Santillán, Norman, Viktoria B., Guillermo V., Daniel J., Javier A., Gustavo J., Romina GS, Pedro P., Thais M., Andrey M., Loui M., Natalia M., Bashar A., Carlos V., - Diego M., + Diego M., CarnivalBen, Sebastian E., Bogdan P., Marko V., Igor S., Niksa K., Rodrigo M., Nicanor M., Alejandro P., Mateo H., Lan T., Leon A., Uroš R., Filip M., Vladimir J. and Pavle B.
-With Superalgos Beta 8, contributing is easier than ever! Become a contributor!
+Thanks for giving a star to the project's repo at GitHub.com. This help other devs to find it.
' + UI.projects.superalgos.utilities.gitBranches.getBranchLabel(UI.projects.superalgos.spaces.docsSpace.currentBranch) + ' branch. Switch to:'
HTML = HTML + ''
HTML = HTML + '' + result.documentIndex.docsSchemaDocument.topic + ' - Page ' + result.documentIndex.docsSchemaDocument.pageNumber + '
' + mainLink = result.documentIndex.docsSchemaDocument.type break } case 'Tutorial': { - mainLink = result.documentIndex.docsSchemaDocument.tutorial + ' - Page ' + result.documentIndex.docsSchemaDocument.pageNumber + ' - ' + result.documentIndex.docsSchemaDocument.type + HTML = HTML + '' + result.documentIndex.docsSchemaDocument.tutorial + ' - Page ' + result.documentIndex.docsSchemaDocument.pageNumber + '
' + mainLink = result.documentIndex.docsSchemaDocument.type break } case 'Review': { - mainLink = result.documentIndex.docsSchemaDocument.review + ' - Page ' + result.documentIndex.docsSchemaDocument.pageNumber + ' - ' + result.documentIndex.docsSchemaDocument.type + HTML = HTML + '' + result.documentIndex.docsSchemaDocument.review + ' - Page ' + result.documentIndex.docsSchemaDocument.pageNumber + '
' + mainLink = result.documentIndex.docsSchemaDocument.type break } default: { diff --git a/Projects/Superalgos/UI/Spaces/Floating-Space/FloatingLayer.js b/Projects/Superalgos/UI/Spaces/Floating-Space/FloatingLayer.js index fe4400c63..6b722352f 100644 --- a/Projects/Superalgos/UI/Spaces/Floating-Space/FloatingLayer.js +++ b/Projects/Superalgos/UI/Spaces/Floating-Space/FloatingLayer.js @@ -210,6 +210,12 @@ function newFloatingLayer() { let newInvisibleArray = [] for (let i = 0; i < invisibleFloatingObjects.length; i++) { let floatingObject = invisibleFloatingObjects[i] + + if (floatingObject.payload === undefined) { + /* The floating object was replaced by another one. */ + invisibleFloatingObjects.splice(i, 1) + return + } collapsePhysics(floatingObject) @@ -227,6 +233,12 @@ function newFloatingLayer() { for (let i = 0; i < visibleFloatingObjects.length; i++) { let floatingObject = visibleFloatingObjects[i] + if (floatingObject.payload === undefined) { + /* The floating object was replaced by another one. */ + visibleFloatingObjects.splice(i, 1) + return + } + collapsePhysics(floatingObject) if (floatingObject.isParentCollapsed === true) { diff --git a/Projects/Superalgos/UI/Spaces/Floating-Space/UiObject.js b/Projects/Superalgos/UI/Spaces/Floating-Space/UiObject.js index e297e2ebe..baa359708 100644 --- a/Projects/Superalgos/UI/Spaces/Floating-Space/UiObject.js +++ b/Projects/Superalgos/UI/Spaces/Floating-Space/UiObject.js @@ -1679,7 +1679,7 @@ function newUiObject() { if (radius > 6) { const MAX_LABEL_LENGTH = 30 - label = thisObject.payload.subTitle + label = thisObject.payload.node.type label = addIndexNumber(label) if (label !== undefined) { diff --git a/Projects/Superalgos/UI/Spaces/Floating-Space/UiObjectConstructor.js b/Projects/Superalgos/UI/Spaces/Floating-Space/UiObjectConstructor.js index fc1f9cb29..53d8b71e0 100644 --- a/Projects/Superalgos/UI/Spaces/Floating-Space/UiObjectConstructor.js +++ b/Projects/Superalgos/UI/Spaces/Floating-Space/UiObjectConstructor.js @@ -25,10 +25,22 @@ function newUiObjectConstructor() { } function createUiObject(userAddingNew, payload) { + + /* + In case we are replacing an existing uiObject and floatingObject + */ + if (payload.floatingObject !== undefined) { + payload.floatingObject.finalize() + } + if (payload.uiObject !== undefined) { + payload.uiObject.finalize() + } + let floatingObject = newFloatingObject() floatingObject.fitFunction = UI.projects.superalgos.spaces.floatingSpace.fitIntoVisibleArea floatingObject.container.connectToParent(UI.projects.superalgos.spaces.floatingSpace.container, false, false, false, false, false, false, false, false) floatingObject.initialize('UI Object', payload) + payload.floatingObject = floatingObject /* @@ -218,8 +230,8 @@ function newUiObjectConstructor() { currentStatus: false, label: undefined, visible: true, - iconPathOn: 'pinned', - iconPathOff: 'unpinned', + iconPathOn: 'pinned-node', + iconPathOff: 'unpinned-node', rawRadius: 12, targetRadius: 0, currentRadius: 0, @@ -234,7 +246,7 @@ function newUiObjectConstructor() { currentStatus: true, label: undefined, visible: true, - icons: ['angle-to-parent-000', 'angle-to-parent-360', 'angle-to-parent-180', 'angle-to-parent-090', 'angle-to-parent-045'], + icons: ['remove-angle-to-parent-node', 'set-angle-to-parent-node-to-360-degrees', 'set-angle-to-parent-node-to-180-degrees', 'set-angle-to-parent-node-to-90-degrees', 'set-angle-to-parent-node-to-45-degrees'], rawRadius: 12, targetRadius: 0, currentRadius: 0, @@ -249,7 +261,7 @@ function newUiObjectConstructor() { currentStatus: true, label: undefined, visible: true, - icons: ['distance-to-parent-000', 'distance-to-parent-025', 'distance-to-parent-050', 'distance-to-parent-100', 'distance-to-parent-150', 'distance-to-parent-200'], + icons: ['remove-distance-to-parent-node', 'set-distance-to-parent-node-to-one-fourth', 'set-distance-to-parent-node-to-one-half', 'set-distance-to-parent-node-to-one', 'set-distance-to-parent-node-to-one-and-a-half', 'set-distance-to-parent-node-to-two'], rawRadius: 12, targetRadius: 0, currentRadius: 0, @@ -264,7 +276,7 @@ function newUiObjectConstructor() { currentStatus: true, label: undefined, visible: true, - icons: ['arrangement-concave', 'arrangement-convex', 'arrangement-vertical-right', 'arrangement-vertical-left', 'arrangement-horizontal-bottom', 'arrangement-horizontal-top'], + icons: ['set-node-arrangement-to-concave', 'set-node-arrangement-to-convex', 'set-node-arrangement-to-vertical-right', 'set-node-arrangement-to-vertical-left', 'set-node-arrangement-to-horizontal-bottom', 'set-node-arrangement-to-horizontal-top'], rawRadius: 12, targetRadius: 0, currentRadius: 0, @@ -279,8 +291,8 @@ function newUiObjectConstructor() { currentStatus: true, label: undefined, visible: true, - iconPathOn: 'unfreeze', - iconPathOff: 'freeze', + iconPathOn: 'unfreeze-structure-of-nodes', + iconPathOff: 'freeze-structure-of-nodes', rawRadius: 12, targetRadius: 0, currentRadius: 0, @@ -295,8 +307,8 @@ function newUiObjectConstructor() { currentStatus: false, label: undefined, visible: true, - iconPathOn: 'expand', - iconPathOff: 'collapse', + iconPathOn: 'expand-structure-of-nodes', + iconPathOff: 'collapse-structure-of-nodes', rawRadius: 12, targetRadius: 0, currentRadius: 0, @@ -310,8 +322,8 @@ function newUiObjectConstructor() { actionProject: 'Superalgos', label: undefined, visible: true, - iconPathOn: 'backup', - iconPathOff: 'backup', + iconPathOn: 'backup-entity', + iconPathOff: 'backup-entity', rawRadius: 12, targetRadius: 0, currentRadius: 0, @@ -325,8 +337,8 @@ function newUiObjectConstructor() { actionProject: 'Superalgos', label: undefined, visible: true, - iconPathOn: 'clone', - iconPathOff: 'clone', + iconPathOn: 'clone-entity', + iconPathOff: 'clone-entity', rawRadius: 12, targetRadius: 0, currentRadius: 0, @@ -341,8 +353,8 @@ function newUiObjectConstructor() { actionProject: 'Superalgos', label: undefined, visible: true, - iconPathOn: 'share', - iconPathOff: 'share', + iconPathOn: 'share-entity', + iconPathOff: 'share-entity', rawRadius: 12, targetRadius: 0, currentRadius: 0, @@ -357,8 +369,8 @@ function newUiObjectConstructor() { actionProject: 'Superalgos', label: undefined, visible: true, - iconPathOn: 'detach', - iconPathOff: 'detach', + iconPathOn: 'detach-node', + iconPathOff: 'detach-node', rawRadius: 12, targetRadius: 0, currentRadius: 0, @@ -372,8 +384,8 @@ function newUiObjectConstructor() { actionProject: 'Superalgos', label: undefined, visible: true, - iconPathOn: 'delink', - iconPathOff: 'delink', + iconPathOn: 'delink-node', + iconPathOff: 'delink-node', rawRadius: 12, targetRadius: 0, currentRadius: 0, diff --git a/Projects/Superalgos/UI/Spaces/Floating-Space/UiObjectMessage.js b/Projects/Superalgos/UI/Spaces/Floating-Space/UiObjectMessage.js index 7f35302d2..12eb18f01 100644 --- a/Projects/Superalgos/UI/Spaces/Floating-Space/UiObjectMessage.js +++ b/Projects/Superalgos/UI/Spaces/Floating-Space/UiObjectMessage.js @@ -25,6 +25,7 @@ function newUiObjectMessage() { thisObject.container.frame.radius = 0 let selfMouseClickEventSubscriptionId + let hoverAnimationCounter = 0 return thisObject @@ -50,6 +51,7 @@ function newUiObjectMessage() { function getContainer(point) { if (thisObject.text === undefined) { return } if (thisObject.container.frame.isThisPointHere(point, true) === true) { + hoverAnimationCounter = 30 return thisObject.container } else { return undefined @@ -68,6 +70,11 @@ function newUiObjectMessage() { thisObject.container.frame.width = FRAME_WIDTH thisObject.container.frame.height = FRAME_HEIGHT + + hoverAnimationCounter-- + if (hoverAnimationCounter < 0) { + hoverAnimationCounter = 0 + } } function onMouseClick(event) { @@ -120,15 +127,29 @@ function newUiObjectMessage() { } } - function drawMessageBackground(borderColor) { + function drawMessageBackground(color) { if (thisObject.text === undefined) { return } + let backgroundColor + let borderColor + let lineWidth + + if (hoverAnimationCounter > 0 && thisObject.docs !== undefined) { + backgroundColor = UI_COLOR.LIGHT_GREY + borderColor = color + lineWidth = 2 + } else { + backgroundColor = UI.projects.superalgos.spaces.floatingSpace.style.backgroundColor + borderColor = color + lineWidth = 0.5 + } + let params = { - cornerRadius: 5, - lineWidth: 0.5, + cornerRadius: 10, + lineWidth: lineWidth, container: thisObject.container, borderColor: borderColor, - backgroundColor: UI.projects.superalgos.spaces.floatingSpace.style.backgroundColor, + backgroundColor: backgroundColor, castShadow: false, opacity: 0.75 } diff --git a/Projects/Superalgos/UI/Spaces/Panel-Space/PanelSpace.js b/Projects/Superalgos/UI/Spaces/Panel-Space/PanelSpace.js index c8b2ee86f..d0a58ab2c 100644 --- a/Projects/Superalgos/UI/Spaces/Panel-Space/PanelSpace.js +++ b/Projects/Superalgos/UI/Spaces/Panel-Space/PanelSpace.js @@ -49,14 +49,16 @@ function newSuperalgosPanelSpace() { } case 'Plotter Panel': { - if (pParameters.panelNode.config.isLegacy !== true) { + let panelConfig = JSON.parse(pParameters.panelNode.config) + + if (panelConfig.isLegacy !== true) { panel = newPlotterPanel() panel.fitFunction = UI.projects.superalgos.spaces.chartingSpace.fitFunction panel.container.isVisibleFunction = UI.projects.superalgos.spaces.chartingSpace.isThisPointVisible panel.session = pSession panel.initialize(pParameters.panelNode) } else { - panel = getNewPlotterPanel(pParameters.mine, pParameters.plotterCodeName, pParameters.moduleCodeName, pParameters.panelNode.config.codeName) + panel = getNewPlotterPanel(pParameters.mine, pParameters.plotterCodeName, pParameters.moduleCodeName, panelConfig.codeName) panel.fitFunction = UI.projects.superalgos.spaces.chartingSpace.fitFunction panel.container.isVisibleFunction = UI.projects.superalgos.spaces.chartingSpace.isThisPointVisible panel.session = pSession diff --git a/Projects/Superalgos/UI/Spaces/Tutorial-Space/TutorialSpace.js b/Projects/Superalgos/UI/Spaces/Tutorial-Space/TutorialSpace.js index 58ed15569..df45fc80d 100644 --- a/Projects/Superalgos/UI/Spaces/Tutorial-Space/TutorialSpace.js +++ b/Projects/Superalgos/UI/Spaces/Tutorial-Space/TutorialSpace.js @@ -341,7 +341,7 @@ function newSuperalgosTutorialSpace() { return } sliderCounter++ - if (sliderCounter === 10 || sliderCounter === 100) { + if (sliderCounter === 1 || sliderCounter === 100) { switch (config.slider) { case "toTop": { @@ -579,11 +579,13 @@ function newSuperalgosTutorialSpace() { if (timeMachine !== undefined) { repositionAtTimeMachineCounter++ switch (true) { - case (repositionAtTimeMachineCounter > 0 && repositionAtTimeMachineCounter < 20): { + case (repositionAtTimeMachineCounter > 1 && repositionAtTimeMachineCounter < 20): { let event = { delta: -1 } - UI.projects.superalgos.spaces.chartingSpace.viewport.onMouseWheel(event) + for (let i = 0; i < 100; i++) { + UI.projects.superalgos.spaces.chartingSpace.viewport.onMouseWheel(event) + } break } case (repositionAtTimeMachineCounter === 30): { @@ -621,11 +623,13 @@ function newSuperalgosTutorialSpace() { if (timeMachine !== undefined) { repositionAtTimeMachineCounter++ switch (true) { - case (repositionAtTimeMachineCounter > 10 && repositionAtTimeMachineCounter < 20): { - let event = { - delta: -1 + case (repositionAtTimeMachineCounter > 1 && repositionAtTimeMachineCounter < 30): { + for (let i = 0; i < 10; i++) { + let event = { + delta: -1 + } + UI.projects.superalgos.spaces.chartingSpace.viewport.onMouseWheel(event) } - UI.projects.superalgos.spaces.chartingSpace.viewport.onMouseWheel(event) break } case (repositionAtTimeMachineCounter === 30): { @@ -1189,9 +1193,9 @@ function newSuperalgosTutorialSpace() { syncConfigIconWithDocumentIcon() transformDocsInfoIntoTutorialInfo() createTheHTML() - - if (nodeConfig.controlDocs !== undefined ) { - if ( nodeConfig.controlDocs.closeTutorialEditor !== true) { + + if (nodeConfig.controlDocs !== undefined) { + if (nodeConfig.controlDocs.closeTutorialEditor !== true) { UI.projects.superalgos.spaces.docsSpace.navigateTo(nodeConfig.docs.project, 'Tutorial', nodeConfig.docs.type) } } else { diff --git a/README.md b/README.md index 6423b860a..2ff9e1813 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Before you begin, it is recommended that you set up Chrome/Safari as your defaul # Superalgos Client Installation -**1.** Scroll the page all the way to the top. Find and click the **Fork** button to create your fork/copy of this repository. To fork Superalgos you need a GitHub account. If you don't have one, go ahead and create it. A Fork is required for your contributions to the project and to stay up to date with the latest version of the software (more on this later). +**1.** Scroll the page all the way to the top. Find and click the **Fork** button to create your fork/copy of this repository. To fork Superalgos you need a GitHub account. If you don't have one, go ahead and create it. A Fork is required for your contributions to the project (more on this later). **2.** Once the fork is created, you will land on the page of your fork. Copy the URL from your browser's address bar. @@ -74,7 +74,7 @@ git clone https://github.com/John/Superalgos **1.** You need to make a fork so that you may contribute work. Superalgos is a Community project and you are expected to contribute, like everyone else. You don't need to be a technical person to contribute. Fixing a typo in the docs or translating a paragraph into your native language are valuable contributions too. Superalgos has built-in features that make contributing easy. Help make Superalgos better and Superalgos will better serve you! [Free-riding is not cool](https://en.wikipedia.org/wiki/Free-rider_problem), particularly on free, open-source, Community-driven projects. -**2.** You also need a fork to use the in-app self-update feature. It will help you stay up-to-date with the latest version of the software. Updates are on-demand, so don't worry about undesired updates. The project moves very fast and new features become available regularly, particularly if you choose to run the software in the ```develop``` branch (you may switch branches from within the app). +**2.** The software includes an in-app self-update command / feature. It will help you stay up-to-date with the latest version of the software. Updates are on-demand, so don't worry about undesired updates. The project moves very fast and new features become available regularly, particularly if you choose to run the software in the ```develop``` branch (you may switch branches from within the app). **3.** You are better off running the git clone command as an administrator to avoid permission issues while creating the Superalgos folder and downloading the repository. It may work without admin powers depending on your setup, particularly if you are running the command on a folder where you've got write permissions. @@ -173,6 +173,21 @@ Superalgos is a platform to automate crypto-trading. It is implemented as a Node * No need to integrate a charting library, Superalgos features an integrated Charting System. * No need to manage task data or execution dependencies. Superalgos allows you to define Tasks and distribute them across a Trading Farm and takes care of the data and execution dependencies so that each task automatically starts when their dependencies are ready. +## Superalgos is Permisionless + +* Don't like the UI? +* Don't like the icons used? +* Don't like the Charting System? +* Don't like the Visual Designer? +* Don't like the Visual Debugger? +* Don't like the Docs? +* Don't like the Trading Bot? +* Don't like the Indicators? +* Don't like the Plotters? +* Don't like any other part of the system? + +No problem, code or integrate libraries with your own version of any component and we promise we will merge your work and provide it as an alternative to users. We believe in Permissionless Innovation and that users, not team members, are the final judges and the ones who decide what they prefer to use. You are free to create an alternative for any part of the system that you believe that should work or should have been done in a different way. We will help you integrate your vision into the next release and enable a way for users to choose between different implementations of the same functionality. You will also be granted the title of maintainer of the functionality you provide and have decision power on how it evolves in the future. + # Superalgos for Individuals * Superalgos is easy to install/uninstall. @@ -261,7 +276,7 @@ Superalgos is a Community Project built by Contributors for Contributors. Learn ## Top Contributors -Luis Fernando Molina, Julian Molina, Andreja Cobeljic, Matías Benitez, Ira Miller, Eduardo Remis, Jeff Braun, rico4dev, 9808us, Barry Low, Nikola Bjelogrlic, Hirajin Koizuko, Francisco J. Santillán, Norman, Viktoria B., Guillermo V., Daniel J., Javier A., Gustavo J., Romina GS, Pedro P., Thais M., Andrey M., Loui M., Natalia M., Bashar A., Carlos V., Diego M., Sebastian E., Bogdan P., Marko V., Igor S., Niksa K., Rodrigo M., Nicanor M., Alejandro P., Mateo H., Lan T., Leon A., Uroš R., Filip M., Vladimir J. and Pavle B. +Luis Fernando Molina, Julian Molina, Andreja Cobeljic, Matías Benitez, Ira Miller, Eduardo Remis, Jeff Braun, rico4dev, 9808us, Barry Low, Nikola Bjelogrlic, Hirajin Koizuko, Francisco J. Santillán, Norman, Viktoria B., Guillermo V., Daniel J., Javier A., Gustavo J., Romina GS, Pedro P., Thais M., Andrey M., Loui M., Natalia M., Bashar A., Carlos V., Diego M., CarnivalBen, Sebastian E., Bogdan P., Marko V., Igor S., Niksa K., Rodrigo M., Nicanor M., Alejandro P., Mateo H., Lan T., Leon A., Uroš R., Filip M., Vladimir J. and Pavle B. # License diff --git a/UI/Data-Files/src/FileStorage.js b/UI/Data-Files/src/FileStorage.js index eda906c26..e7421af1e 100644 --- a/UI/Data-Files/src/FileStorage.js +++ b/UI/Data-Files/src/FileStorage.js @@ -2,7 +2,7 @@ function newFileStorage(host, port) { const MODULE_NAME = 'File Storage' const INFO_LOG = false const logger = newWebDebugLog() - + const MAX_RETRY = 2 let currentRetry = 0 @@ -37,13 +37,17 @@ function newFileStorage(host, port) { if (pathComplete === false || pathComplete === undefined) { folder = 'Storage/' } - let url = folder + filePath + let url + if (host !== undefined && port !== undefined) { url = 'http://' + host + ':' + port + '/' + folder + filePath } else { url = folder + filePath } + /* Scaping # since it breaks the URL */ + url = url.replaceAll('#', '_HASHTAG_') + httpRequest(undefined, url, (response, fileContent) => { if (response.result === GLOBAL.DEFAULT_OK_RESPONSE.result) { callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE, fileContent) diff --git a/run.js b/run.js index 5ea495f8a..dcea2c68b 100644 --- a/run.js +++ b/run.js @@ -30,28 +30,44 @@ if ( console.log(' minMemo: Optional. Use it when your hardware has less than 8 Gb or memory.') console.log('') console.log('If you are having an error while trying to run this Client, consider this:') - - fatalErrorHelp() + + fatalErrorHelp() return } +const OS = require("os") +let totalRAM = OS.totalmem() // Get total ram installed +totalRAM = totalRAM / 1024 / 1024 +let optimalRAM = totalRAM * 0.85 // Use 85% of installed RAM +let maxOldSpaceSize = "--max-old-space-size=" + (optimalRAM.toFixed(0)).toString() +let options + +console.log('') +console.log("Total RAM istalled in this system is ..... " + (totalRAM / 1024).toFixed(2) + " GB") +if (process.argv.includes("minMemo")) { + options = { + stdio: 'inherit' + } + console.log("Total RAM available for Superalgos is .... 512 MB") +} else { + options = { + execArgv: [maxOldSpaceSize], + stdio: 'inherit' + } + console.log("Total RAM available for Superalgos is .... " + (optimalRAM / 1024).toFixed(2) + " GB") + console.log('') + console.log('If you would like to enable less RAM than that, use the minMemo flag. Note: RAM will be allocated only if needed.') +} console.log('') console.log('OPTIONS ACCEPTED:') console.log('') let optionsAccepted = 0 -let options = { - execArgv: ['--max-old-space-size=8192'], - stdio: 'inherit' -} if (process.argv.includes("minMemo")) { - options = { - stdio: 'inherit' - } optionsAccepted++ console.log('minMemo ............................ Running with Minimun Required Memory.') -} +} if (process.argv.includes("noBrowser")) { optionsAccepted++ @@ -61,7 +77,7 @@ if (process.argv.includes("noBrowser")) { if (optionsAccepted === 0) { console.log('none ............................... Running without any command line options.') } - +console.log('') console.log('') try { @@ -72,7 +88,7 @@ try { console.log('Fail to create Client Process.') console.log('') - fatalErrorHelp() + fatalErrorHelp() } function fatalErrorHelp() { @@ -84,4 +100,3 @@ function fatalErrorHelp() { console.log('') console.log('node run minMemo noBrowser') } -