total5 0.0.7-1 → 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 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
@@ -3,6 +3,12 @@
3
3
  ========================
4
4
 
5
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
6
12
 
7
13
  ========================
8
14
  0.0.6
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 || (req.headers['x-forwarded-protocol'] || req.headers['x-forwarded-proto']) === 'https' ? 'https' : 'http';
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());
@@ -159,6 +159,10 @@ Controller.prototype = {
159
159
 
160
160
  get host() {
161
161
  return this.headers.host;
162
+ },
163
+
164
+ get address() {
165
+ return (this.protocol + '://' + this.headers?.host || '') + (this.req?.url || '');
162
166
  }
163
167
 
164
168
  };
package/index.js CHANGED
@@ -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 % 30 === 0)
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "total5",
3
- "version": "0.0.7-1",
3
+ "version": "0.0.7-2",
4
4
  "description": "Total.js framework v5",
5
5
  "main": "index.js",
6
6
  "directories": {
package/utils.js CHANGED
@@ -4319,13 +4319,7 @@ NP.pluralize = function(zero, one, few, other) {
4319
4319
  else
4320
4320
  value = other;
4321
4321
 
4322
- var beg = value.indexOf('#');
4323
- if (beg === -1)
4324
- return value;
4325
-
4326
- var end = value.lastIndexOf('#');
4327
- var format = value.substring(beg, end + 1);
4328
- return num.format(format) + value.replace(format, '');
4322
+ return value.replace('#', num.toString());
4329
4323
  };
4330
4324
 
4331
4325
  NP.VAT = NP.TAX = function(percentage, decimals, includedVAT) {