puvox-library 1.0.47 → 1.0.49

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.
@@ -869,6 +869,7 @@ const puvox_library =
869
869
  // in some langs, the date object has distinctions, so the two below needs separated methods. However, the "date" object returned from them, are same, just the representation can be local or UTC depending user.
870
870
  StringToDatetimeUtc(str, format, culture) { return new Date(str); },
871
871
  StringToDatetimeLocal(str, format, culture) { return new Date(str); },
872
+ StringToTimestamUtc(str, format, culture) { return new Date(str).getTime(); },
872
873
  DatetimeUtc() {
873
874
  var now = new Date();
874
875
  var utc = new Date(now.getTime()); // + now.getTimezoneOffset() * 60000 is not needed !!!!!!
@@ -2643,6 +2644,7 @@ const puvox_library =
2643
2644
  text = this.br2nl(text);
2644
2645
  text = this.stripTags(text,'<b><strong><i><em><u><ins><s><strike><del><a><code><pre>'); // allowed: https://core.telegram.org/bots/api#html-style
2645
2646
  text = text.substring(0, 4095); //max telegram message length 4096
2647
+ text = this.encode_html_entities(text);
2646
2648
  const requestOpts = Object.assign({'chat_id':chat_id, 'text':text}, extra_opts);
2647
2649
  delete requestOpts['cache'];
2648
2650
  delete requestOpts['is_repeated_call'];
@@ -3368,6 +3370,11 @@ const puvox_library =
3368
3370
  (object.length >= 2) &&
3369
3371
  ((object[0] === '{') || (object[0] === '['))
3370
3372
  ),
3373
+ encode_html_entities (content) {
3374
+ return content.replace(/[\u00A0-\u9999<>\&]/g, function(i) {
3375
+ return '&#'+i.charCodeAt(0)+';';
3376
+ });
3377
+ },
3371
3378
  // number
3372
3379
  precisionFromString (string) {
3373
3380
  const split = string.replace (/0+$/g, '').split ('.')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "puvox-library",
3
- "version": "1.0.47",
3
+ "version": "1.0.49",
4
4
  "description": "library-class-javascript",
5
5
  "main": "library_standard.js",
6
6
  "scripts": {