Rename project to allow previously existing desktop to coexist
This commit is contained in:
1 parent
2832cd657b
commit
38f7164dca
76 files changed
+3650
-168
No files matched your search
+12
-15
@@ -1,4 +1,3 @@
|
||||
const express = require("./backend/src/index");
|
||||
exports.newDesktopApp = function newDesktopApp() {
|
||||
|
||||
let thisObject = {
|
||||
@@ -54,28 +53,26 @@ exports.newDesktopApp = function newDesktopApp() {
|
||||
/*
|
||||
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
|
||||
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 receives events from 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() //
|
||||
thisObject.socialGraph = DK.projects.socialTrading.modules.socialGraph.newSocialTradingModulesSocialGraph()
|
||||
await thisObject.socialGraph.initialize()
|
||||
/*
|
||||
These are the Network Interfaces by which the Web App interacts with this Desktop Client.
|
||||
*/
|
||||
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)
|
||||
|
||||
|
||||
let express = require('./backend/src/index')
|
||||
let expressPort = JSON.parse(DK.desktopApp.p2pNetworkClient.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.p2pNetworkClient.node.config).webPort + 1);
|
||||
react.start(reactPort);
|
||||
console.log('react Interface ................................................ Listening at port ' + reactPort);
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/* Root object*/
|
||||
/* Root objects*/
|
||||
let UI = {
|
||||
projects: {},
|
||||
schemas: { projectSchema: undefined },
|
||||
environment: undefined,
|
||||
clientNode: undefined,
|
||||
webApp: undefined
|
||||
}
|
||||
|
||||
let SA = { projects: {} }
|
||||
/*
|
||||
We will use this to load functions originally intended for Nodejs
|
||||
*/
|
||||
let exports = {}
|
||||
|
||||
|
||||
+203
-153
@@ -5,7 +5,7 @@ function newWebApp() {
|
||||
Everything is being coded here until some structure emerges.
|
||||
*/
|
||||
let thisObject = {
|
||||
messageReceived: messageReceived,
|
||||
messageReceived: messageReceived,
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
@@ -29,180 +29,239 @@ function newWebApp() {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
function setupRootObject(rootObject, rootObjectName) {
|
||||
/!*
|
||||
Here we will setup the UI object, with all the
|
||||
projects and spaces.
|
||||
*!/
|
||||
for (let i = 0; i < UI.schemas.projectSchema.length; i++) {
|
||||
let projectDefinition = UI.schemas.projectSchema[i]
|
||||
rootObject.projects[projectDefinition.propertyName] = {}
|
||||
let projectInstance = rootObject.projects[projectDefinition.propertyName]
|
||||
function setupRootObject(rootObject, rootObjectName) {
|
||||
/*
|
||||
Here we will setup the UI object, with all the
|
||||
projects and spaces.
|
||||
*/
|
||||
for (let i = 0; i < UI.schemas.projectSchema.length; i++) {
|
||||
let projectDefinition = UI.schemas.projectSchema[i]
|
||||
rootObject.projects[projectDefinition.propertyName] = {}
|
||||
let projectInstance = rootObject.projects[projectDefinition.propertyName]
|
||||
|
||||
projectInstance.utilities = {}
|
||||
projectInstance.globals = {}
|
||||
projectInstance.functionLibraries = {}
|
||||
projectInstance.modules = {}
|
||||
projectInstance.utilities = {}
|
||||
projectInstance.globals = {}
|
||||
projectInstance.functionLibraries = {}
|
||||
projectInstance.modules = {}
|
||||
|
||||
if (projectDefinition[rootObjectName] === undefined) {
|
||||
continue
|
||||
}
|
||||
if (projectDefinition[rootObjectName] === undefined) { continue }
|
||||
|
||||
/!* Set up Globals of this Project *!/
|
||||
if (projectDefinition[rootObjectName].globals !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].globals.length; j++) {
|
||||
let globalDefinition = projectDefinition[rootObjectName].globals[j]
|
||||
/* Set up Globals of this Project */
|
||||
if (projectDefinition[rootObjectName].globals !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].globals.length; j++) {
|
||||
let globalDefinition = projectDefinition[rootObjectName].globals[j]
|
||||
|
||||
if (exports[globalDefinition.functionName] === undefined) {
|
||||
projectInstance.globals[globalDefinition.propertyName] = eval(globalDefinition.functionName + '()')
|
||||
} else {
|
||||
projectInstance.globals[globalDefinition.propertyName] = eval('exports.' + globalDefinition.functionName + '()')
|
||||
}
|
||||
if (exports[globalDefinition.functionName] === undefined) {
|
||||
projectInstance.globals[globalDefinition.propertyName] = eval(globalDefinition.functionName + '()')
|
||||
} else {
|
||||
projectInstance.globals[globalDefinition.propertyName] = eval('exports.' + globalDefinition.functionName + '()')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/!* Set up Utilities of this Project *!/
|
||||
if (projectDefinition[rootObjectName].utilities !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].utilities.length; j++) {
|
||||
let utilityDefinition = projectDefinition[rootObjectName].utilities[j]
|
||||
/* Set up Utilities of this Project */
|
||||
if (projectDefinition[rootObjectName].utilities !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].utilities.length; j++) {
|
||||
let utilityDefinition = projectDefinition[rootObjectName].utilities[j]
|
||||
|
||||
if (exports[utilityDefinition.functionName] === undefined) {
|
||||
projectInstance.utilities[utilityDefinition.propertyName] = eval(utilityDefinition.functionName + '()')
|
||||
} else {
|
||||
projectInstance.utilities[utilityDefinition.propertyName] = eval('exports.' + utilityDefinition.functionName + '()')
|
||||
}
|
||||
if (exports[utilityDefinition.functionName] === undefined) {
|
||||
projectInstance.utilities[utilityDefinition.propertyName] = eval(utilityDefinition.functionName + '()')
|
||||
} else {
|
||||
projectInstance.utilities[utilityDefinition.propertyName] = eval('exports.' + utilityDefinition.functionName + '()')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/!* Set up Function Libraries of this Project *!/
|
||||
if (projectDefinition[rootObjectName].functionLibraries !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].functionLibraries.length; j++) {
|
||||
let functionLibraryDefinition = projectDefinition[rootObjectName].functionLibraries[j]
|
||||
/* Set up Function Libraries of this Project */
|
||||
if (projectDefinition[rootObjectName].functionLibraries !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].functionLibraries.length; j++) {
|
||||
let functionLibraryDefinition = projectDefinition[rootObjectName].functionLibraries[j]
|
||||
|
||||
if (exports[functionLibraryDefinition.functionName] === undefined) {
|
||||
projectInstance.functionLibraries[functionLibraryDefinition.propertyName] = eval(functionLibraryDefinition.functionName + '()')
|
||||
} else {
|
||||
projectInstance.functionLibraries[functionLibraryDefinition.propertyName] = eval('exports.' + functionLibraryDefinition.functionName + '()')
|
||||
}
|
||||
if (exports[functionLibraryDefinition.functionName] === undefined) {
|
||||
projectInstance.functionLibraries[functionLibraryDefinition.propertyName] = eval(functionLibraryDefinition.functionName + '()')
|
||||
} else {
|
||||
projectInstance.functionLibraries[functionLibraryDefinition.propertyName] = eval('exports.' + functionLibraryDefinition.functionName + '()')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/!* Set up Modules of this Project *!/
|
||||
if (projectDefinition[rootObjectName].modules !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].modules.length; j++) {
|
||||
let functionLibraryDefinition = projectDefinition[rootObjectName].modules[j]
|
||||
/* Set up Modules of this Project */
|
||||
if (projectDefinition[rootObjectName].modules !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].modules.length; j++) {
|
||||
let functionLibraryDefinition = projectDefinition[rootObjectName].modules[j]
|
||||
|
||||
if (exports[functionLibraryDefinition.functionName] === undefined) {
|
||||
projectInstance.modules[functionLibraryDefinition.propertyName] = eval(functionLibraryDefinition.functionName + '()')
|
||||
} else {
|
||||
projectInstance.modules[functionLibraryDefinition.propertyName] = eval('exports.' + functionLibraryDefinition.functionName + '()')
|
||||
}
|
||||
if (exports[functionLibraryDefinition.functionName] === undefined) {
|
||||
projectInstance.modules[functionLibraryDefinition.propertyName] = eval(functionLibraryDefinition.functionName + '()')
|
||||
} else {
|
||||
projectInstance.modules[functionLibraryDefinition.propertyName] = eval('exports.' + functionLibraryDefinition.functionName + '()')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
async function loadWUserProfileTimeline() {
|
||||
let queryMessage = {
|
||||
queryType: SA.projects.socialTrading.globals.queryTypes.EVENTS,
|
||||
emitterUserProfileId: undefined,
|
||||
initialIndex: SA.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_LAST,
|
||||
amountRequested: 100,
|
||||
direction: SA.projects.socialTrading.globals.queryConstants.DIRECTION_PAST
|
||||
}
|
||||
async function loadWUserProfileTimeline() {
|
||||
let queryMessage = {
|
||||
queryType: SA.projects.socialTrading.globals.queryTypes.EVENTS,
|
||||
emitterUserProfileId: undefined,
|
||||
initialIndex: SA.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_LAST,
|
||||
amountRequested: 100,
|
||||
direction: SA.projects.socialTrading.globals.queryConstants.DIRECTION_PAST
|
||||
}
|
||||
|
||||
let query = {
|
||||
requestType: 'Query',
|
||||
queryMessage: JSON.stringify(queryMessage)
|
||||
}
|
||||
let query = {
|
||||
requestType: 'Query',
|
||||
queryMessage: JSON.stringify(queryMessage)
|
||||
}
|
||||
|
||||
await UI.projects.socialTrading.modules.webSocketsWebAppClient.sendMessage(
|
||||
JSON.stringify(query)
|
||||
)
|
||||
.then(console.log)
|
||||
.catch(onError)
|
||||
await UI.projects.socialTrading.modules.webSocketsWebAppClient.sendMessage(
|
||||
JSON.stringify(query)
|
||||
)
|
||||
.then(addToContentDiv)
|
||||
.catch(onError)
|
||||
|
||||
function onError(errorMessage) {
|
||||
console.log('[ERROR] Query not executed. ' + errorMessage)
|
||||
console.log('[ERROR] query = ' + JSON.stringify(query))
|
||||
}
|
||||
function onError(errorMessage) {
|
||||
console.log('[ERROR] Query not executed. ' + errorMessage)
|
||||
console.log('[ERROR] query = ' + JSON.stringify(query))
|
||||
}
|
||||
|
||||
function addToContentDiv(events) {
|
||||
try {
|
||||
let contentDiv = document.getElementById('content-div')
|
||||
/!*
|
||||
Delete al current content.
|
||||
*!/
|
||||
while (contentDiv.childNodes.length > 4) {
|
||||
let childToRemove = contentDiv.childNodes[contentDiv.childNodes.length - 1]
|
||||
contentDiv.removeChild(childToRemove)
|
||||
}
|
||||
/!*
|
||||
Render the timeline.
|
||||
*!/
|
||||
for (let i = 0; i < events.length; i++) {
|
||||
let event = events[i]
|
||||
function addToContentDiv(events) {
|
||||
try {
|
||||
let contentDiv = document.getElementById('content-div')
|
||||
/*
|
||||
Delete al current content.
|
||||
*/
|
||||
while (contentDiv.childNodes.length > 4) {
|
||||
let childToRemove = contentDiv.childNodes[contentDiv.childNodes.length - 1]
|
||||
contentDiv.removeChild(childToRemove)
|
||||
}
|
||||
/*
|
||||
Render the timeline.
|
||||
*/
|
||||
for (let i = 0; i < events.length; i++) {
|
||||
let event = events[i]
|
||||
|
||||
let postDiv = document.createElement("div")
|
||||
postDiv.setAttribute("class", "post-div")
|
||||
let textNode
|
||||
let postDiv = document.createElement("div")
|
||||
postDiv.setAttribute("class", "post-div")
|
||||
let textNode
|
||||
|
||||
switch (event.eventType) {
|
||||
case SA.projects.socialTrading.globals.eventTypes.NEW_USER_POST: {
|
||||
textNode = document.createTextNode(event.emitterUserProfile.userProfileHandle + " POSTED " + event.postText)
|
||||
break
|
||||
}
|
||||
case SA.projects.socialTrading.globals.eventTypes.FOLLOW_USER_PROFILE: {
|
||||
textNode = document.createTextNode(event.emitterUserProfile.userProfileHandle + " FOLLOWED " + event.targetUserProfile.userProfileHandle)
|
||||
break
|
||||
}
|
||||
case SA.projects.socialTrading.globals.eventTypes.UNFOLLOW_USER_PROFILE: {
|
||||
textNode = document.createTextNode(event.emitterUserProfile.userProfileHandle + " UNFOLLOWED " + event.targetUserProfile.userProfileHandle)
|
||||
break
|
||||
}
|
||||
switch (event.eventType) {
|
||||
case SA.projects.socialTrading.globals.eventTypes.NEW_USER_POST: {
|
||||
textNode = document.createTextNode(event.emitterUserProfile.userProfileHandle + " POSTED " + event.postText)
|
||||
break
|
||||
}
|
||||
case SA.projects.socialTrading.globals.eventTypes.FOLLOW_USER_PROFILE: {
|
||||
textNode = document.createTextNode(event.emitterUserProfile.userProfileHandle + " FOLLOWED " + event.targetUserProfile.userProfileHandle)
|
||||
break
|
||||
}
|
||||
case SA.projects.socialTrading.globals.eventTypes.UNFOLLOW_USER_PROFILE: {
|
||||
textNode = document.createTextNode(event.emitterUserProfile.userProfileHandle + " UNFOLLOWED " + event.targetUserProfile.userProfileHandle)
|
||||
break
|
||||
}
|
||||
|
||||
postDiv.appendChild(textNode)
|
||||
contentDiv.appendChild(postDiv)
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.log('[ERROR] err.stack = ' + err.stack)
|
||||
|
||||
postDiv.appendChild(textNode)
|
||||
contentDiv.appendChild(postDiv)
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
async function loadWhoToFollow() {
|
||||
let queryMessage = {
|
||||
queryType: SA.projects.socialTrading.globals.queryTypes.UNFOLLOWED_USER_PROFILES,
|
||||
emitterUserProfileId: undefined,
|
||||
initialIndex: SA.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_FIRST,
|
||||
amountRequested: 3,
|
||||
direction: SA.projects.socialTrading.globals.queryConstants.DIRECTION_UP
|
||||
}
|
||||
|
||||
let query = {
|
||||
requestType: 'Query',
|
||||
queryMessage: JSON.stringify(queryMessage)
|
||||
}
|
||||
|
||||
await UI.projects.socialTrading.modules.webSocketsWebAppClient.sendMessage(
|
||||
JSON.stringify(query)
|
||||
)
|
||||
.then(addWhoToFollowTable)
|
||||
.catch(onError)
|
||||
|
||||
function onError(errorMessage) {
|
||||
console.log('[ERROR] Query not executed. ' + errorMessage)
|
||||
console.log('[ERROR] query = ' + JSON.stringify(query))
|
||||
catch (err) {
|
||||
console.log('[ERROR] err.stack = ' + err.stack)
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
async function loadWhoToFollow() {
|
||||
let queryMessage = {
|
||||
queryType: SA.projects.socialTrading.globals.queryTypes.UNFOLLOWED_USER_PROFILES,
|
||||
emitterUserProfileId: undefined,
|
||||
initialIndex: SA.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_FIRST,
|
||||
amountRequested: 3,
|
||||
direction: SA.projects.socialTrading.globals.queryConstants.DIRECTION_UP
|
||||
}
|
||||
|
||||
let query = {
|
||||
requestType: 'Query',
|
||||
queryMessage: JSON.stringify(queryMessage)
|
||||
}
|
||||
|
||||
await UI.projects.socialTrading.modules.webSocketsWebAppClient.sendMessage(
|
||||
JSON.stringify(query)
|
||||
)
|
||||
.then(addWhoToFollowTable)
|
||||
.catch(onError)
|
||||
|
||||
function onError(errorMessage) {
|
||||
console.log('[ERROR] Query not executed. ' + errorMessage)
|
||||
console.log('[ERROR] query = ' + JSON.stringify(query))
|
||||
}
|
||||
|
||||
function addWhoToFollowTable(profiles) {
|
||||
|
||||
let contextCell = document.getElementById('who-to-follow-cell')
|
||||
let table = document.createElement("table")
|
||||
let tblBody = document.createElement("tbody")
|
||||
|
||||
for (let i = 0; i < profiles.length; i++) {
|
||||
let profile = profiles[i]
|
||||
let row = document.createElement("tr")
|
||||
|
||||
let cell = document.createElement("td")
|
||||
addProfileToFollowTable(cell, profile)
|
||||
row.appendChild(cell)
|
||||
|
||||
tblBody.appendChild(row)
|
||||
}
|
||||
|
||||
table.appendChild(tblBody)
|
||||
contextCell.appendChild(table)
|
||||
table.setAttribute("class", "who-to-follow-table")
|
||||
|
||||
function addProfileToFollowTable(htmlElement, profile) {
|
||||
let table = document.createElement("table")
|
||||
let tblBody = document.createElement("tbody")
|
||||
|
||||
let row = document.createElement("tr")
|
||||
|
||||
{
|
||||
let cell = document.createElement("td")
|
||||
let textNode = document.createTextNode('Profile Picture')
|
||||
cell.appendChild(textNode)
|
||||
row.appendChild(cell)
|
||||
}
|
||||
{
|
||||
let cell = document.createElement("td")
|
||||
let textNode = document.createTextNode(profile.userProfileHandle)
|
||||
cell.appendChild(textNode)
|
||||
row.appendChild(cell)
|
||||
}
|
||||
{
|
||||
let cell = document.createElement("td")
|
||||
let span = document.createElement("span")
|
||||
let button = document.createElement("button")
|
||||
let text = document.createTextNode('Follow')
|
||||
|
||||
span.setAttribute("id", "profile-to-follow-span-" + profile.userProfileId)
|
||||
button.setAttribute("id", "profile-to-follow-button-" + profile.userProfileId)
|
||||
button.name = 'Follow Profile'
|
||||
button.userProfileId = profile.userProfileId
|
||||
|
||||
span.setAttribute("class", "profile-to-follow-span")
|
||||
button.setAttribute("class", "profile-to-follow-button")
|
||||
|
||||
button.appendChild(text)
|
||||
span.appendChild(button)
|
||||
cell.appendChild(span)
|
||||
row.appendChild(cell)
|
||||
}
|
||||
|
||||
tblBody.appendChild(row)
|
||||
|
||||
table.appendChild(tblBody)
|
||||
htmlElement.appendChild(table)
|
||||
table.setAttribute("class", "profile-to-follow-table")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setupEventHandlers() {
|
||||
/*
|
||||
@@ -226,7 +285,6 @@ function newWebApp() {
|
||||
function updateTextArea() {
|
||||
textArea.value = ""
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
case 'Follow Profile': {
|
||||
@@ -244,7 +302,6 @@ function newWebApp() {
|
||||
button.setAttribute("class", "profile-to-unfollow-button")
|
||||
button.name = 'Unfollow Profile'
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
case 'Unfollow Profile': {
|
||||
@@ -255,7 +312,6 @@ function newWebApp() {
|
||||
.then(updateButton)
|
||||
.catch(onError)
|
||||
|
||||
/*
|
||||
function updateButton() {
|
||||
let span = document.getElementById('profile-to-follow-span-' + event.target.userProfileId)
|
||||
let button = document.getElementById('profile-to-follow-button-' + event.target.userProfileId)
|
||||
@@ -263,8 +319,6 @@ function newWebApp() {
|
||||
button.setAttribute("class", "profile-to-follow-button")
|
||||
button.name = 'Follow Profile'
|
||||
}
|
||||
*/
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -289,9 +343,7 @@ function newWebApp() {
|
||||
eventType
|
||||
) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
asyncCall(resolve, reject)
|
||||
})
|
||||
return new Promise((resolve, reject) => { asyncCall(resolve, reject) })
|
||||
|
||||
async function asyncCall(resolve, reject) {
|
||||
let eventMessage
|
||||
@@ -327,9 +379,7 @@ function newWebApp() {
|
||||
postText
|
||||
) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
asyncCall(resolve, reject)
|
||||
})
|
||||
return new Promise((resolve, reject) => { asyncCall(resolve, reject) })
|
||||
|
||||
async function asyncCall(resolve, reject) {
|
||||
let eventMessage
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
|
||||
function newWebAppLoader() {
|
||||
|
||||
let thisObject = {
|
||||
loadModules: loadModules
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
async function loadModules() {
|
||||
try {
|
||||
let modulesArray = [
|
||||
'WebDebugLog.js',
|
||||
'WebApp.js'
|
||||
]
|
||||
|
||||
for (let i = 0; i < UI.schemas.projectSchema.length; i++) {
|
||||
let project = UI.schemas.projectSchema[i]
|
||||
|
||||
if (project.UI !== undefined) {
|
||||
if (project.UI.functionLibraries !== undefined) {
|
||||
for (let j = 0; j < project.UI.functionLibraries.length; j++) {
|
||||
let fileName = project.UI.functionLibraries[j].fileName
|
||||
if (fileName === undefined) {fileName = project.UI.functionLibraries[j].name.replaceAll(' ', '') + '.js'}
|
||||
modulesArray.push('Projects' + '/' + project.name + '/' + 'UI' + '/' + 'Function-Libraries' + '/' + fileName)
|
||||
}
|
||||
}
|
||||
if (project.UI.utilities !== undefined) {
|
||||
for (let j = 0; j < project.UI.utilities.length; j++) {
|
||||
let fileName = project.UI.utilities[j].fileName
|
||||
if (fileName === undefined) {fileName = project.UI.utilities[j].name.replaceAll(' ', '') + '.js'}
|
||||
modulesArray.push('Projects' + '/' + project.name + '/' + 'UI' + '/' + 'Utilities' + '/' + fileName)
|
||||
}
|
||||
}
|
||||
if (project.UI.globals !== undefined) {
|
||||
for (let j = 0; j < project.UI.globals.length; j++) {
|
||||
let fileName = project.UI.globals[j].fileName
|
||||
if (fileName === undefined) {fileName = project.UI.globals[j].name.replaceAll(' ', '') + '.js'}
|
||||
modulesArray.push('Projects' + '/' + project.name + '/' + 'UI' + '/' + 'Globals' + '/' + fileName)
|
||||
}
|
||||
}
|
||||
if (project.UI.modules !== undefined) {
|
||||
for (let j = 0; j < project.UI.modules.length; j++) {
|
||||
let fileName = project.UI.modules[j].fileName
|
||||
if (fileName === undefined) {fileName = project.UI.modules[j].name.replaceAll(' ', '') + '.js'}
|
||||
modulesArray.push('Projects' + '/' + project.name + '/' + 'UI' + '/' + 'Modules' + '/' + fileName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (project.SA !== undefined) {
|
||||
if (project.SA.functionLibraries !== undefined) {
|
||||
for (let j = 0; j < project.SA.functionLibraries.length; j++) {
|
||||
let fileName = project.SA.functionLibraries[j].fileName
|
||||
if (fileName === undefined) {fileName = project.SA.functionLibraries[j].name.replaceAll(' ', '') + '.js'}
|
||||
modulesArray.push('Projects' + '/' + project.name + '/' + 'SA' + '/' + 'Function-Libraries' + '/' + fileName)
|
||||
}
|
||||
}
|
||||
if (project.SA.utilities !== undefined) {
|
||||
for (let j = 0; j < project.SA.utilities.length; j++) {
|
||||
let fileName = project.SA.utilities[j].fileName
|
||||
if (fileName === undefined) {fileName = project.SA.utilities[j].name.replaceAll(' ', '') + '.js'}
|
||||
modulesArray.push('Projects' + '/' + project.name + '/' + 'SA' + '/' + 'Utilities' + '/' + fileName)
|
||||
}
|
||||
}
|
||||
if (project.SA.globals !== undefined) {
|
||||
for (let j = 0; j < project.SA.globals.length; j++) {
|
||||
let fileName = project.SA.globals[j].fileName
|
||||
if (fileName === undefined) {fileName = project.SA.globals[j].name.replaceAll(' ', '') + '.js'}
|
||||
modulesArray.push('Projects' + '/' + project.name + '/' + 'SA' + '/' + 'Globals' + '/' + fileName)
|
||||
}
|
||||
}
|
||||
if (project.SA.modules !== undefined) {
|
||||
for (let j = 0; j < project.SA.modules.length; j++) {
|
||||
let fileName = project.SA.modules[j].fileName
|
||||
if (fileName === undefined) {fileName = project.SA.modules[j].name.replaceAll(' ', '') + '.js'}
|
||||
modulesArray.push('Projects' + '/' + project.name + '/' + 'SA' + '/' + 'Modules' + '/' + fileName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
downloadIncludedFiles()
|
||||
|
||||
function downloadIncludedFiles() {
|
||||
|
||||
let downloadedCounter = 0
|
||||
|
||||
for (let i = 0; i < modulesArray.length; i++) {
|
||||
let path = modulesArray[i]
|
||||
|
||||
REQUIREJS([path], onRequired)
|
||||
|
||||
function onRequired(pModule) {
|
||||
try {
|
||||
|
||||
downloadedCounter++
|
||||
|
||||
if (downloadedCounter === modulesArray.length) {
|
||||
setTimeout(() => {
|
||||
UI.webApp = newWebApp()
|
||||
UI.webApp.initialize()
|
||||
}, 500)
|
||||
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('[ERROR] loadModules -> onRequired -> err = ' + err.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (err) {
|
||||
console.log('[ERROR] loadModules -> err = ' + err.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
|
||||
function loadSuperalgos() {
|
||||
|
||||
let browser = checkBrowserVersion()
|
||||
if ((browser.name !== "Chrome" && browser.name !== "Safari") || (browser.name === "Chrome" && parseInt(browser.version) < 85) || (browser.name === "Safari" && parseInt(browser.version) < 13)) {
|
||||
alert("Superalgos is officially supported on Google Chrome 85 or Safari 13.1 and above. Your browser version has been detected as potentially beneath this. If you continue you may experience some functionaility issues.\n\nDetected Browser: " + browser.name + "\nVersion: " + browser.version)
|
||||
}
|
||||
|
||||
loadGlobals()
|
||||
|
||||
function loadGlobals() {
|
||||
let path = "Globals.js"
|
||||
REQUIREJS([path], onRequired)
|
||||
|
||||
function onRequired(pModule) {
|
||||
setupEnvironment()
|
||||
}
|
||||
}
|
||||
|
||||
function setupEnvironment() {
|
||||
httpRequest(undefined, 'Environment', onResponse)
|
||||
|
||||
function onResponse(err, file) {
|
||||
UI.environment = JSON.parse(file)
|
||||
setupClientNode()
|
||||
}
|
||||
}
|
||||
|
||||
function setupClientNode() {
|
||||
httpRequest(undefined, 'ClientNode', onResponse)
|
||||
|
||||
function onResponse(err, file) {
|
||||
UI.clientNode = JSON.parse(file)
|
||||
setupProjectsSchema()
|
||||
}
|
||||
}
|
||||
|
||||
function setupProjectsSchema() {
|
||||
httpRequest(undefined, 'ProjectsSchema', onResponse)
|
||||
|
||||
function onResponse(err, file) {
|
||||
UI.schemas.projectSchema = JSON.parse(file)
|
||||
loadModules()
|
||||
}
|
||||
}
|
||||
|
||||
function loadModules() {
|
||||
let path = "WebAppLoader.js"
|
||||
REQUIREJS([path], onRequired)
|
||||
|
||||
function onRequired(pModule) {
|
||||
let APP_LOADER_MODULE = newWebAppLoader()
|
||||
APP_LOADER_MODULE.loadModules()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function httpRequest(pContentToSend, pPath, callBackFunction) {
|
||||
let xmlHttpRequest = new XMLHttpRequest()
|
||||
xmlHttpRequest.onreadystatechange = function () {
|
||||
if (this.readyState === 4 && this.status === 200) {
|
||||
try {
|
||||
callBackFunction(undefined, xmlHttpRequest.responseText)
|
||||
} catch (err) {
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> pContentToSend = ' + pContentToSend)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> pPath = ' + pPath)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> xmlHttpRequest.responseText = ' + xmlHttpRequest.responseText)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> callBackFunction = ' + callBackFunction)
|
||||
|
||||
}
|
||||
return
|
||||
} else if (this.readyState === 4 && this.status === 404) {
|
||||
callBackFunction({ result: "Fail", message: xmlHttpRequest.responseText.trim(), code: xmlHttpRequest.responseText.trim() })
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (pContentToSend === undefined) {
|
||||
xmlHttpRequest.open("GET", pPath, true)
|
||||
xmlHttpRequest.send()
|
||||
} else {
|
||||
try {
|
||||
let blob = new Blob([pContentToSend], { type: 'text/plain' })
|
||||
xmlHttpRequest.open("POST", pPath, true)
|
||||
xmlHttpRequest.send(blob)
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { console.log("[ERROR] callServer -> err.message = " + err.message) }
|
||||
callBackFunction({ result: "Fail", message: err.message })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkBrowserVersion() {
|
||||
|
||||
let ua = navigator.userAgent, tem, M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []
|
||||
if (/trident/i.test(M[1])) {
|
||||
tem = /\brv[ :]+(\d+)/g.exec(ua) || []
|
||||
return { name: 'IE', version: (tem[1] || '') }
|
||||
}
|
||||
if (M[1] === 'Chrome') {
|
||||
tem = ua.match(/\bOPR|Edge\/(\d+)/)
|
||||
if (tem != null) { return { name: 'Opera', version: tem[1] } }
|
||||
}
|
||||
M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?']
|
||||
if ((tem = ua.match(/version\/(\d+)/i)) != null) { M.splice(1, 1, tem[1]) }
|
||||
return {
|
||||
name: M[0],
|
||||
version: M[1]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
function newWebDebugLog() {
|
||||
try {
|
||||
let thisObject = {
|
||||
write: write,
|
||||
fileName: 'undefined'
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function write(pText) {
|
||||
console.log(spacePad(thisObject.fileName, 50) + ' : ' + pText)
|
||||
|
||||
function spacePad(str, max) {
|
||||
str = str.toString()
|
||||
return str.length < max ? spacePad(' ' + str, max) : str
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(spacePad(MODULE_NAME, 50) + ' : ' + '[ERROR] WebDebugLog --> err = ' + err.stack)
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,164 @@
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Superalgos Desktop</title>
|
||||
<meta name="description" content="Free and Open Source Crypto Social Trading">
|
||||
<link rel="stylesheet" href="main.css" type="text/css" charset="utf-8" />
|
||||
<link rel="shortcut icon" type="image/png/ico" href="Images/favicon.ico" />
|
||||
<script type="text/javascript" src="Require.js"></script>
|
||||
<script type="text/javascript" src="WebAppPreLoader.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function loadApp() {
|
||||
// Prevent click-jacking
|
||||
try {
|
||||
if (window == window.top || window.chrome && chrome.app && chrome.app.window) {
|
||||
document.documentElement.style.display = 'block'
|
||||
} else {
|
||||
top.location = self.location
|
||||
}
|
||||
} catch (e) { console.error('CJ protection', e) }
|
||||
|
||||
try {
|
||||
loadSuperalgos()
|
||||
} catch (err) {
|
||||
console.log("[ERROR] UI can not be started. Please check that WebServer is running.", err);
|
||||
}
|
||||
}
|
||||
|
||||
function onResize() {
|
||||
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body id="body" onload="loadApp()" onresize="onResize()" class="body">
|
||||
|
||||
<div id="scroll-div" class="scroll-div">
|
||||
<div id="static-div" class="static-div">
|
||||
<table id="page-table" class="page-table">
|
||||
<tr>
|
||||
<td class="left-column">
|
||||
<table class="left-table">
|
||||
<tr>
|
||||
<td class="logo-cell">LOGO</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-cell">
|
||||
<table class="menu-table">
|
||||
<tr>
|
||||
<td class="menu-item-cell">Home</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-item-cell">Explore</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-item-cell">Notifications</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-item-cell">Messages</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-item-cell">Bookmarks</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-item-cell">Lists</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-item-cell">Profile</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-item-cell">More</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="menu-item-cell">Post</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="profile-cell">PROFILE</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="middle-column">
|
||||
<table class="middle-table">
|
||||
<tr>
|
||||
<td class="content-title-cell">CONTENT TITLE</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="content-cell">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="right-column">
|
||||
<table class="right-table">
|
||||
<tr>
|
||||
<td class="search-cell">SEARCH</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="context-cell">
|
||||
<table class="context-table">
|
||||
<tr>
|
||||
<td>Who to follow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td id="who-to-follow-cell">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Show more</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>>
|
||||
<div id="content-div" class="content-div">
|
||||
<div id="post-placeholder" class="post-placeholder">
|
||||
Placeholder
|
||||
</div>
|
||||
<div id="new-post-div" class="new-post-div">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Profile Pic</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<textarea id="new-post-text-area">Type your post here...</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Permissions</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Tool Bar <button name="New Post">POST</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="post-div">
|
||||
POST 2
|
||||
</div>
|
||||
<div class="post-div">
|
||||
POST 3
|
||||
</div>
|
||||
<div class="post-div">
|
||||
POST 4
|
||||
</div>
|
||||
<div class="post-div">
|
||||
POST 5
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,81 @@
|
||||
const express = require("./backend/src/index");
|
||||
exports.newDesktopApp = function newDesktopApp() {
|
||||
|
||||
let thisObject = {
|
||||
userProfiles: undefined,
|
||||
p2pNetworkClient: 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.p2pNetworkClient = SA.projects.network.modules.p2pNetworkClient.newNetworkModulesP2PNetworkClient()
|
||||
await thisObject.p2pNetworkClient.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)
|
||||
/*
|
||||
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.p2pNetworkClient,
|
||||
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.p2pNetworkClient.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.p2pNetworkClient.node.config).webPort + 1);
|
||||
react.start(reactPort);
|
||||
console.log('react Interface ................................................ Listening at port ' + reactPort);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,367 @@
|
||||
function newWebApp() {
|
||||
/*
|
||||
In it's current state of development, the Web App only has one module.
|
||||
|
||||
Everything is being coded here until some structure emerges.
|
||||
*/
|
||||
let thisObject = {
|
||||
messageReceived: messageReceived,
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
}
|
||||
|
||||
return thisObject
|
||||
|
||||
function finalize() {
|
||||
|
||||
}
|
||||
|
||||
async function initialize() {
|
||||
try {
|
||||
setupRootObject(UI, 'UI')
|
||||
setupRootObject(SA, 'SA')
|
||||
await UI.projects.socialTrading.modules.webSocketsWebAppClient.initialize()
|
||||
loadWUserProfileTimeline()
|
||||
loadWhoToFollow()
|
||||
setupEventHandlers()
|
||||
} catch (err) {
|
||||
console.log('[ERROR] initialize -> err.stack = ' + err.stack)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
function setupRootObject(rootObject, rootObjectName) {
|
||||
/!*
|
||||
Here we will setup the UI object, with all the
|
||||
projects and spaces.
|
||||
*!/
|
||||
for (let i = 0; i < UI.schemas.projectSchema.length; i++) {
|
||||
let projectDefinition = UI.schemas.projectSchema[i]
|
||||
rootObject.projects[projectDefinition.propertyName] = {}
|
||||
let projectInstance = rootObject.projects[projectDefinition.propertyName]
|
||||
|
||||
projectInstance.utilities = {}
|
||||
projectInstance.globals = {}
|
||||
projectInstance.functionLibraries = {}
|
||||
projectInstance.modules = {}
|
||||
|
||||
if (projectDefinition[rootObjectName] === undefined) {
|
||||
continue
|
||||
}
|
||||
|
||||
/!* Set up Globals of this Project *!/
|
||||
if (projectDefinition[rootObjectName].globals !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].globals.length; j++) {
|
||||
let globalDefinition = projectDefinition[rootObjectName].globals[j]
|
||||
|
||||
if (exports[globalDefinition.functionName] === undefined) {
|
||||
projectInstance.globals[globalDefinition.propertyName] = eval(globalDefinition.functionName + '()')
|
||||
} else {
|
||||
projectInstance.globals[globalDefinition.propertyName] = eval('exports.' + globalDefinition.functionName + '()')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/!* Set up Utilities of this Project *!/
|
||||
if (projectDefinition[rootObjectName].utilities !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].utilities.length; j++) {
|
||||
let utilityDefinition = projectDefinition[rootObjectName].utilities[j]
|
||||
|
||||
if (exports[utilityDefinition.functionName] === undefined) {
|
||||
projectInstance.utilities[utilityDefinition.propertyName] = eval(utilityDefinition.functionName + '()')
|
||||
} else {
|
||||
projectInstance.utilities[utilityDefinition.propertyName] = eval('exports.' + utilityDefinition.functionName + '()')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/!* Set up Function Libraries of this Project *!/
|
||||
if (projectDefinition[rootObjectName].functionLibraries !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].functionLibraries.length; j++) {
|
||||
let functionLibraryDefinition = projectDefinition[rootObjectName].functionLibraries[j]
|
||||
|
||||
if (exports[functionLibraryDefinition.functionName] === undefined) {
|
||||
projectInstance.functionLibraries[functionLibraryDefinition.propertyName] = eval(functionLibraryDefinition.functionName + '()')
|
||||
} else {
|
||||
projectInstance.functionLibraries[functionLibraryDefinition.propertyName] = eval('exports.' + functionLibraryDefinition.functionName + '()')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/!* Set up Modules of this Project *!/
|
||||
if (projectDefinition[rootObjectName].modules !== undefined) {
|
||||
for (let j = 0; j < projectDefinition[rootObjectName].modules.length; j++) {
|
||||
let functionLibraryDefinition = projectDefinition[rootObjectName].modules[j]
|
||||
|
||||
if (exports[functionLibraryDefinition.functionName] === undefined) {
|
||||
projectInstance.modules[functionLibraryDefinition.propertyName] = eval(functionLibraryDefinition.functionName + '()')
|
||||
} else {
|
||||
projectInstance.modules[functionLibraryDefinition.propertyName] = eval('exports.' + functionLibraryDefinition.functionName + '()')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
async function loadWUserProfileTimeline() {
|
||||
let queryMessage = {
|
||||
queryType: SA.projects.socialTrading.globals.queryTypes.EVENTS,
|
||||
emitterUserProfileId: undefined,
|
||||
initialIndex: SA.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_LAST,
|
||||
amountRequested: 100,
|
||||
direction: SA.projects.socialTrading.globals.queryConstants.DIRECTION_PAST
|
||||
}
|
||||
|
||||
let query = {
|
||||
requestType: 'Query',
|
||||
queryMessage: JSON.stringify(queryMessage)
|
||||
}
|
||||
|
||||
await UI.projects.socialTrading.modules.webSocketsWebAppClient.sendMessage(
|
||||
JSON.stringify(query)
|
||||
)
|
||||
.then(console.log)
|
||||
.catch(onError)
|
||||
|
||||
function onError(errorMessage) {
|
||||
console.log('[ERROR] Query not executed. ' + errorMessage)
|
||||
console.log('[ERROR] query = ' + JSON.stringify(query))
|
||||
}
|
||||
|
||||
function addToContentDiv(events) {
|
||||
try {
|
||||
let contentDiv = document.getElementById('content-div')
|
||||
/!*
|
||||
Delete al current content.
|
||||
*!/
|
||||
while (contentDiv.childNodes.length > 4) {
|
||||
let childToRemove = contentDiv.childNodes[contentDiv.childNodes.length - 1]
|
||||
contentDiv.removeChild(childToRemove)
|
||||
}
|
||||
/!*
|
||||
Render the timeline.
|
||||
*!/
|
||||
for (let i = 0; i < events.length; i++) {
|
||||
let event = events[i]
|
||||
|
||||
let postDiv = document.createElement("div")
|
||||
postDiv.setAttribute("class", "post-div")
|
||||
let textNode
|
||||
|
||||
switch (event.eventType) {
|
||||
case SA.projects.socialTrading.globals.eventTypes.NEW_USER_POST: {
|
||||
textNode = document.createTextNode(event.emitterUserProfile.userProfileHandle + " POSTED " + event.postText)
|
||||
break
|
||||
}
|
||||
case SA.projects.socialTrading.globals.eventTypes.FOLLOW_USER_PROFILE: {
|
||||
textNode = document.createTextNode(event.emitterUserProfile.userProfileHandle + " FOLLOWED " + event.targetUserProfile.userProfileHandle)
|
||||
break
|
||||
}
|
||||
case SA.projects.socialTrading.globals.eventTypes.UNFOLLOW_USER_PROFILE: {
|
||||
textNode = document.createTextNode(event.emitterUserProfile.userProfileHandle + " UNFOLLOWED " + event.targetUserProfile.userProfileHandle)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
postDiv.appendChild(textNode)
|
||||
contentDiv.appendChild(postDiv)
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.log('[ERROR] err.stack = ' + err.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
async function loadWhoToFollow() {
|
||||
let queryMessage = {
|
||||
queryType: SA.projects.socialTrading.globals.queryTypes.UNFOLLOWED_USER_PROFILES,
|
||||
emitterUserProfileId: undefined,
|
||||
initialIndex: SA.projects.socialTrading.globals.queryConstants.INITIAL_INDEX_FIRST,
|
||||
amountRequested: 3,
|
||||
direction: SA.projects.socialTrading.globals.queryConstants.DIRECTION_UP
|
||||
}
|
||||
|
||||
let query = {
|
||||
requestType: 'Query',
|
||||
queryMessage: JSON.stringify(queryMessage)
|
||||
}
|
||||
|
||||
await UI.projects.socialTrading.modules.webSocketsWebAppClient.sendMessage(
|
||||
JSON.stringify(query)
|
||||
)
|
||||
.then(addWhoToFollowTable)
|
||||
.catch(onError)
|
||||
|
||||
function onError(errorMessage) {
|
||||
console.log('[ERROR] Query not executed. ' + errorMessage)
|
||||
console.log('[ERROR] query = ' + JSON.stringify(query))
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
function setupEventHandlers() {
|
||||
/*
|
||||
Add events to process button clicks , and mouseWheel.
|
||||
*/
|
||||
document.addEventListener("click", onClick)
|
||||
document.addEventListener('mousewheel', onMouseWheel, false)
|
||||
|
||||
async function onClick(event) {
|
||||
|
||||
if (event.target && event.target.nodeName === "BUTTON") {
|
||||
switch (event.target.name) {
|
||||
case 'New Post': {
|
||||
let textArea = document.getElementById("new-post-text-area")
|
||||
await sendNewPostEvent(
|
||||
textArea.value
|
||||
)
|
||||
.then(updateTextArea)
|
||||
.catch(onError)
|
||||
|
||||
function updateTextArea() {
|
||||
textArea.value = ""
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
case 'Follow Profile': {
|
||||
await sendTargetUserProfileEvent(
|
||||
event.target.userProfileId,
|
||||
SA.projects.socialTrading.globals.eventTypes.FOLLOW_USER_PROFILE
|
||||
)
|
||||
.then(updateButton)
|
||||
.catch(onError)
|
||||
|
||||
function updateButton() {
|
||||
let span = document.getElementById('profile-to-follow-span-' + event.target.userProfileId)
|
||||
let button = document.getElementById('profile-to-follow-button-' + event.target.userProfileId)
|
||||
span.setAttribute("class", "profile-to-unfollow-span")
|
||||
button.setAttribute("class", "profile-to-unfollow-button")
|
||||
button.name = 'Unfollow Profile'
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
case 'Unfollow Profile': {
|
||||
await sendTargetUserProfileEvent(
|
||||
event.target.userProfileId,
|
||||
SA.projects.socialTrading.globals.eventTypes.UNFOLLOW_USER_PROFILE
|
||||
)
|
||||
.then(updateButton)
|
||||
.catch(onError)
|
||||
|
||||
/*
|
||||
function updateButton() {
|
||||
let span = document.getElementById('profile-to-follow-span-' + event.target.userProfileId)
|
||||
let button = document.getElementById('profile-to-follow-button-' + event.target.userProfileId)
|
||||
span.setAttribute("class", "profile-to-follow-span")
|
||||
button.setAttribute("class", "profile-to-follow-button")
|
||||
button.name = 'Follow Profile'
|
||||
}
|
||||
*/
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Error Handling
|
||||
*/
|
||||
function onError(errorMessage) {
|
||||
console.log('[ERROR] Click event failed. ' + errorMessage)
|
||||
}
|
||||
}
|
||||
|
||||
function onMouseWheel(event) {
|
||||
let scrollDiv = document.getElementById("scroll-div")
|
||||
scrollDiv.scrollTop = scrollDiv.scrollTop + event.deltaY
|
||||
}
|
||||
}
|
||||
|
||||
async function sendTargetUserProfileEvent(
|
||||
userProfileId,
|
||||
eventType
|
||||
) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
asyncCall(resolve, reject)
|
||||
})
|
||||
|
||||
async function asyncCall(resolve, reject) {
|
||||
let eventMessage
|
||||
let event
|
||||
|
||||
eventMessage = {
|
||||
eventType: eventType,
|
||||
eventId: SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId(),
|
||||
targetUserProfileId: userProfileId,
|
||||
timestamp: (new Date()).valueOf()
|
||||
}
|
||||
|
||||
event = {
|
||||
requestType: 'Event',
|
||||
eventMessage: JSON.stringify(eventMessage)
|
||||
}
|
||||
|
||||
await UI.projects.socialTrading.modules.webSocketsWebAppClient.sendMessage(
|
||||
JSON.stringify(event)
|
||||
)
|
||||
.then(resolve)
|
||||
.catch(onError)
|
||||
|
||||
function onError(errorMessage) {
|
||||
console.log('[ERROR] Event not executed. ' + errorMessage)
|
||||
console.log('[ERROR] event = ' + JSON.stringify(event))
|
||||
reject(errorMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function sendNewPostEvent(
|
||||
postText
|
||||
) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
asyncCall(resolve, reject)
|
||||
})
|
||||
|
||||
async function asyncCall(resolve, reject) {
|
||||
let eventMessage
|
||||
let event
|
||||
|
||||
eventMessage = {
|
||||
eventType: SA.projects.socialTrading.globals.eventTypes.NEW_USER_POST,
|
||||
eventId: SA.projects.foundations.utilities.miscellaneousFunctions.genereteUniqueId(),
|
||||
postText: postText,
|
||||
timestamp: (new Date()).valueOf()
|
||||
}
|
||||
|
||||
event = {
|
||||
requestType: 'Event',
|
||||
eventMessage: JSON.stringify(eventMessage)
|
||||
}
|
||||
|
||||
await UI.projects.socialTrading.modules.webSocketsWebAppClient.sendMessage(
|
||||
JSON.stringify(event)
|
||||
)
|
||||
.then(resolve)
|
||||
.catch(onError)
|
||||
|
||||
function onError(errorMessage) {
|
||||
console.log('[ERROR] Event not executed. ' + errorMessage)
|
||||
console.log('[ERROR] event = ' + JSON.stringify(event))
|
||||
reject(errorMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function messageReceived(message) {
|
||||
window.alert(message)
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,309 @@
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Saira';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Saira Light'), local('Saira-Light'), url(Fonts/Saira.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
/* latin */
|
||||
@font-face {
|
||||
font-family: 'Saira Condensed';
|
||||
font-style: normal;
|
||||
font-weight: 300;
|
||||
src: local('Saira Condensed Light'), local('SairaCondensed-Light'), url(Fonts/Saira-Condensed.woff2) format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: segoeui;
|
||||
src: url(Fonts/segoeui.woff) format('woff');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.body{
|
||||
overflow-y: hidden;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.scroll-div {
|
||||
position:absolute;
|
||||
overflow-y: scroll;
|
||||
overflow-x: hidden;
|
||||
top:0px;
|
||||
left:0px;
|
||||
vertical-align: top;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
color: #000;
|
||||
border-color: blue;
|
||||
background-color: transparent;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.static-div {
|
||||
position: fixed;
|
||||
top:0px;
|
||||
left:18%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
background:transparent;
|
||||
border-width: 0px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.content-div {
|
||||
position:relative;
|
||||
vertical-align: top;
|
||||
height: 100%;
|
||||
width: 30%;
|
||||
left: 31.2%;
|
||||
color: #000;
|
||||
border-color: blue;
|
||||
background-color:transparent;
|
||||
border-width: 1px;
|
||||
}
|
||||
|
||||
.post-placeholder {
|
||||
vertical-align: top;
|
||||
height: 50px;
|
||||
width: 100%;
|
||||
color: #000;
|
||||
border-color: blue;
|
||||
background-color: transparent;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.post-div {
|
||||
vertical-align: top;
|
||||
height: 300px;
|
||||
width: 100%;
|
||||
color: #000;
|
||||
border-color: blue;
|
||||
background-color: transparent;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.new-post-div {
|
||||
vertical-align: top;
|
||||
height: 300px;
|
||||
width: 100%;
|
||||
color: #000;
|
||||
border-color: blue;
|
||||
background-color: transparent;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.page-table {
|
||||
top:0px;
|
||||
left:18%;
|
||||
width: 64%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
background:transparent;
|
||||
border-width: 0px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.left-column {
|
||||
position:relative;
|
||||
top:0px;
|
||||
width: 20%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.middle-column {
|
||||
position:relative;
|
||||
top:0px;
|
||||
width: 50%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.right-column {
|
||||
position:relative;
|
||||
top:0px;
|
||||
left:0px;
|
||||
width: 30%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.left-table {
|
||||
position:relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.logo-cell {
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
height: 70px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.menu-cell {
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.profile-cell {
|
||||
vertical-align: bottom;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.middle-table {
|
||||
position:relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.content-title-cell {
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.content-cell {
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.right-table {
|
||||
position:relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.search-cell {
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.context-cell {
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
background:transparent;
|
||||
}
|
||||
|
||||
.menu-table {
|
||||
position:relative;
|
||||
width: 100%;
|
||||
height: 65%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.menu-item-cell {
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
}
|
||||
|
||||
.who-to-follow-table {
|
||||
position:relative;
|
||||
width: 100%;
|
||||
height: 30%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.profile-to-follow-table {
|
||||
position:relative;
|
||||
width: 100%;
|
||||
height: 30%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
color: #000;
|
||||
border-width: 0px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.profile-to-follow-span {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.profile-to-follow-button {
|
||||
float: right;
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
.profile-to-unfollow-span {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.profile-to-unfollow-button {
|
||||
float: right;
|
||||
background-color: red;
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,86 @@
|
||||
exports.newDesktopRoot = function newDesktopRoot() {
|
||||
/*
|
||||
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')
|
||||
}
|
||||
/*
|
||||
Setting up Secrets.
|
||||
*/
|
||||
try {
|
||||
SA.secrets = {
|
||||
array: require('./My-Secrets/Secrets.json').secrets,
|
||||
map: new Map()
|
||||
}
|
||||
} catch (err) {
|
||||
SA.secrets = {
|
||||
array: [],
|
||||
map: new Map()
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < SA.secrets.array.length; i++) {
|
||||
let secret = SA.secrets.array[i]
|
||||
SA.secrets.map.set(secret.nodeCodeName, secret)
|
||||
}
|
||||
|
||||
run()
|
||||
|
||||
async function run() {
|
||||
DK.app = require('./DesktopReact/DesktopApp.js').newDesktopApp()
|
||||
await DK.app.run()
|
||||
console.log('Superalgos Desktop App is Running!')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
The Superalgos Desktop is one of the 3 clients of the Superalgos P2P Network:
|
||||
|
||||
* Superalgos Mobile
|
||||
* Superalgos Desktop
|
||||
* Superalgos Server
|
||||
|
||||
Users can use any of these clients for their social trading activities.
|
||||
|
||||
This module represents the Nodejs command that users have to start the Desktop App..
|
||||
|
||||
*/
|
||||
|
||||
let APP_ROOT = require('./DesktopRoot.js')
|
||||
let APP_ROOT_MODULE = APP_ROOT.newDesktopRoot()
|
||||
APP_ROOT_MODULE.run()
|
||||
Reference in new issue
Block a user