added ability to connect github development id to cloud cmd working on any host

This commit is contained in:
coderaiser 2012-11-19 05:26:44 -05:00
parent df873c0faf
commit 0d7c892cab
4 changed files with 37 additions and 5 deletions

View file

@ -104,6 +104,12 @@ before load menu module to.
object from client to DOM module,
refactored Cache object and added polyfill.
* Added ability to connect github development id,
to Cloud Commander instance working in any host,
for this all the needed to be done is:
set enveronment varibles "oauth_client_id" and
"oauth_client_secret" values from github profile.
2012.10.01, Version 0.1.7

View file

@ -7,7 +7,9 @@ var CloudCommander, Util, DOM, $, Github, cb;
var cloudcmd = CloudCommander,
API_URL = '/api/v1/auth',
APIURL = '/api/v1',
AuthURL = APIURL + '/auth',
ClientIdURL = APIURL + '/client_id',
CLIENT_ID,
Cache = DOM.Cache,
GitHub,
@ -41,12 +43,22 @@ var CloudCommander, Util, DOM, $, Github, cb;
}
function setConfig(pCallBack){
/*
cloudcmd.loadConfig(function(){
var lConfig = cloudcmd.Config;
CLIENT_ID = lConfig.oauth_client_id;
Util.exec(pCallBack);
});
*/
DOM.ajax({
url : ClientIdURL,
success : function(pData){
CLIENT_ID = pData;
Util.exec(pCallBack);
}
});
}
function saveToken(pToken){
@ -89,7 +101,7 @@ var CloudCommander, Util, DOM, $, Github, cb;
DOM.ajax({
type : 'put',
url : API_URL,
url : AuthURL,
data: lCode,
success: function(pData){
if(pData && pData.token){

View file

@ -37,11 +37,19 @@
});
};
function authenticate(pCode, pCallBack) {
var lId = Config.oauth_client_id,
lSecret = Config.oauth_client_secret,
lEnv = process.env,
lClientId = lEnv.oauth_client_id || lId,
lClientSecret = lEnv.oauth_client_secret || lSecret;
console.log(lEnv);
var data = qs.stringify({
client_id : Config.oauth_client_id,
client_secret : Config.oauth_client_secret,
client_id : lClientId,
client_secret : lClientSecret,
code : pCode
});

View file

@ -96,6 +96,12 @@
break;
case 'kill':
process.exit();
break;
case 'client_id':
var lEnv = process.env,
lConfig = main.config;
lResult = lEnv.oauth_client_id || lConfig.oauth_client_id;
}
return lResult;