total5 0.0.8 → 0.0.9-2
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/builders.js +5 -5
- package/changelog.txt +13 -0
- package/flowstream.js +4 -16
- package/global.js +1 -0
- package/index.js +1 -1
- package/mail.js +5 -1
- package/package.json +1 -1
- package/utils.js +6 -6
- package/websocket.js +14 -0
package/builders.js
CHANGED
|
@@ -47,11 +47,6 @@ Options.prototype = {
|
|
|
47
47
|
this.payload = value;
|
|
48
48
|
},
|
|
49
49
|
|
|
50
|
-
get hostname() {
|
|
51
|
-
let ctrl = this.controller;
|
|
52
|
-
return ctrl ? ((ctrl.protocol || 'https') + '://' + ctrl.headers.host) : null;
|
|
53
|
-
},
|
|
54
|
-
|
|
55
50
|
get url() {
|
|
56
51
|
return (this.controller ? this.controller.url : '') || '';
|
|
57
52
|
},
|
|
@@ -105,6 +100,11 @@ Options.prototype = {
|
|
|
105
100
|
}
|
|
106
101
|
};
|
|
107
102
|
|
|
103
|
+
Options.prototype.hostname = function(path) {
|
|
104
|
+
let ctrl = this.controller;
|
|
105
|
+
return ctrl ? ctrl.hostname(path) : path;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
108
|
Options.prototype.unauthorized = function() {
|
|
109
109
|
var args = [this];
|
|
110
110
|
for (let i = 0; i < arguments.length; i++)
|
package/changelog.txt
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
========================
|
|
2
|
+
0.0.9
|
|
3
|
+
========================
|
|
4
|
+
|
|
5
|
+
- added missing method `NEWMIDDLEWARE()`
|
|
6
|
+
- fixed parsing `user-agent`
|
|
7
|
+
- fixed `Message-ID` generator for email messages
|
|
8
|
+
- improved `Number.round()` by [Tomáš Novák](https://github.com/tomee03)
|
|
9
|
+
- added missing `$.hostname()` method in the `WebSocketController`
|
|
10
|
+
- added missing `$.address` property in the `WebSocketController`
|
|
11
|
+
- replaced `$.hostname` property with a method in the Schema/Auth Options
|
|
12
|
+
- __critital__ fixed cloning buffers in the `FlowStream`
|
|
13
|
+
|
|
1
14
|
========================
|
|
2
15
|
0.0.8
|
|
3
16
|
========================
|
package/flowstream.js
CHANGED
|
@@ -438,14 +438,8 @@ MP.send = function(outputindex, data, clonedata) {
|
|
|
438
438
|
if (data != undefined)
|
|
439
439
|
message.data = data;
|
|
440
440
|
|
|
441
|
-
if (clonedata && message.data && typeof(message.data) === 'object')
|
|
442
|
-
|
|
443
|
-
let buf = Buffer.alloc(message.data.length);
|
|
444
|
-
buf.copy(message.data);
|
|
445
|
-
message.data = buf;
|
|
446
|
-
} else
|
|
447
|
-
message.data = F.TUtils.clone(message.data);
|
|
448
|
-
}
|
|
441
|
+
if (clonedata && message.data && typeof(message.data) === 'object')
|
|
442
|
+
message.data = message.data instanceof Buffer ? Buffer.from(message.data) : F.TUtils.clone(message.data);
|
|
449
443
|
|
|
450
444
|
message.used++;
|
|
451
445
|
message.instance = schema;
|
|
@@ -1120,14 +1114,8 @@ FP.ontrigger = function(outputindex, data, controller, events) {
|
|
|
1120
1114
|
message.used = 1;
|
|
1121
1115
|
}
|
|
1122
1116
|
|
|
1123
|
-
if (i && (self.cloning != false) && message.data && typeof(message.data) === 'object')
|
|
1124
|
-
|
|
1125
|
-
var buf = Buffer.alloc(message.data.length);
|
|
1126
|
-
buf.copy(message.data);
|
|
1127
|
-
message.data = buf;
|
|
1128
|
-
} else
|
|
1129
|
-
message.data = F.TUtils.clone(message.data);
|
|
1130
|
-
}
|
|
1117
|
+
if (i && (self.cloning != false) && message.data && typeof(message.data) === 'object')
|
|
1118
|
+
message.data = message.data instanceof Buffer ? Buffer.from(message.data) : F.TUtils.clone(message.data);
|
|
1131
1119
|
|
|
1132
1120
|
message.main = self;
|
|
1133
1121
|
message.controller = controller;
|
package/global.js
CHANGED
|
@@ -42,6 +42,7 @@ global.CACHE = F.cache;
|
|
|
42
42
|
global.NEWACTION = F.TBuilders.newaction;
|
|
43
43
|
global.NEWCOMPONENT = F.newcomponent;
|
|
44
44
|
global.NEWSCHEMA = F.TBuilders.newschema;
|
|
45
|
+
global.NEWMIDDLEWARE = F.middleware;
|
|
45
46
|
global.ACTION = global.EXEC = F.TBuilders.action;
|
|
46
47
|
global.TEMPLATE = F.template;
|
|
47
48
|
global.FILESTORAGE = F.filestorage;
|
package/index.js
CHANGED
package/mail.js
CHANGED
|
@@ -567,7 +567,11 @@ Mailer.$writemessage = function(obj, buffer) {
|
|
|
567
567
|
|
|
568
568
|
message.push('MIME-Version: 1.0');
|
|
569
569
|
buffer.push('MAIL FROM: <' + msg.email_from + '>');
|
|
570
|
-
|
|
570
|
+
|
|
571
|
+
if (!Mailer.domain)
|
|
572
|
+
Mailer.domain = msg.email_from.substring(msg.email_from.lastIndexOf('@'));
|
|
573
|
+
|
|
574
|
+
message.push('Message-ID: <total5X' + dt.toString(36) + 'X' + (INDEXATTACHMENT++) + 'X' + (INDEXATTACHMENT) + Mailer.domain + '>');
|
|
571
575
|
|
|
572
576
|
self.$priority && message.push('X-Priority: ' + self.$priority);
|
|
573
577
|
self.$confidential && message.push('Sensitivity: Company-Confidential');
|
package/package.json
CHANGED
package/utils.js
CHANGED
|
@@ -1586,8 +1586,11 @@ exports.filestreamer = function(filename, onbuffer, onend, size) {
|
|
|
1586
1586
|
};
|
|
1587
1587
|
|
|
1588
1588
|
exports.parseUA = function(headers, structured) {
|
|
1589
|
-
let ua = headers['
|
|
1589
|
+
let ua = (headers['user-agent'] || '');
|
|
1590
1590
|
if (ua) {
|
|
1591
|
+
return ua ? ua.parseUA(structured) : ua;
|
|
1592
|
+
} else {
|
|
1593
|
+
ua = headers['sec-ch-ua'];
|
|
1591
1594
|
let platform = headers['sec-ch-ua-platform'] || '';
|
|
1592
1595
|
let mobile = headers['sec-ch-ua-mobile'] === '?1';
|
|
1593
1596
|
let index = ua.indexOf('";v');
|
|
@@ -1595,9 +1598,6 @@ exports.parseUA = function(headers, structured) {
|
|
|
1595
1598
|
if (platform)
|
|
1596
1599
|
platform = platform.substring(1, platform.length - 1);
|
|
1597
1600
|
return structured ? { os: platform, browser: browser, device: mobile ? 'mobile' : 'desktop' } : ((platform ? (platform + ' ') : '') + browser + (mobile ? ' Mobile' : ''));
|
|
1598
|
-
} else {
|
|
1599
|
-
ua = (headers['user-agent'] || '');
|
|
1600
|
-
return ua ? ua.parseUA(structured) : ua;
|
|
1601
1601
|
}
|
|
1602
1602
|
};
|
|
1603
1603
|
|
|
@@ -4230,8 +4230,8 @@ NP.padRight = function(max, c) {
|
|
|
4230
4230
|
};
|
|
4231
4231
|
|
|
4232
4232
|
NP.round = function(precision) {
|
|
4233
|
-
var m = Math.
|
|
4234
|
-
return
|
|
4233
|
+
var m = Math.round(this + 'e' + precision);
|
|
4234
|
+
return Number(m + 'e-' + precision);
|
|
4235
4235
|
};
|
|
4236
4236
|
|
|
4237
4237
|
NP.currency = function(currency, a, b, c) {
|
package/websocket.js
CHANGED
|
@@ -48,6 +48,7 @@ function Controller(req, socket, head) {
|
|
|
48
48
|
ctrl.current = {};
|
|
49
49
|
ctrl.masking = false;
|
|
50
50
|
ctrl.iswebsocket = true;
|
|
51
|
+
ctrl.protocol = req.connection.encrypted || req.headers['x-forwarded-ssl'] === 'on' || req.headers['x-forwarded-port'] === '443' || (req.headers['x-forwarded-proto'] || req.headers['x-forwarded-protocol']) === 'https' ? 'https' : 'http';
|
|
51
52
|
|
|
52
53
|
for (let path of ctrl.split)
|
|
53
54
|
ctrl.split2.push(path.toLowerCase());
|
|
@@ -91,6 +92,14 @@ Controller.prototype = {
|
|
|
91
92
|
|
|
92
93
|
get referrer() {
|
|
93
94
|
return this.headers.referer;
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
get host() {
|
|
98
|
+
return this.headers.host;
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
get address() {
|
|
102
|
+
return (this.protocol + '://' + this.headers?.host || '') + (this.req?.url || '');
|
|
94
103
|
}
|
|
95
104
|
|
|
96
105
|
};
|
|
@@ -592,6 +601,11 @@ Controller.prototype.ping = function(ts) {
|
|
|
592
601
|
return ctrl;
|
|
593
602
|
};
|
|
594
603
|
|
|
604
|
+
Controller.prototype.hostname = function(path) {
|
|
605
|
+
var ctrl = this;
|
|
606
|
+
return ctrl.protocol + '://' + ctrl.headers.host + (path ? path : '');
|
|
607
|
+
};
|
|
608
|
+
|
|
595
609
|
function websocketclientdestroy(ctrl) {
|
|
596
610
|
ctrl.socket.destroy();
|
|
597
611
|
F.TUtils.destroystream(ctrl.socket);
|