total5 0.0.1-8 → 0.0.1-9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/controller.js +7 -2
- package/index.js +3 -3
- package/package.json +1 -1
- package/routing.js +8 -3
package/controller.js
CHANGED
|
@@ -806,7 +806,6 @@ Controller.prototype.$route = function() {
|
|
|
806
806
|
}
|
|
807
807
|
|
|
808
808
|
let route = F.TRouting.lookup(ctrl);
|
|
809
|
-
|
|
810
809
|
if (route) {
|
|
811
810
|
|
|
812
811
|
ctrl.route = route;
|
|
@@ -1018,8 +1017,14 @@ function execute(ctrl) {
|
|
|
1018
1017
|
|
|
1019
1018
|
let schema = body.schema.split('/');
|
|
1020
1019
|
let endpoint = ctrl.route.api[schema[0]];
|
|
1021
|
-
let params = {};
|
|
1022
1020
|
if (endpoint) {
|
|
1021
|
+
|
|
1022
|
+
if ((endpoint.auth === 1 && ctrl.user == null) || (endpoint.auth === 2 && ctrl.user)) {
|
|
1023
|
+
ctrl.fallback(401);
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
let params = {};
|
|
1023
1028
|
if (endpoint.params) {
|
|
1024
1029
|
for (let m of endpoint.params)
|
|
1025
1030
|
params[m.name] = schema[m.index] || '';
|
package/index.js
CHANGED
|
@@ -1339,7 +1339,7 @@ F.componentator = function(name, components, removeprev = true) {
|
|
|
1339
1339
|
|
|
1340
1340
|
F.Fs.lstat(filename, function(err) {
|
|
1341
1341
|
if (err)
|
|
1342
|
-
F.download(url, filename, F.error('COMPONENTATOR'));
|
|
1342
|
+
F.download(url, filename, err => err ? F.error(err, 'COMPONENTATOR') : null);
|
|
1343
1343
|
});
|
|
1344
1344
|
|
|
1345
1345
|
};
|
|
@@ -2203,7 +2203,7 @@ F.backup = function(filename, files, callback, filter) {
|
|
|
2203
2203
|
F.Fs.stat(file, function(err, stats) {
|
|
2204
2204
|
|
|
2205
2205
|
if (err) {
|
|
2206
|
-
F.error(err, '
|
|
2206
|
+
F.error(err, 'F.backup()', filename);
|
|
2207
2207
|
next();
|
|
2208
2208
|
return;
|
|
2209
2209
|
}
|
|
@@ -2289,7 +2289,7 @@ F.backup = function(filename, files, callback, filter) {
|
|
|
2289
2289
|
counter++;
|
|
2290
2290
|
setImmediate(next);
|
|
2291
2291
|
}).on('error', function(err) {
|
|
2292
|
-
F.error(err, 'F.backup', file);
|
|
2292
|
+
F.error(err, 'F.backup()', file);
|
|
2293
2293
|
setImmediate(next);
|
|
2294
2294
|
});
|
|
2295
2295
|
|
package/package.json
CHANGED
package/routing.js
CHANGED
|
@@ -155,6 +155,7 @@ function Route(url, action, size) {
|
|
|
155
155
|
|
|
156
156
|
if (t.method === 'API') {
|
|
157
157
|
t.method = 'POST';
|
|
158
|
+
t.id = t.id.replace(/^(\+|-)/, '');
|
|
158
159
|
url = url.replace(/(\*|\+|-|%)?[a-z0-9-_/{}]+/i, function(text) {
|
|
159
160
|
let tmp = text.trim();
|
|
160
161
|
endpoint = tmp.substring(1);
|
|
@@ -215,6 +216,10 @@ function Route(url, action, size) {
|
|
|
215
216
|
}
|
|
216
217
|
|
|
217
218
|
delete t.actions;
|
|
219
|
+
|
|
220
|
+
// Reset auth
|
|
221
|
+
t.auth = 0;
|
|
222
|
+
|
|
218
223
|
} else
|
|
219
224
|
t.actions = t.actions.join(',');
|
|
220
225
|
|
|
@@ -446,7 +451,7 @@ function compareflags(ctrl, routes, auth) {
|
|
|
446
451
|
}
|
|
447
452
|
}
|
|
448
453
|
|
|
449
|
-
exports.lookup = function(ctrl, auth, skip) {
|
|
454
|
+
exports.lookup = function(ctrl, auth = 0, skip = false) {
|
|
450
455
|
|
|
451
456
|
// auth 0: does not matter
|
|
452
457
|
// auth 1: logged
|
|
@@ -593,7 +598,7 @@ exports.lookupcors = function(ctrl) {
|
|
|
593
598
|
|
|
594
599
|
};
|
|
595
600
|
|
|
596
|
-
exports.lookupfile = function(ctrl, auth) {
|
|
601
|
+
exports.lookupfile = function(ctrl, auth = 0) {
|
|
597
602
|
if (F.routes.files.length) {
|
|
598
603
|
|
|
599
604
|
// fixed
|
|
@@ -611,7 +616,7 @@ exports.lookupfile = function(ctrl, auth) {
|
|
|
611
616
|
}
|
|
612
617
|
};
|
|
613
618
|
|
|
614
|
-
exports.lookupwebsocket = function(ctrl, auth, skip = false) {
|
|
619
|
+
exports.lookupwebsocket = function(ctrl, auth = 0, skip = false) {
|
|
615
620
|
|
|
616
621
|
// auth 0: does not matter
|
|
617
622
|
// auth 1: logged
|