puvox-library 1.0.47 → 1.0.50
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/library_standard.js +8 -0
- package/package.json +1 -1
package/library_standard.js
CHANGED
@@ -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'];
|
@@ -2909,6 +2911,7 @@ const puvox_library =
|
|
2909
2911
|
}
|
2910
2912
|
},
|
2911
2913
|
helper_write(groupName, content, storageType){
|
2914
|
+
content = puvox_library.isString (content) ? content : (puvox_library.isArray(content) || puvox_library.isObject(content) ? JSON.stringify(content) : content);
|
2912
2915
|
const appName = puvox_library.getAppName();
|
2913
2916
|
if (storageType === 'file'){
|
2914
2917
|
const filepath = puvox_library.file.tempDir() + appName + '_' + groupName + '.json';
|
@@ -3368,6 +3371,11 @@ const puvox_library =
|
|
3368
3371
|
(object.length >= 2) &&
|
3369
3372
|
((object[0] === '{') || (object[0] === '['))
|
3370
3373
|
),
|
3374
|
+
encode_html_entities (content) {
|
3375
|
+
return content.replace(/[\u00A0-\u9999<>\&]/g, function(i) {
|
3376
|
+
return '&#'+i.charCodeAt(0)+';';
|
3377
|
+
});
|
3378
|
+
},
|
3371
3379
|
// number
|
3372
3380
|
precisionFromString (string) {
|
3373
3381
|
const split = string.replace (/0+$/g, '').split ('.')
|