diff --git a/CloudVM/CloudSupport.js b/CloudVM/CloudSupport.js new file mode 100644 index 000000000..abd9f3f5c --- /dev/null +++ b/CloudVM/CloudSupport.js @@ -0,0 +1,147 @@ + +/* + +This module is for enabling the AACloud to run at the browser. + +When running at the clode on NodeJS some things work diffently that at the browser. That gap will be fixed by the functions at this module. + +*/ + + + +function runBot() { + + window.CURRENT_ENVIRONMENT = "Develop"; + window.STORAGE_PERMISSIONS = ecosystem.getStoragePermissions(); + window.EXCHANGE_KEYS = ecosystem.getExchangeKeys(); + + let root = newRoot(); + + root.initialize(onInitialized); + + function onInitialized() { + + root.start(); + } + +} + +function webRequire(pModulePath) { + + switch (pModulePath) { + + case 'fs': { + + return newWebFS(); + } + case 'azure-storage': { + + return AzureStorage.Blob; + } + case './EventHandler': { + + let MODULE = {}; + MODULE.newEventHandler = newEventHandler; + return MODULE; + } + case './BlobStorage': { + + let MODULE = {}; + MODULE.newBlobStorage = newBlobStorage; + return MODULE; + } + case './DebugLog': { + + let MODULE = {}; + MODULE.newDebugLog = newDebugLog; + return MODULE; + } + case './TradingBotProcessMainLoop': { + + let MODULE = {}; + MODULE.newTradingBotProcessMainLoop = newTradingBotProcessMainLoop; + return MODULE; + } + case './ExtractionBotProcessMainLoop': { + + let MODULE = {}; + MODULE.newExtractionBotProcessMainLoop = newExtractionBotProcessMainLoop; + return MODULE; + } + case './IndicatorBotProcessMainLoop': { + + let MODULE = {}; + MODULE.newIndicatorBotProcessMainLoop = newIndicatorBotProcessMainLoop; + return MODULE; + } + case './CloudUtilities': { + + let MODULE = {}; + MODULE.newCloudUtilities = newCloudUtilities; + return MODULE; + } + case './PoloniexAPIClient': { + + let MODULE = {}; + MODULE.newPoloniexAPIClient = newPoloniexAPIClient; + return MODULE; + } + case './ExchangeAPI': { + + let MODULE = {}; + MODULE.newExchangeAPI = newExchangeAPI; + return MODULE; + } + case './Context': { + + let MODULE = {}; + MODULE.newContext = newContext; + return MODULE; + } + case './Assistant': { + + let MODULE = {}; + MODULE.newAssistant = newAssistant; + return MODULE; + } + case './StatusReport': { + + let MODULE = {}; + MODULE.newStatusReport = newStatusReport; + return MODULE; + } + case './DataSet': { + + let MODULE = {}; + MODULE.newDataSet = newDataSet; + return MODULE; + } + case './StatusDependencies': { + + let MODULE = {}; + MODULE.newStatusDependencies = newStatusDependencies; + return MODULE; + } + case './DataDependencies': { + + let MODULE = {}; + MODULE.newDataDependencies = newDataDependencies; + return MODULE; + } + default: { + console.log(pModulePath + " not found. "); + } + } +} + +function downloadModule(pPath) { + + /* We will need this to load individual bots modules. */ + + Requirejs(["Scripts/DummyWeb"], function (DummyWeb) { + console.log("Dummy Web Loaded"); + }); + +} + + diff --git a/WebVM/WebFS.js b/CloudVM/WebFS.js similarity index 100% rename from WebVM/WebFS.js rename to CloudVM/WebFS.js diff --git a/Project.njsproj b/Project.njsproj index ec5d65b6f..00558fbec 100644 --- a/Project.njsproj +++ b/Project.njsproj @@ -35,10 +35,10 @@ Code - + Code - + Code @@ -153,7 +153,7 @@ - + diff --git a/WebVM/CloudSupport.js b/WebVM/CloudSupport.js deleted file mode 100644 index 236be1b45..000000000 --- a/WebVM/CloudSupport.js +++ /dev/null @@ -1,63 +0,0 @@ - -/* - -This module is for enabling the AACloud to run at the browser. - -When running at the clode on NodeJS some things work diffently that at the browser. That gap will be fixed by the functions at this module. - -*/ - - - -function runBot() { - - window.CURRENT_ENVIRONMENT = "Develop"; - window.STORAGE_PERMISSIONS = ecosystem.getStoragePermissions(); - window.EXCHANGE_KEYS = ecosystem.getExchangeKeys(); - - let root = newRoot(); - - root.initialize(onInitialized); - - function onInitialized() { - - root.start(); - } - -} - -function webRequire(pModulePath) { - - switch (pModulePath) { - - case 'fs': { - - return newWebFS(); - } - case './BlobStorage': { - - return newBlobStorage(); - } - case 'azure-storage': { - - return AzureStorage.Blob; - } - case './DebugLog': { - - return newDebugLog(); - - } - } -} - -function downloadModule(pPath) { - - /* We will need this to load individual bots modules. */ - - Requirejs(["Scripts/DummyWeb"], function (DummyWeb) { - console.log("Dummy Web Loaded"); - }); - -} - - diff --git a/index.html b/index.html index b94bb77a9..47131e3f8 100644 --- a/index.html +++ b/index.html @@ -10,8 +10,8 @@ - - + + diff --git a/server.js b/server.js index a3cbde240..3604855b3 100644 --- a/server.js +++ b/server.js @@ -346,10 +346,10 @@ function onBrowserRequest(request, response) { } break; - case "WebVM": // This means the Scripts folder. + case "CloudVM": // This means the Scripts folder. { - respondWithFile('./WebVM/' + requestParameters[2], response); + respondWithFile('./CloudVM/' + requestParameters[2], response); } break;