total5 0.0.6 → 0.0.7-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 +9 -0
- package/changelog.txt +12 -0
- package/controller.js +6 -3
- package/index.js +3 -3
- package/mail.js +3 -2
- package/package.json +1 -1
- package/utils.js +17 -7
- package/websocket.js +1 -2
package/builders.js
CHANGED
|
@@ -75,6 +75,10 @@ Options.prototype = {
|
|
|
75
75
|
return this.controller ? this.controller.ip : null;
|
|
76
76
|
},
|
|
77
77
|
|
|
78
|
+
get address() {
|
|
79
|
+
return this.controller ? this.controller.address : null;
|
|
80
|
+
},
|
|
81
|
+
|
|
78
82
|
get files() {
|
|
79
83
|
return this.controller ? this.controller.files : null;
|
|
80
84
|
},
|
|
@@ -1457,6 +1461,11 @@ ActionCaller.prototype.error = function(value) {
|
|
|
1457
1461
|
return this;
|
|
1458
1462
|
};
|
|
1459
1463
|
|
|
1464
|
+
ActionCaller.prototype.ctrl = function(ctrl) {
|
|
1465
|
+
this.controller = ctrl ? (ctrl.controller || ctrl) : null;
|
|
1466
|
+
return this;
|
|
1467
|
+
};
|
|
1468
|
+
|
|
1460
1469
|
ActionCaller.prototype.done = function($, fn) {
|
|
1461
1470
|
this.options.callback = function(err, response) {
|
|
1462
1471
|
if (err)
|
package/changelog.txt
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
========================
|
|
2
|
+
0.0.7
|
|
3
|
+
========================
|
|
4
|
+
|
|
5
|
+
- improved user-agent parser (added support for new headers `Sec-CH-UA`)
|
|
6
|
+
- improved `Number.pluralize()` method
|
|
7
|
+
- reduced DNS cache flush time to 3 minutes
|
|
8
|
+
- added `$.address` property with the absolute URL address
|
|
9
|
+
- added `$.ctrl(ctrl_instance)` method
|
|
10
|
+
- extended `Mail.from(email, [name])` method by adding `name` argument by [Marek Mráz](https://github.com/Mrazbb)
|
|
11
|
+
- added `CONF.mail_from_name {String}` option
|
|
12
|
+
|
|
1
13
|
========================
|
|
2
14
|
0.0.6
|
|
3
15
|
========================
|
package/controller.js
CHANGED
|
@@ -42,7 +42,7 @@ function Controller(req, res) {
|
|
|
42
42
|
ctrl.url = ctrl.uri.pathname;
|
|
43
43
|
ctrl.released = false;
|
|
44
44
|
ctrl.downloaded = false;
|
|
45
|
-
ctrl.protocol = req.connection.encrypted ||
|
|
45
|
+
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';
|
|
46
46
|
|
|
47
47
|
for (let path of ctrl.split)
|
|
48
48
|
ctrl.split2.push(path.toLowerCase());
|
|
@@ -134,8 +134,7 @@ Controller.prototype = {
|
|
|
134
134
|
get ua() {
|
|
135
135
|
if (this.$ua != null)
|
|
136
136
|
return this.$ua;
|
|
137
|
-
|
|
138
|
-
this.$ua = ua ? ua.parseUA() : '';
|
|
137
|
+
this.$ua = F.TUtils.parseUA(this.headers);
|
|
139
138
|
return this.$ua;
|
|
140
139
|
},
|
|
141
140
|
|
|
@@ -160,6 +159,10 @@ Controller.prototype = {
|
|
|
160
159
|
|
|
161
160
|
get host() {
|
|
162
161
|
return this.headers.host;
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
get address() {
|
|
165
|
+
return (this.protocol + '://' + this.headers?.host || '') + (this.req?.url || '');
|
|
163
166
|
}
|
|
164
167
|
|
|
165
168
|
};
|
package/index.js
CHANGED
|
@@ -36,7 +36,7 @@ global.DEF = {};
|
|
|
36
36
|
|
|
37
37
|
F.id = '';
|
|
38
38
|
F.clusterid = '';
|
|
39
|
-
F.is5 = F.version =
|
|
39
|
+
F.is5 = F.version = 5007;
|
|
40
40
|
F.isBundle = false;
|
|
41
41
|
F.isLoaded = false;
|
|
42
42
|
F.version_header = '5';
|
|
@@ -460,7 +460,7 @@ function unlink(arr, callback) {
|
|
|
460
460
|
} else
|
|
461
461
|
msg.to(email);
|
|
462
462
|
|
|
463
|
-
msg.from(F.config.mail_from || F.config.smtp.from || F.config.smtp.user);
|
|
463
|
+
msg.from(F.config.mail_from || F.config.smtp.from || F.config.smtp.user, F.config.mail_from_name || F.config.smtp.name);
|
|
464
464
|
callback && msg.callback(callback);
|
|
465
465
|
|
|
466
466
|
if (reply)
|
|
@@ -1724,7 +1724,7 @@ F.service = function(count) {
|
|
|
1724
1724
|
if (count % F.config.$tmsclearblocked === 0)
|
|
1725
1725
|
F.temporary.tmsblocked = {};
|
|
1726
1726
|
|
|
1727
|
-
if (count %
|
|
1727
|
+
if (count % 3 === 0)
|
|
1728
1728
|
F.temporary.dnscache = {};
|
|
1729
1729
|
|
|
1730
1730
|
let blocked = F.temporary.blocked;
|
package/mail.js
CHANGED
|
@@ -60,8 +60,9 @@ Message.prototype.callback = function(fn) {
|
|
|
60
60
|
return this;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
Message.prototype.sender = Message.prototype.from = function(email) {
|
|
63
|
+
Message.prototype.sender = Message.prototype.from = function(email, name) {
|
|
64
64
|
this.email_from = email;
|
|
65
|
+
this.email_from_name = name;
|
|
65
66
|
return this;
|
|
66
67
|
};
|
|
67
68
|
|
|
@@ -571,7 +572,7 @@ Mailer.$writemessage = function(obj, buffer) {
|
|
|
571
572
|
self.$priority && message.push('X-Priority: ' + self.$priority);
|
|
572
573
|
self.$confidential && message.push('Sensitivity: Company-Confidential');
|
|
573
574
|
|
|
574
|
-
message.push('From: <' + msg.email_from + '>');
|
|
575
|
+
message.push('From: ' + (msg.email_from_name ? (unicode_encode(msg.email_from_name) + ' <' + msg.email_from + '>') : msg.email_from));
|
|
575
576
|
|
|
576
577
|
if (msg.headers) {
|
|
577
578
|
for (let key in msg.headers)
|
package/package.json
CHANGED
package/utils.js
CHANGED
|
@@ -1584,6 +1584,22 @@ exports.filestreamer = function(filename, onbuffer, onend, size) {
|
|
|
1584
1584
|
|
|
1585
1585
|
};
|
|
1586
1586
|
|
|
1587
|
+
exports.parseUA = function(headers, structured) {
|
|
1588
|
+
let ua = headers['sec-ch-ua'];
|
|
1589
|
+
if (ua) {
|
|
1590
|
+
let platform = headers['sec-ch-ua-platform'] || '';
|
|
1591
|
+
let mobile = headers['sec-ch-ua-mobile'] === '?1';
|
|
1592
|
+
let index = ua.indexOf('";v');
|
|
1593
|
+
let browser = ua.substring(1, index);
|
|
1594
|
+
if (platform)
|
|
1595
|
+
platform = platform.substring(1, platform.length - 1);
|
|
1596
|
+
return structured ? { os: platform, browser: browser, device: mobile ? 'mobile' : 'desktop' } : ((platform ? (platform + ' ') : '') + browser + (mobile ? ' Mobile' : ''));
|
|
1597
|
+
} else {
|
|
1598
|
+
ua = (headers['user-agent'] || '');
|
|
1599
|
+
return ua ? ua.parseUA(structured) : ua;
|
|
1600
|
+
}
|
|
1601
|
+
};
|
|
1602
|
+
|
|
1587
1603
|
exports.parseInt = function(obj, def) {
|
|
1588
1604
|
if (obj == null || obj === '')
|
|
1589
1605
|
return def === undefined ? 0 : def;
|
|
@@ -4303,13 +4319,7 @@ NP.pluralize = function(zero, one, few, other) {
|
|
|
4303
4319
|
else
|
|
4304
4320
|
value = other;
|
|
4305
4321
|
|
|
4306
|
-
|
|
4307
|
-
if (beg === -1)
|
|
4308
|
-
return value;
|
|
4309
|
-
|
|
4310
|
-
var end = value.lastIndexOf('#');
|
|
4311
|
-
var format = value.substring(beg, end + 1);
|
|
4312
|
-
return num.format(format) + value.replace(format, '');
|
|
4322
|
+
return value.replace('#', num.toString());
|
|
4313
4323
|
};
|
|
4314
4324
|
|
|
4315
4325
|
NP.VAT = NP.TAX = function(percentage, decimals, includedVAT) {
|
package/websocket.js
CHANGED