added ability to read gdrive key from config

This commit is contained in:
coderaiser 2013-01-10 10:33:32 -05:00
parent fe677f5ade
commit 6b6ee3606e
4 changed files with 25 additions and 18 deletions

View file

@ -68,6 +68,8 @@ keyStop: function(e, opt) {
* Fixed bug with height of terminal.
* Added ability to read gdrive key from config.
2012.12.12, Version 0.1.8

View file

@ -14,6 +14,7 @@
"dropbox_secret" : "r61lxpchmk8l06o",
"dropbox_encoded_key" : "DkMz4FYHQTA=|GW6pf2dONkrGvckMwBsl1V1vysrCPktPiUWN7UpDjw==",
"dropbox_chooser_key" : "o7d6llji052vijk",
"gdrive_key" : "255175681917",
"logs" : false,
"show_keys_panel" : true,
"server" : true,

View file

@ -20,7 +20,7 @@ var CloudCommander, Util, DOM, Dropbox, cb, Client;
var lSrc = '//cdnjs.cloudflare.com/ajax/libs/dropbox.js/0.7.1/dropbox.min.js',
//var lSrc = CloudCmd.LIBDIRCLIENT + 'storage/dropbox/lib/dropbox.js',
lLocal = CloudCmd.LIBDIRCLIENT + 'storage/dropbox/lib/dropbox.min.js',
lOnload = function(){
lOnload = function(){
console.timeEnd('dropbox load');
DOM.Images.hideLoad();
@ -57,6 +57,7 @@ var CloudCommander, Util, DOM, Dropbox, cb, Client;
Client = new Dropbox.Client({
key: pConfig.dropbox_encoded_key
});
Client.authDriver(new Dropbox.Drivers.Redirect({rememberUser: true}));
Client.authenticate(function(pError, pClient) {

View file

@ -15,25 +15,28 @@ var CloudCommander, Util, DOM, gapi;
var lUrl = 'https://apis.google.com/js/client.js';
DOM.jsload(lUrl, function(){
/* https://developers.google.com/drive/credentials */
var lCLIENT_ID = '255175681917.apps.googleusercontent.com',
lSCOPES = 'https://www.googleapis.com/auth/drive',
lParams = {
'client_id' : lCLIENT_ID,
'scope' : lSCOPES,
'immediate' : false
};
setTimeout(function() {
gapi.auth.authorize(lParams, function(pAuthResult){
CloudCmd.getConfig(function(pConfig){
/* https://developers.google.com/drive/credentials */
var lCLIENT_ID = pConfig.gdrive_key + '.apps.googleusercontent.com',
lSCOPES = 'https://www.googleapis.com/auth/drive',
if (pAuthResult && !pAuthResult.error)
gapi.client.load('drive', 'v2', function() {
Util.exec(pCallBack);
lParams = {
'client_id' : lCLIENT_ID,
'scope' : lSCOPES,
'immediate' : false
};
setTimeout(function() {
gapi.auth.authorize(lParams, function(pAuthResult){
if (pAuthResult && !pAuthResult.error)
gapi.client.load('drive', 'v2', function() {
Util.exec(pCallBack);
});
});
});
}, 500);
}, 500);
});
});
}