Merge branch 'develop' of gitlab.com:surya89/freeplanet_serverside into develop
This commit is contained in:
@@ -25,14 +25,14 @@ const _ = require('lodash');
|
|||||||
|
|
||||||
const reg = require('../reg/registration');
|
const reg = require('../reg/registration');
|
||||||
|
|
||||||
const { authenticate, authenticate_noerror } = require('../middleware/authenticate');
|
const { authenticate, authenticate_noerror, authenticate_noerror } = require('../middleware/authenticate');
|
||||||
|
|
||||||
const TypedError = require('../modules/ErrorHandler');
|
const TypedError = require('../modules/ErrorHandler');
|
||||||
const globalTables = require('../tools/globalTables');
|
const globalTables = require('../tools/globalTables');
|
||||||
|
|
||||||
const mongoose = require('mongoose').set('debug', false);
|
const mongoose = require('mongoose').set('debug', false);
|
||||||
|
|
||||||
router.post('/cmd', authenticate_noerror, async (req, res) => {
|
router.post('/cmd', authenticate_noerror_noerror, async (req, res) => {
|
||||||
|
|
||||||
const mydata = req.body.mydata;
|
const mydata = req.body.mydata;
|
||||||
const idapp = req.body.idapp;
|
const idapp = req.body.idapp;
|
||||||
|
|||||||
@@ -1554,6 +1554,40 @@ module.exports = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
htmlToTelegramText(html) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
const withMarkdown = html
|
||||||
|
.replace(/<strong>(.*?)<\/strong>/g, '*$1*')
|
||||||
|
.replace(/<b>(.*?)<\/b>/g, '*$1*')
|
||||||
|
.replace(/<em>(.*?)<\/em>/g, '_$1_')
|
||||||
|
.replace(/<u>(.*?)<\/u>/g, '__$1__');
|
||||||
|
|
||||||
|
// Remove other HTML tags
|
||||||
|
const plainText = withMarkdown.replace(/<[^>]*>/g, '');
|
||||||
|
|
||||||
|
// Replace HTML entities with their equivalent Markdown or plain text representations
|
||||||
|
const replacements = [
|
||||||
|
{ pattern: /&/g, replacement: '&' },
|
||||||
|
{ pattern: /</g, replacement: '<' },
|
||||||
|
{ pattern: />/g, replacement: '>' },
|
||||||
|
{ pattern: /"/g, replacement: '"' },
|
||||||
|
{ pattern: /'/g, replacement: "'" },
|
||||||
|
];
|
||||||
|
|
||||||
|
let telegramText = plainText;
|
||||||
|
replacements.forEach((replacement) => {
|
||||||
|
telegramText = telegramText.replace(replacement.pattern, replacement.replacement);
|
||||||
|
});
|
||||||
|
|
||||||
|
return telegramText;
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
};
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
convertTexttoHtml(myhtml) {
|
convertTexttoHtml(myhtml) {
|
||||||
// let msg = myhtml;
|
// let msg = myhtml;
|
||||||
// msg = msg.replace('\n', '<br>');
|
// msg = msg.replace('\n', '<br>');
|
||||||
@@ -2115,6 +2149,11 @@ module.exports = {
|
|||||||
// query = {};
|
// query = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (true) {
|
||||||
|
// RIMUOVI
|
||||||
|
// query = {};
|
||||||
|
}
|
||||||
|
|
||||||
if (Object.keys(query).length > 0) {
|
if (Object.keys(query).length > 0) {
|
||||||
const numtabbacheca = this.getNumTabByTable(shared_consts.TABLES_MYBACHECAS);
|
const numtabbacheca = this.getNumTabByTable(shared_consts.TABLES_MYBACHECAS);
|
||||||
if (numtab === numtabbacheca) {
|
if (numtab === numtabbacheca) {
|
||||||
|
|||||||
Reference in New Issue
Block a user