mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
feature(rest) rm auth
This commit is contained in:
parent
5c953c81d4
commit
2c5e217468
3 changed files with 0 additions and 64 deletions
|
|
@ -1,37 +0,0 @@
|
|||
(function() {
|
||||
'use strict';
|
||||
|
||||
module.exports = binom;
|
||||
|
||||
function binom(name, array) {
|
||||
var ret;
|
||||
|
||||
if (!Array.isArray(array))
|
||||
throw Error('array should be array!');
|
||||
|
||||
if (typeof name !== 'string')
|
||||
throw Error('name should be string!');
|
||||
|
||||
array.some(function(item) {
|
||||
var is = item.name === name,
|
||||
isArray = Array.isArray(item);
|
||||
|
||||
if (is)
|
||||
ret = item;
|
||||
else if (isArray)
|
||||
item.some(function(item) {
|
||||
is = item.name === name;
|
||||
|
||||
if (is)
|
||||
ret = item.data;
|
||||
|
||||
return is;
|
||||
});
|
||||
|
||||
return is;
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
})();
|
||||
|
|
@ -3,18 +3,15 @@
|
|||
|
||||
var DIR = './',
|
||||
DIR_LIB = DIR + '../',
|
||||
DIR_JSON = DIR_LIB + '../json/',
|
||||
|
||||
path = require('path'),
|
||||
root = require(DIR + 'root'),
|
||||
config = require(DIR + 'config'),
|
||||
binom = require(DIR + 'binom'),
|
||||
|
||||
CloudFunc = require(DIR_LIB + 'cloudfunc'),
|
||||
|
||||
markdown = require(DIR + 'markdown'),
|
||||
|
||||
github = require('faust'),
|
||||
jaguar = require('jaguar'),
|
||||
|
||||
flop = require('flop'),
|
||||
|
|
@ -25,8 +22,6 @@
|
|||
json = require('jonny'),
|
||||
check = require('checkup'),
|
||||
|
||||
Modules = require(DIR_JSON + 'modules'),
|
||||
|
||||
isWin32 = process.platform === 'win32';
|
||||
|
||||
/**
|
||||
|
|
@ -158,19 +153,6 @@
|
|||
operation('pack', dir, response, names, fn);
|
||||
}
|
||||
|
||||
function auth(code, callback) {
|
||||
var storage = binom('storage', Modules),
|
||||
gh = binom('GitHub', storage),
|
||||
env = process.env,
|
||||
|
||||
key = env.github_key || gh.key,
|
||||
secret = env.github_secret || gh.secret,
|
||||
|
||||
ghAuth = github(key, secret);
|
||||
|
||||
ghAuth(code, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* process data on PUT request
|
||||
*
|
||||
|
|
@ -192,14 +174,6 @@
|
|||
files = json.parse(body);
|
||||
|
||||
switch(cmd) {
|
||||
case 'auth':
|
||||
auth(body, function(error, token) {
|
||||
callback(error, json.stringify({
|
||||
data: token
|
||||
}));
|
||||
});
|
||||
break;
|
||||
|
||||
case 'mv':
|
||||
if (!files.from || !files.to) {
|
||||
callback(body);
|
||||
|
|
|
|||
|
|
@ -86,7 +86,6 @@
|
|||
"edward": "^3.0.0",
|
||||
"execon": "^1.2.0",
|
||||
"express": "^4.13.0",
|
||||
"faust": "^1.0.0",
|
||||
"files-io": "^1.2.0",
|
||||
"flop": "^1.4.0",
|
||||
"format-io": "^0.9.6",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue