mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactored
This commit is contained in:
parent
ebeffdc16e
commit
140a97504f
6 changed files with 29 additions and 17 deletions
|
|
@ -8,8 +8,6 @@
|
|||
"html" : true,
|
||||
"img" : true
|
||||
},
|
||||
"gdrive_id" : "255175681917",
|
||||
"vk_id" : "3336188",
|
||||
"logs" : false,
|
||||
"show_keys_panel" : true,
|
||||
"server" : true,
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@
|
|||
|
||||
/* Main Information */
|
||||
exports.config = mrequire(JSONDIR + 'config');
|
||||
exports.modules = mrequire(JSONDIR + 'modules');
|
||||
exports.mainpackage = rootrequire('package');
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue