diff --git a/json/config.json b/json/config.json index 6eb996bf..939121ce 100644 --- a/json/config.json +++ b/json/config.json @@ -8,8 +8,6 @@ "html" : true, "img" : true }, - "gdrive_id" : "255175681917", - "vk_id" : "3336188", "logs" : false, "show_keys_panel" : true, "server" : true, diff --git a/json/modules.json b/json/modules.json index 2275b95b..bf7bc37a 100644 --- a/json/modules.json +++ b/json/modules.json @@ -7,10 +7,10 @@ "data": [{ "name": "DropBox", "data":{ - "key" : "0nd3ssnp5fp7tqs", - "secret" : "r61lxpchmk8l06o", - "encodedKey" : "DkMz4FYHQTA=|GW6pf2dONkrGvckMwBsl1V1vysrCPktPiUWN7UpDjw==", - "chooserKey" : "o7d6llji052vijk" + "key" : "0nd3ssnp5fp7tqs", + "secret" : "r61lxpchmk8l06o", + "encodedKey": "DkMz4FYHQTA=|GW6pf2dONkrGvckMwBsl1V1vysrCPktPiUWN7UpDjw==", + "chooserKey": "o7d6llji052vijk" } }, { "name": "GitHub", @@ -18,9 +18,17 @@ "key" : "891c251b925e4e967fa9", "secret" : "afe9bed1e810c5dc44c4c2a953fc6efb1e5b0545" } + }, { + "name": "GDrive", + "data": { + "id" : "255175681917" + } + }, { + "name": "VK", + "data": { + "id" : "3336188" + } }, - "GDrive", - "VK", "SkyDrive" ] } diff --git a/lib/client/storage/_gdrive.js b/lib/client/storage/_gdrive.js index 3a9c28cd..f01fefa0 100644 --- a/lib/client/storage/_gdrive.js +++ b/lib/client/storage/_gdrive.js @@ -16,9 +16,13 @@ var CloudCommander, Util, DOM, gapi; var lUrl = 'https://apis.google.com/js/client.js'; DOM.jsload(lUrl, function(){ - CloudCmd.getConfig(function(pConfig){ + CloudCmd.getModules(function(pModules){ + var lStorage = Util.findObjByNameInArr(pModules, 'storage'), + lGDrive = Util.findObjByNameInArr(lStorage.data, 'GDrive'), + GDriveId = lGDrive && lGDrive.data.id; /* https://developers.google.com/drive/credentials */ - var lCLIENT_ID = pConfig.gdrive_id + '.apps.googleusercontent.com', + + var lCLIENT_ID = GDriveId + '.apps.googleusercontent.com', lSCOPES = 'https://www.googleapis.com/auth/drive', lParams = { @@ -87,7 +91,7 @@ var CloudCommander, Util, DOM, gapi; if (!pCallBack) pCallBack = function(file) { - console.log(file); + Util.log(file); }; request.execute(pCallBack); diff --git a/lib/client/storage/_github.js b/lib/client/storage/_github.js index 0efd0e21..552fd481 100644 --- a/lib/client/storage/_github.js +++ b/lib/client/storage/_github.js @@ -10,7 +10,7 @@ var CloudCommander, Util, DOM, $, Github, cb; GitHubStore = {}; /* temporary callback function for work with github */ - cb = function (err, data){ console.log(err || data);}; + cb = function (err, data){ Util.log(err || data);}; /* PRIVATE FUNCTIONS */ @@ -118,7 +118,6 @@ var CloudCommander, Util, DOM, $, Github, cb; lHost = CloudCommander.HOST, lOptions = { description: 'Uplouded by Cloud Commander from ' + lHost, - public: true }; @@ -130,8 +129,8 @@ var CloudCommander, Util, DOM, $, Github, cb; lGist.create(lOptions, function(pError, pData){ DOM.Images.hideLoad(); - console.log(pError || pData); - console.log(pData && pData.html_url); + Util.log(pError || pData); + Util.log(pData && pData.html_url); Util.exec(pCallBack); }); diff --git a/lib/server/auth.js b/lib/server/auth.js index 0518eb01..b994834b 100644 --- a/lib/server/auth.js +++ b/lib/server/auth.js @@ -19,7 +19,7 @@ https = main.https, qs = main.querystring, - Config = main.config, + Modules = main.modules, Util = main.util, GithubAuth = { @@ -48,7 +48,9 @@ }; function authenticate(pCode, pCallBack) { - var lGitHub = Config.github, + var lStorage = Util.findObjByNameInArr(Modules, 'storage'), + lGitHub = Util.findObjByNameInArr(lStorage.data, 'GitHub'), + lId = lGitHub && lGitHub.key, lSecret = lGitHub && lGitHub.secret, lEnv = process.env, diff --git a/lib/server/main.js b/lib/server/main.js index f7aebd6b..223e072c 100644 --- a/lib/server/main.js +++ b/lib/server/main.js @@ -71,6 +71,7 @@ /* Main Information */ exports.config = mrequire(JSONDIR + 'config'); + exports.modules = mrequire(JSONDIR + 'modules'); exports.mainpackage = rootrequire('package');