Skip to content

Commit

Permalink
fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ssplatt committed Dec 6, 2021
2 parents 2d72c06 + 9120e19 commit a95aaee
Show file tree
Hide file tree
Showing 760 changed files with 543,995 additions and 134,460 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ launch.json
package-lock.json
.idea
dist
/nbproject/private/
14 changes: 7 additions & 7 deletions Desktop/DesktopApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ exports.newDesktopApp = function newDesktopApp() {

let thisObject = {
userProfiles: undefined,
p2pNetworkClient: undefined,
p2pNetworkClientIdentity: undefined,
p2pNetwork: undefined,
p2pNetworkPeers: undefined,
webSocketsInterface: undefined,
Expand All @@ -25,13 +25,13 @@ 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)
await thisObject.userProfiles.initialize(global.env.DESKTOP_APP_SIGNING_ACCOUNT, thisObject.p2pNetworkClientIdentity)
/*
We set up the P2P Network.
*/
Expand All @@ -43,7 +43,7 @@ exports.newDesktopApp = function newDesktopApp() {
thisObject.p2pNetworkPeers = SA.projects.network.modules.p2pNetworkPeers.newNetworkModulesP2PNetworkPeers()
await thisObject.p2pNetworkPeers.initialize(
'Network Client',
thisObject.p2pNetworkClient,
thisObject.p2pNetworkClientIdentity,
thisObject.p2pNetwork,
global.env.DESKTOP_APP_MAX_OUTGOING_PEERS
)
Expand All @@ -68,11 +68,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 ' + JSON.parse(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 ' + JSON.parse(DK.desktopApp.p2pNetworkClientIdentity.node.config).webPort)
}
}
}
81 changes: 81 additions & 0 deletions DesktopReact/DesktopApp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
const express = require("./backend/src/index");
exports.newDesktopApp = function newDesktopApp() {

let thisObject = {
userProfiles: 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.userProfiles = SA.projects.network.modules.userProfiles.newNetworkModulesUserProfiles()
await thisObject.userProfiles.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')
/*
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,
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 sends events to the p2p network
/*
This is where we will process all the events comming from the p2p network.
*/
thisObject.p2pNetworkInterface = DK.projects.socialTrading.modules.p2pNetworkInterface.newSocialTradingModulesP2PNetworkInterface() // this receives events from p2p network
/*
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/index')
let expressPort = JSON.parse(DK.desktopApp.p2pNetworkClientIdentity.node.config).webPort;
express.startExpress(expressPort,SA);
console.log('express Interface ................................................ Listening at port ' + expressPort);

/*TODO change this to have a definite port number*/
let react = require('./frontend/scripts/start')
let reactPort = (+JSON.parse(DK.desktopApp.p2pNetworkClientIdentity.node.config).webPort + 1);
react.start(reactPort);
console.log('react Interface ................................................ Listening at port ' + reactPort);
}
}
}
Loading

0 comments on commit a95aaee

Please sign in to comment.