diff options
author | przemyslawpluta <przemekpluta@hotmail.com> | 2014-09-27 16:00:04 +0100 |
---|---|---|
committer | przemyslawpluta <przemekpluta@hotmail.com> | 2014-09-27 16:00:04 +0100 |
commit | 8c67cd34fbc3501c9bd6b197b1e8b6ecf5c14d61 (patch) | |
tree | 87f17c519943c3a3ccb0cf19bff21a31b681ca2d /lib | |
parent | 3933a61a27a8d19272322d8f18b8111d70740993 (diff) | |
download | mongo-edu-8c67cd34fbc3501c9bd6b197b1e8b6ecf5c14d61.zip |
update
add proxy test
cleanup
version bump
Diffstat (limited to 'lib')
-rw-r--r-- | lib/login.js | 15 | ||||
-rw-r--r-- | lib/videos.js | 8 |
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/login.js b/lib/login.js index d7f3fdf..01ecd6d 100644 --- a/lib/login.js +++ b/lib/login.js @@ -193,5 +193,20 @@ module.exports = { callback(new Error(res.statusCode)); }); + }, + + checkProxy: function checkProxy(target, callback) { + request(target, function get(err, response) { + if (err !== null) { return callback(err); } + if (response.statusCode === 200) { + var stack = ''; + if (response.headers.server) { stack = 'Proxy Server: '.bold + response.headers.server.cyan + ' '; } + if (response.headers['x-powered-by']) { stack += 'Powered-by: '.bold + response.headers['x-powered-by'].cyan + ' '; } + stack.trim(); + if (stack === '') { stack = target; } + return callback(null, stack); + } + callback(new Error('Server Response: '.red + response.statusCode)); + }); } }; diff --git a/lib/videos.js b/lib/videos.js index a71d4e3..bf8973e 100644 --- a/lib/videos.js +++ b/lib/videos.js @@ -325,5 +325,13 @@ module.exports = { }); + }, + + checkProxyDownload: function checkProxyDownload(argv) { + setOptions(argv); + var video = 'https://youtu.be/nm20j_x9Ol8', opt = { all: undefined, cancel: undefined }; + if (typeof argv.test === 'string') { video = argv.test; } + opt[video] = 0; + handleList([video], opt); } }; |