From fd7f97030484c1d6e961d49fd525e29209f03d7c Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 20 Oct 2021 11:40:01 +0200 Subject: [PATCH] Refactoring CLIENT PLATFORM --- Desktop/DesktopApp.js | 2 +- Environment.js | 6 +++--- Platform/Client/httpInterface.js | 20 +++++++++---------- Platform/Client/webSocketsInterface.js | 2 +- Platform/PlatformApp.js | 4 ++-- .../Sensor-Bot/Webhooks/CheckWebhook.js | 2 +- .../TS/Task-Modules/EventServerClient.js | 2 +- .../DK/modules/WebSocketsInterface.js | 4 ++-- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Desktop/DesktopApp.js b/Desktop/DesktopApp.js index 77cf0f03d..8f3883460 100644 --- a/Desktop/DesktopApp.js +++ b/Desktop/DesktopApp.js @@ -29,7 +29,7 @@ exports.newDesktopApp = function newDesktopApp() { DK.running.webSocketsInterface = DK.projects.socialTrading.modules.webSocketsInterface.newDesktopModulesWebSocketsInterface() DK.running.webSocketsInterface.initialize() - console.log('Desktop Client Web Sockets Interface ....................................... Listening at port ' + global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT) + console.log('Desktop Client Web Sockets Interface ....................................... Listening at port ' + global.env.PLATFORM_WEB_SOCKETS_INTERFACE_PORT) DK.running.httpInterface = DK.projects.socialTrading.modules.httpInterface.newDesktopModulesHttpInterface() diff --git a/Environment.js b/Environment.js index fc46543c6..5d7a914af 100644 --- a/Environment.js +++ b/Environment.js @@ -10,18 +10,18 @@ exports.newEnvironment = function () { let thisObject = { BASE_PATH: basePath, WEB_SERVER_URL: 'localhost', - CLIENT_WEB_SOCKETS_INTERFACE_PORT: 18041, + PLATFORM_WEB_SOCKETS_INTERFACE_PORT: 18041, NETWORK_WEB_SOCKETS_INTERFACE_PORT: 18042, DESKTOP_WEB_SOCKETS_INTERFACE_PORT: 18043, DESKTOP_WEB_SOCKETS_INTERFACE_HOST: 'localhost', - CLIENT_HTTP_INTERFACE_PORT: 34248, + PLATFORM_HTTP_INTERFACE_PORT: 34248, DESKTOP_HTTP_INTERFACE_PORT: 34249, PATH_TO_DATA_STORAGE: path.join(basePath, './Platform/My-Data-Storage'), PATH_TO_PROJECTS: path.join(basePath, './Projects'), PATH_TO_LOG_FILES: path.join(basePath, './Platform/My-Log-Files'), PATH_TO_PROJECTS_REQUIRED: path.join(basePath, './Projects'), PATH_TO_PROJECT_SCHEMA: path.join(basePath, './Projects/ProjectsSchema.json'), - PATH_TO_CLIENT: path.join(basePath, './Platform'), + PATH_TO_PLATFORM: path.join(basePath, './Platform'), PATH_TO_DESKTOP: './Desktop', PATH_TO_DEFAULT_WORKSPACE: path.join(basePath, './Projects/Foundations/Plugins/Workspaces'), PATH_TO_MY_WORKSPACES: path.join(basePath, './Platform/My-Workspaces'), diff --git a/Platform/Client/httpInterface.js b/Platform/Client/httpInterface.js index ea5c2a057..637137c32 100644 --- a/Platform/Client/httpInterface.js +++ b/Platform/Client/httpInterface.js @@ -24,7 +24,7 @@ exports.newHttpInterface = function newHttpInterface() { /* We will create an HTTP Server and leave it running forever. */ - SA.nodeModules.http.createServer(onHttpRequest).listen(global.env.CLIENT_HTTP_INTERFACE_PORT) + SA.nodeModules.http.createServer(onHttpRequest).listen(global.env.PLATFORM_HTTP_INTERFACE_PORT) /* Starting the browser now is optional */ if (process.argv.includes("noBrowser")) { //Running Client only with no UI. @@ -33,7 +33,7 @@ exports.newHttpInterface = function newHttpInterface() { if (initialWorkspace.name !== undefined) { queryString = '/?initialWorkspaceName=' + initialWorkspace.name + '&initialWorkspaceProject=' + initialWorkspace.project + '&initialWorkspaceType=' + initialWorkspace.type } - SA.nodeModules.open('http://localhost:' + global.env.CLIENT_HTTP_INTERFACE_PORT + queryString) + SA.nodeModules.open('http://localhost:' + global.env.PLATFORM_HTTP_INTERFACE_PORT + queryString) } } @@ -1311,17 +1311,17 @@ exports.newHttpInterface = function newHttpInterface() { break case 'LegacyPlotter.js': { - SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/WebServer/LegacyPlotter.js', httpResponse) + SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/LegacyPlotter.js', httpResponse) } break case 'PlotterPanel.js': { - SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/WebServer/PlotterPanel.js', httpResponse) + SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/PlotterPanel.js', httpResponse) } break case 'Images': // This means the Images folder. { - let path = global.env.PATH_TO_CLIENT + '/WebServer/Images/' + requestPath[2] + let path = global.env.PATH_TO_PLATFORM + '/WebServer/Images/' + requestPath[2] if (requestPath[3] !== undefined) { path = path + '/' + requestPath[3] @@ -1403,12 +1403,12 @@ exports.newHttpInterface = function newHttpInterface() { break case 'WebServer': // This means the WebServer folder. { - SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/WebServer/' + requestPath[2], httpResponse) + SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/' + requestPath[2], httpResponse) } break case 'externalScripts': // This means the WebServer folder. { - SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/WebServer/externalScripts/' + requestPath[2], httpResponse) + SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/WebServer/externalScripts/' + requestPath[2], httpResponse) } break case 'Plotters': // This means the plotter folder, not to be confused with the Plotters script! @@ -1423,12 +1423,12 @@ exports.newHttpInterface = function newHttpInterface() { break case 'ChartLayers': { - SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/UI/' + endpointOrFile + '/' + requestPath[2], httpResponse) + SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/UI/' + endpointOrFile + '/' + requestPath[2], httpResponse) } break case 'Files': { - SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_CLIENT + '/UI/Data-Files/' + requestPath[2], httpResponse) + SA.projects.foundations.utilities.httpResponses.respondWithFile(global.env.PATH_TO_PLATFORM + '/UI/Data-Files/' + requestPath[2], httpResponse) } break case 'Fonts': @@ -1943,7 +1943,7 @@ exports.newHttpInterface = function newHttpInterface() { break default: { - SA.projects.foundations.utilities.httpResponses.respondWithWebFile(httpResponse, endpointOrFile, global.env.PATH_TO_CLIENT) + SA.projects.foundations.utilities.httpResponses.respondWithWebFile(httpResponse, endpointOrFile, global.env.PATH_TO_PLATFORM) } } } catch (err) { diff --git a/Platform/Client/webSocketsInterface.js b/Platform/Client/webSocketsInterface.js index 084bdea76..5797173da 100644 --- a/Platform/Client/webSocketsInterface.js +++ b/Platform/Client/webSocketsInterface.js @@ -9,7 +9,7 @@ const WEB_SOCKET = SA.nodeModules.ws let socketServer - let port = global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT + let port = global.env.PLATFORM_WEB_SOCKETS_INTERFACE_PORT return thisObject diff --git a/Platform/PlatformApp.js b/Platform/PlatformApp.js index 7ef1f87b1..dffa50d13 100644 --- a/Platform/PlatformApp.js +++ b/Platform/PlatformApp.js @@ -135,11 +135,11 @@ exports.newPlatformApp = function newPlatformApp() { console.log('') WEB_SOCKETS_INTERFACE = WEB_SOCKETS_INTERFACE.newWebSocketsInterface() WEB_SOCKETS_INTERFACE.initialize() - console.log('Web Sockets Interface ....................................... Listening at port ' + global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT) + console.log('Web Sockets Interface ....................................... Listening at port ' + global.env.PLATFORM_WEB_SOCKETS_INTERFACE_PORT) HTTP_INTERFACE = HTTP_INTERFACE.newHttpInterface() HTTP_INTERFACE.initialize(initialWorkspace) - console.log('Http Interface .............................................. Listening at port ' + global.env.CLIENT_HTTP_INTERFACE_PORT) + console.log('Http Interface .............................................. Listening at port ' + global.env.PLATFORM_HTTP_INTERFACE_PORT) console.log('') console.log("You are running Superalgos Beta 12") diff --git a/Projects/Data-Mining/TS/Bot-Modules/Sensor-Bot/Webhooks/CheckWebhook.js b/Projects/Data-Mining/TS/Bot-Modules/Sensor-Bot/Webhooks/CheckWebhook.js index ff45cd70d..dc7dd94f3 100644 --- a/Projects/Data-Mining/TS/Bot-Modules/Sensor-Bot/Webhooks/CheckWebhook.js +++ b/Projects/Data-Mining/TS/Bot-Modules/Sensor-Bot/Webhooks/CheckWebhook.js @@ -90,7 +90,7 @@ exports.newDataMiningBotModulesCheckWebhook = function (processIndex) { try { let http = SA.nodeModules.http let url = 'http://' + global.env.WEB_SERVER_URL + - ':' + global.env.CLIENT_HTTP_INTERFACE_PORT + + ':' + global.env.PLATFORM_HTTP_INTERFACE_PORT + '/Webhook/Fetch-Messages/' + TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.parentNode.parentNode.config.codeName + "/" + TS.projects.foundations.globals.taskConstants.TASK_NODE.parentNode.parentNode.parentNode.referenceParent.baseAsset.referenceParent.config.codeName + "-" + diff --git a/Projects/Foundations/TS/Task-Modules/EventServerClient.js b/Projects/Foundations/TS/Task-Modules/EventServerClient.js index add819ab3..8d334e98e 100644 --- a/Projects/Foundations/TS/Task-Modules/EventServerClient.js +++ b/Projects/Foundations/TS/Task-Modules/EventServerClient.js @@ -24,7 +24,7 @@ host = 'localhost' } if (port === undefined) { - port = global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT + port = global.env.PLATFORM_WEB_SOCKETS_INTERFACE_PORT } let messageCounter = 0 diff --git a/Projects/Social-Trading/DK/modules/WebSocketsInterface.js b/Projects/Social-Trading/DK/modules/WebSocketsInterface.js index beb00d6e4..562c5b5e9 100644 --- a/Projects/Social-Trading/DK/modules/WebSocketsInterface.js +++ b/Projects/Social-Trading/DK/modules/WebSocketsInterface.js @@ -45,7 +45,7 @@ exports.newDesktopModulesWebSocketsInterface = function newDesktopModulesWebSock webApp = { socket: socket } - console.log('Desktop Web App Connected to Web Sockets Interface ......................... Connected to port ' + global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT) + console.log('Desktop Web App Connected to Web Sockets Interface ......................... Connected to port ' + global.env.PLATFORM_WEB_SOCKETS_INTERFACE_PORT) webApp.socket.on('close', onConnectionClosed) webApp.socket.on('message', onMenssage) @@ -92,7 +92,7 @@ exports.newDesktopModulesWebSocketsInterface = function newDesktopModulesWebSock function onConnectionClosed() { webApp = undefined - console.log('Desktop Web App Discoonnected from Web Sockets Interface ................... Disonnected from port ' + global.env.CLIENT_WEB_SOCKETS_INTERFACE_PORT) + console.log('Desktop Web App Discoonnected from Web Sockets Interface ................... Disonnected from port ' + global.env.PLATFORM_WEB_SOCKETS_INTERFACE_PORT) } } catch (err) {