Skip to content

Commit

Permalink
Merge pull request #3338 from Superalgos/develop
Browse files Browse the repository at this point in the history
Develop into Master, Nov and Dec 2021 Bug Fixes, Features and Plugins
  • Loading branch information
Luis-Fernando-Molina authored Jan 2, 2022
2 parents febbc20 + 5654a38 commit dd2357f
Show file tree
Hide file tree
Showing 2,346 changed files with 1,102,549 additions and 160,307 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ assignees: ''

There are two requirements to open an issue:

1. You must first follow the [Troubleshooting Guide](https://docs.superalgos.org/suite-how-to-troubleshoot-an-issue.html)
1. You must first follow the Troubleshooting Guide in the built-in Docs.

2. If your issue hasn't been resolved by following the Troubleshooting Guide, then follow the guide on [How to Report an Issue](https://docs.superalgos.org/suite-how-to-report-an-issue.html).
2. If your issue hasn't been resolved by following the Troubleshooting Guide, then follow the guide on How to Report an Issue, also in the Docs.

## Context

Expand Down
18 changes: 18 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 180
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
- improvement
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Data-Storage
/Data-Storage
Log-Files
My-Workspaces
My-Social-Trading-Data
Expand All @@ -20,3 +20,5 @@ launch.json
package-lock.json
.idea
dist
/nbproject/private/
Platform/WebServer/externalScripts
File renamed without changes.
13 changes: 13 additions & 0 deletions .vscode/TaskServer-2.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"folders": [
{
"path": "C:\\Superalgos\\TaskServer"
},
{
"path": "C:\\Superalgos\\Projects"
}
],
"settings": {
"search.maintainFileSearchCache": true
}
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
"**/My-Data-Storage": true,
"**/My-Log-Files": true,
},
"search.maintainFileSearchCache": true
"search.maintainFileSearchCache": true,
"editor.mouseWheelZoom": true
}
27 changes: 14 additions & 13 deletions Desktop/DesktopApp.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
exports.newDesktopApp = function newDesktopApp() {

let thisObject = {
userProfiles: undefined,
p2pNetworkClient: undefined,
appBootstrapingProcess: undefined,
p2pNetworkClientIdentity: undefined,
p2pNetwork: undefined,
p2pNetworkPeers: undefined,
webSocketsInterface: undefined,
Expand All @@ -25,26 +25,31 @@ exports.newDesktopApp = function newDesktopApp() {
/*
We set up ourselves as a Network Client.
*/
thisObject.p2pNetworkClient = SA.projects.network.modules.p2pNetworkClient.newNetworkModulesP2PNetworkClient()
await thisObject.p2pNetworkClient.initialize()
thisObject.p2pNetworkClientIdentity = SA.projects.network.modules.p2pNetworkClientIdentity.newNetworkModulesP2PNetworkClientIdentity()
await thisObject.p2pNetworkClientIdentity.initialize()
/*
We will read all user profiles plugins and get from there our network identity.
*/
thisObject.userProfiles = SA.projects.network.modules.userProfiles.newNetworkModulesUserProfiles()
await thisObject.userProfiles.initialize(global.env.DESKTOP_APP_SIGNING_ACCOUNT, thisObject.p2pNetworkClient)
thisObject.appBootstrapingProcess = SA.projects.network.modules.appBootstrapingProcess.newNetworkModulesAppBootstrapingProcess()
await thisObject.appBootstrapingProcess.initialize(global.env.DESKTOP_APP_SIGNING_ACCOUNT, thisObject.p2pNetworkClientIdentity)
/*
We set up the P2P Network.
*/
thisObject.p2pNetwork = SA.projects.network.modules.p2pNetwork.newNetworkModulesP2PNetwork()
await thisObject.p2pNetwork.initialize('Network Client')
/*
This is where we will process all the events comming from the p2p network.
*/
thisObject.p2pNetworkInterface = SA.projects.socialTrading.modules.p2pNetworkInterface.newSocialTradingModulesP2PNetworkInterface()
/*
Set up the connections to network nodes.
*/
thisObject.p2pNetworkPeers = SA.projects.network.modules.p2pNetworkPeers.newNetworkModulesP2PNetworkPeers()
await thisObject.p2pNetworkPeers.initialize(
'Network Client',
thisObject.p2pNetworkClient,
thisObject.p2pNetworkClientIdentity,
thisObject.p2pNetwork,
thisObject.p2pNetworkInterface,
global.env.DESKTOP_APP_MAX_OUTGOING_PEERS
)
}
Expand All @@ -55,10 +60,6 @@ exports.newDesktopApp = function newDesktopApp() {
*/
thisObject.webAppInterface = DK.projects.socialTrading.modules.webAppInterface.newSocialTradingModulesWebAppInterface()
/*
This is where we will process all the events comming from the p2p network.
*/
thisObject.p2pNetworkInterface = DK.projects.socialTrading.modules.p2pNetworkInterface.newSocialTradingModulesP2PNetworkInterface()
/*
This is the Personal Social Graph for the user running this App.
*/
thisObject.socialGraph = DK.projects.socialTrading.modules.socialGraph.newSocialTradingModulesSocialGraph()
Expand All @@ -68,11 +69,11 @@ exports.newDesktopApp = function newDesktopApp() {
*/
thisObject.webSocketsInterface = DK.projects.socialTrading.modules.webSocketsInterface.newDesktopModulesWebSocketsInterface()
thisObject.webSocketsInterface.initialize()
console.log('Desktop Client Web Sockets Interface ......................................... Listening at port ' + JSON.parse(DK.desktopApp.p2pNetworkClient.node.config).webSocketsPort)
console.log('Desktop Client Web Sockets Interface ......................................... Listening at port ' + DK.desktopApp.p2pNetworkClientIdentity.node.config.webSocketsPort)

thisObject.httpInterface = DK.projects.socialTrading.modules.httpInterface.newDesktopModulesHttpInterface()
thisObject.httpInterface.initialize()
console.log('Desktop Client Http Interface ................................................ Listening at port ' + JSON.parse(DK.desktopApp.p2pNetworkClient.node.config).webPort)
console.log('Desktop Client Http Interface ................................................ Listening at port ' + DK.desktopApp.p2pNetworkClientIdentity.node.config.webPort)
}
}
}
14 changes: 14 additions & 0 deletions Desktop/UI/WebAppLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ function newWebAppLoader() {
modulesArray.push('Projects' + '/' + project.name + '/' + 'UI' + '/' + 'Function-Libraries' + '/' + fileName)
}
}
if (project.UI.nodeActionFunctions !== undefined) {
for (let j = 0; j < project.UI.nodeActionFunctions.length; j++) {
let fileName = project.UI.nodeActionFunctions[j].fileName
if (fileName === undefined) {fileName = project.UI.nodeActionFunctions[j].name.replaceAll(' ', '') + '.js'}
modulesArray.push('Projects' + '/' + project.name + '/' + 'UI' + '/' + 'Node-Action-Functions' + '/' + fileName)
}
}
if (project.UI.systemActionFunctions !== undefined) {
for (let j = 0; j < project.UI.systemActionFunctions.length; j++) {
let fileName = project.UI.systemActionFunctions[j].fileName
if (fileName === undefined) {fileName = project.UI.systemActionFunctions[j].name.replaceAll(' ', '') + '.js'}
modulesArray.push('Projects' + '/' + project.name + '/' + 'UI' + '/' + 'System-Action-Functions' + '/' + fileName)
}
}
if (project.UI.utilities !== undefined) {
for (let j = 0; j < project.UI.utilities.length; j++) {
let fileName = project.UI.utilities[j].fileName
Expand Down
73 changes: 73 additions & 0 deletions DesktopReact/DesktopAppBackend.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
exports.newDesktopAppBackend = function newDesktopAppBackend() {

let thisObject = {
appBootstrapingProcess: undefined,
p2pNetworkClientIdentity: undefined,
p2pNetwork: undefined,
p2pNetworkPeers: undefined,
webSocketsInterface: undefined,
webAppInterface: undefined,
p2pNetworkInterface: undefined,
socialGraph: undefined,
run: run
}

DK.desktopApp = thisObject

return thisObject

async function run() {

await setupNetwork()
await setupServices()

async function setupNetwork() {
/*
We set up ourselves as a Network Client.
*/
thisObject.p2pNetworkClientIdentity = SA.projects.network.modules.p2pNetworkClientIdentity.newNetworkModulesP2PNetworkClientIdentity()
await thisObject.p2pNetworkClientIdentity.initialize()
/*
We will read all user profiles plugins and get from there our network identity.
*/
thisObject.appBootstrapingProcess = SA.projects.network.modules.appBootstrapingProcess.newNetworkModulesAppBootstrapingProcess()
await thisObject.appBootstrapingProcess.initialize(global.env.DESKTOP_APP_SIGNING_ACCOUNT, thisObject.p2pNetworkClientIdentity)
/*
We set up the P2P Network.
*/
thisObject.p2pNetwork = SA.projects.network.modules.p2pNetwork.newNetworkModulesP2PNetwork()
await thisObject.p2pNetwork.initialize('Network Client')
/*
This is where we will process all the events comming from the p2p network.
*/
thisObject.p2pNetworkInterface = SA.projects.socialTrading.modules.p2pNetworkInterface.newSocialTradingModulesP2PNetworkInterface()
/*
Set up the connections to network nodes.
*/
thisObject.p2pNetworkPeers = SA.projects.network.modules.p2pNetworkPeers.newNetworkModulesP2PNetworkPeers()
await thisObject.p2pNetworkPeers.initialize(
'Network Client',
thisObject.p2pNetworkClientIdentity,
thisObject.p2pNetwork,
thisObject.p2pNetworkInterface,
global.env.DESKTOP_APP_MAX_OUTGOING_PEERS
)
}

async function setupServices() {
/*
This is where we will process all the messages comming from our web app.
*/
thisObject.webAppInterface = DK.projects.socialTrading.modules.webAppInterface.newSocialTradingModulesWebAppInterface()
/*
This is the Personal Social Graph for the user running this App.
*/
thisObject.socialGraph = DK.projects.socialTrading.modules.socialGraph.newSocialTradingModulesSocialGraph()
await thisObject.socialGraph.initialize()

let express = require('./backend/src/expressServer.js')
express.DesktopBackend(DK.desktopApp.p2pNetworkClientIdentity.node.config.webPort, SA, DK);
console.log(`express Interface ................................................ Listening at port ${DK.desktopApp.p2pNetworkClientIdentity.node.config.webPort}` );
}
}
}
22 changes: 22 additions & 0 deletions DesktopReact/DesktopAppFrontend.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
exports.newDesktopAppFrontend = function newDesktopAppFrontend() {

let thisObject = {
run: run
}

return thisObject

async function run() {

await setupServices()

async function setupServices() {

let react = require('./frontend/scripts/start')
let port = 33249;
react.start(port); // todo get port from node config
console.log(`react Interface ................................................ Listening at port ${port}`);

}
}
}
75 changes: 75 additions & 0 deletions DesktopReact/DesktopRootReactBackend.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
exports.newDesktopBackendRoot = function newDesktopBackendRoot() {
/*
This module represents the execution root of the Desktop App.
We use this module that is outside the Desktop folder to
load all node dependencies and get them ready to the actual App.
*/
let thisObject = {
run: run
}

return thisObject

async function run(debugSettings) {
/*
The DK object is accessible everywhere at the Superalgos Desktop App.
It provides access to all modules built for this App.
*/
global.DK = {}
/*
The SA object is accessible 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()
global.env = ENVIRONMENT_MODULE

if (debugSettings !== undefined && debugSettings.DESKTOP_APP_SIGNING_ACCOUNT !== undefined) {
global.env.DESKTOP_APP_SIGNING_ACCOUNT = debugSettings.DESKTOP_APP_SIGNING_ACCOUNT
}
/*
First thing is to load the project schema file.
*/
global.PROJECTS_SCHEMA = require(global.env.PATH_TO_PROJECT_SCHEMA)
/*
Setting up the modules that will be available, defined at the Project Schema file.
*/
let MULTI_PROJECT = require('../MultiProject.js');
let MULTI_PROJECT_MODULE = MULTI_PROJECT.newMultiProject()
MULTI_PROJECT_MODULE.initialize(DK, 'DK')
MULTI_PROJECT_MODULE.initialize(SA, 'SA')
/*
Setting up external dependencies.
*/
SA.nodeModules = {
fs: require('fs'),
util: require('util'),
path: require('path'),
web3: require('web3'),
ws: require('ws'),
open: require('open'),
http: require('http'),
octokit: require("@octokit/rest"),
simpleGit: require('simple-git'),
nodeFetch: require('node-fetch'),
graphql: require("@octokit/graphql"),
axios: require('axios')
}
SA.version = require('../package.json').version
/*
Setting up Secrets.
*/
let SECRETS = require('../Secrets.js').newSecrets()
SECRETS.initialize()

run()

async function run() {
DK.app = require('./DesktopAppBackend.js').newDesktopAppBackend()
await DK.app.run()
console.log('Superalgos Desktop Backend App is Running!')
}
}
}
19 changes: 19 additions & 0 deletions DesktopReact/DesktopRootReactFrontend.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
exports.newDesktopFrontendRoot = function newDesktopFrontendRoot() {

let thisObject = {
run: run
}

return thisObject

async function run() {

run()

async function run() {
let app = require('./DesktopAppFrontend').newDesktopAppFrontend()
await app.run()
console.log('Superalgos Desktop Frontend App is Running!')
}
}
}
23 changes: 23 additions & 0 deletions DesktopReact/backend/src/controllers/posts.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const { postService } = require('../services');

const getPosts = async (req, res) => {
const result = await postService.getPosts(req.query.userId);
res.send(result);
};

const createPost = async (req, res) => {
try {
const result = await postService.createPost(req.body);
res.send(result);
} catch (error) {
console.log(error);
}

};


module.exports = {
getPosts,
createPost
};

Loading

0 comments on commit dd2357f

Please sign in to comment.