aboutsummaryrefslogtreecommitdiffhomepage
path: root/cli
diff options
context:
space:
mode:
authorJohannes Zellner <johannes@nebulon.de>2016-03-01 19:04:23 +0100
committerJohannes Zellner <johannes@nebulon.de>2016-03-01 19:04:23 +0100
commitaa88a75382d0f5ff2929768a412d8ec64dfc6296 (patch)
tree63b11e23dacec1ada7fd512ab5c8ce5d5adb568e /cli
parent04bc2989d966224126196280a529225d2bd115eb (diff)
downloadSurfer-aa88a75382d0f5ff2929768a412d8ec64dfc6296.tar.gz
Surfer-aa88a75382d0f5ff2929768a412d8ec64dfc6296.tar.zst
Surfer-aa88a75382d0f5ff2929768a412d8ec64dfc6296.zip
protect _admin/
Diffstat (limited to 'cli')
-rw-r--r--cli/actions.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/cli/actions.js b/cli/actions.js
index 6f8faea..69ffa10 100644
--- a/cli/actions.js
+++ b/cli/actions.js
@@ -119,8 +119,9 @@ function put(filePath, otherFilePaths, options) {
119 console.log('Uploading file %s -> %s', relativeFilePath.cyan, destinationPath.cyan); 119 console.log('Uploading file %s -> %s', relativeFilePath.cyan, destinationPath.cyan);
120 120
121 superagent.put(config.server() + API + destinationPath).query(gQuery).attach('file', file).end(function (error, result) { 121 superagent.put(config.server() + API + destinationPath).query(gQuery).attach('file', file).end(function (error, result) {
122 if (result && result.statusCode === 403) return callback(new Error('Upload destination ' + destinationPath + ' not allowed'));
123 if (result && result.statusCode !== 201) return callback(new Error('Error uploading file: ' + result.statusCode));
122 if (error) return callback(error); 124 if (error) return callback(error);
123 if (result.statusCode !== 201) return callback(new Error('Error uploading file: ' + result.statusCode));
124 125
125 console.log('Uploaded to ' + config.server() + destinationPath); 126 console.log('Uploaded to ' + config.server() + destinationPath);
126 127
@@ -128,7 +129,7 @@ function put(filePath, otherFilePaths, options) {
128 }); 129 });
129 }, function (error) { 130 }, function (error) {
130 if (error) { 131 if (error) {
131 console.log('Failed to put file.', error); 132 console.log('Failed to put file.', error.message.red);
132 process.exit(1); 133 process.exit(1);
133 } 134 }
134 135
@@ -143,9 +144,9 @@ function get(filePath) {
143 filePath = filePath || '/'; 144 filePath = filePath || '/';
144 145
145 request.get(config.server() + API + filePath, { qs: gQuery }, function (error, result, body) { 146 request.get(config.server() + API + filePath, { qs: gQuery }, function (error, result, body) {
147 if (result && result.statusCode === 401) return console.log('Login failed');
148 if (result && result.statusCode === 404) return console.log('No such file or directory %s', filePath.yellow);
146 if (error) return console.error(error); 149 if (error) return console.error(error);
147 if (result.statusCode === 401) return console.log('Login failed');
148 if (result.statusCode === 404) return console.log('No such file or directory %s', filePath.yellow);
149 150
150 // 222 indicates directory listing 151 // 222 indicates directory listing
151 if (result.statusCode === 222) { 152 if (result.statusCode === 222) {