- fix: Invio RIS (non si vedevano i circuiti !)
- se si usava l'username telegram per registrarsi non faceva il controllo delle minuscole. - bottone "Invia RIS" era scomparso
This commit is contained in:
38
.env.prod.freeplanet.app
Normal file
38
.env.prod.freeplanet.app
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
DATABASE=FreePlanet
|
||||||
|
UDB=paofreeplanet
|
||||||
|
PDB=suerteFreePlanet@1A
|
||||||
|
SEND_EMAIL=1
|
||||||
|
PORT=3000
|
||||||
|
ENABLE_PUSHNOTIFICATION=1
|
||||||
|
DIRECTORY_SERVER=/var/www/www.freeplanet_server
|
||||||
|
SERVERDIR_WEBSITE=/var/www/www.freeplanet_server
|
||||||
|
PORT_APP1="0"
|
||||||
|
DOMAIN=mongodb://localhost:27017/
|
||||||
|
AUTH_MONGODB=1
|
||||||
|
MONGODB_USER=admin
|
||||||
|
MONGODB_PWD=mypwadminREAL@1A
|
||||||
|
SIGNCODE=SU2134hncaskjdbo231oihJSDNHEI$1@AB
|
||||||
|
DEBUG=0
|
||||||
|
LOCALE=0
|
||||||
|
DELAY_SENDEMAIL=1000
|
||||||
|
VAPI_KEY_SUBJECT="mailto:paolo@freeplanet.app"
|
||||||
|
PUBLIC_VAPI_KEY="BGXRf1TgcqocqD6J7qnRgCG7AvM2lxAoW7peb7UEzB4SxBb6DxGRdJ0UvD9ewnrB9KrSrh0-aDCODXBm7sZ1DDs"
|
||||||
|
PRIVATE_VAPI_KEY="St9UMzcS76Q9yKG6RInAuYydYjFRliqwHTJY3A5wjO0"
|
||||||
|
GCM_API_KEY="AIzaSyD7w1jztfVV05mX1iyxoI-r1pZWxuxdUK8"
|
||||||
|
PATH_CERT_KEY=key.pem
|
||||||
|
PATH_SERVER_CRT=cert.pem
|
||||||
|
PATH_SSL_ROOT_PEM=root.pem
|
||||||
|
PATH_SSL_CHAIN_PEM=chain.pem
|
||||||
|
PROD=1
|
||||||
|
PROJECT_DESCR_MAIN='__PROJECTS'
|
||||||
|
SECRK=iUUb38v23jjDFaosWj92axkBOXCQ
|
||||||
|
TOKEN_LIFE=2h
|
||||||
|
REFRESH_TOKEN_LIFE=14d
|
||||||
|
AUTH_NEW_SITES=B234HDSAOJ734ndcsdKWNV
|
||||||
|
DOMAINS=[{"hostname":"freeplanet.app","port":"3000"}]
|
||||||
|
#DOMAINS=[{"hostname":"abitaregliiblei.it","port":"3021"},{"hostname":"riso.app","port":"3005"}]
|
||||||
|
SCRIPTS_DIR=admin_scripts
|
||||||
|
CLOUDFLARE_TOKENS=[{"label":"Paolo.arena77@gmail.com","value":"M9EM309v8WFquJKpYgZCw-TViM2wX6vB3wlK6GD0"},{"label":"gruppomacro.com","value":"bqmzGShoX7WqOBzkXocoECyBkPq3GfqcM5t6VFd8"}]
|
||||||
|
MIAB_HOST=box.lamiaposta.org
|
||||||
|
MIAB_ADMIN_EMAIL=admin@lamiaposta.org
|
||||||
|
MIAB_ADMIN_PASSWORD=passpao1pabox@1A
|
||||||
67
deploynodejs_on_prod_freeplanet.app.sh
Executable file
67
deploynodejs_on_prod_freeplanet.app.sh
Executable file
@@ -0,0 +1,67 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source ./.env.prod.freeplanet.app
|
||||||
|
|
||||||
|
echo "Sincronizzazione in corso ... $DIRECTORY_SERVER/"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Configurazione
|
||||||
|
REMOTE_USER="suryapaolo"
|
||||||
|
REMOTE_HOST="servereng"
|
||||||
|
REMOTE_PORT="8855"
|
||||||
|
REMOTE_DIR="$DIRECTORY_SERVER"
|
||||||
|
SSH_OPTIONS="-p $REMOTE_PORT"
|
||||||
|
CONFIG_JS="ecosystem.config.prod_freeplanet.app.js"
|
||||||
|
ENV_FILE=".env.prod.freeplanet.app"
|
||||||
|
ENV_OUT=".env.production"
|
||||||
|
|
||||||
|
# Array di cartelle e file da sincronizzare
|
||||||
|
SYNC_ITEMS=(
|
||||||
|
"css"
|
||||||
|
"docs"
|
||||||
|
"emails"
|
||||||
|
"plugins"
|
||||||
|
"sass"
|
||||||
|
"admin_scripts"
|
||||||
|
"src"
|
||||||
|
)
|
||||||
|
|
||||||
|
echo $REMOTE_DIR
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia Cartelle ... "
|
||||||
|
|
||||||
|
|
||||||
|
# Esegui rsync per le cartelle
|
||||||
|
rsync -avz --delete \
|
||||||
|
--exclude='src/server/router/upload/' \
|
||||||
|
-e "ssh $SSH_OPTIONS" \
|
||||||
|
"${SYNC_ITEMS[@]}" \
|
||||||
|
"$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file $ENV_FILE su $ENV_OUT ... "
|
||||||
|
|
||||||
|
# Sincronizza i file specifici
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
$ENV_FILE "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/$ENV_OUT"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file package.json ... "
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
package.json "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/package.json"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "*** Copia del file ecosystem.config.js ... "
|
||||||
|
rsync -avz -e "ssh $SSH_OPTIONS" \
|
||||||
|
"$CONFIG_JS" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/ecosystem.config.js"
|
||||||
|
|
||||||
|
# Verifica il risultato
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "✅ Sincronizzazione completata con successo. SERVER $REMOTE_DIR! "
|
||||||
|
else
|
||||||
|
echo "❌ Errore durante la sincronizzazione. Controlla l'output per i dettagli."
|
||||||
|
fi
|
||||||
|
|
||||||
21
ecosystem.config.prod_freeplanet.app.js
Executable file
21
ecosystem.config.prod_freeplanet.app.js
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
module.exports = {
|
||||||
|
apps: [
|
||||||
|
{
|
||||||
|
name: "PRODUZIONE - FREEPLANET",
|
||||||
|
script: "/var/www/www.freeplanet_server/src/server/server.js",
|
||||||
|
ignore_watch: ["node_modules", "logs"],
|
||||||
|
interpreter: "/root/.nvm/versions/node/v16.19.0/bin/node",
|
||||||
|
//autorestart: true,
|
||||||
|
instances: 1,
|
||||||
|
watch: false,
|
||||||
|
env: {
|
||||||
|
"NODE_ENV": "production"
|
||||||
|
},
|
||||||
|
log_file: "logs/combined.outerr.log",
|
||||||
|
error_file: "logs/error.log",
|
||||||
|
out_file: "logs/out.log",
|
||||||
|
merge_logs: true,
|
||||||
|
log_date_format: "YYYY-MM-DD HH:mm:ss.SSSS Z"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
@@ -63583,7 +63583,7 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
_id: 5782,
|
_id: 5782,
|
||||||
istat: '030096',
|
istat: '030096',
|
||||||
comune: 'Rivignano',
|
comune: 'Rivignano Teor',
|
||||||
prov: 'UD',
|
prov: 'UD',
|
||||||
reg: 'FVG',
|
reg: 'FVG',
|
||||||
pref: '0432',
|
pref: '0432',
|
||||||
|
|||||||
@@ -1812,9 +1812,11 @@ UserSchema.statics.getUserByUsernameTelegram = function (idapp, username_telegra
|
|||||||
username_telegram = username_telegram.substring(1);
|
username_telegram = username_telegram.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let regexp = new RegExp(`^${username_telegram}$`, 'i');
|
||||||
|
|
||||||
return User.findOne({
|
return User.findOne({
|
||||||
idapp,
|
idapp,
|
||||||
'profile.username_telegram': username_telegram,
|
'profile.username_telegram': { $regex: regexp },
|
||||||
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
|
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -3925,6 +3927,23 @@ UserSchema.statics.getRealUsernameByUsername = async function (idapp, username)
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
UserSchema.statics.getRealUsernameByUsernameTelegram = async function (idapp, username) {
|
||||||
|
const User = this;
|
||||||
|
|
||||||
|
let regexp = new RegExp(`^${username}$`, 'i');
|
||||||
|
|
||||||
|
return await User.findOne({
|
||||||
|
idapp,
|
||||||
|
'profile.username_telegram':
|
||||||
|
{ $regex: regexp },
|
||||||
|
$or: [{ deleted: { $exists: false } }, { deleted: { $exists: true, $eq: false } }],
|
||||||
|
}, { username: 1, _id: 1 }).then((rec) => {
|
||||||
|
return (!!rec) ? rec.username : '';
|
||||||
|
}).catch((e) => {
|
||||||
|
console.error('getRealUsernameByUsername', e);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
UserSchema.statics.getRecLangAndIdByUsername = async function (idapp, username) {
|
UserSchema.statics.getRecLangAndIdByUsername = async function (idapp, username) {
|
||||||
const User = this;
|
const User = this;
|
||||||
|
|
||||||
|
|||||||
@@ -63583,7 +63583,7 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
_id: 5782,
|
_id: 5782,
|
||||||
istat: '030096',
|
istat: '030096',
|
||||||
comune: 'Rivignano',
|
comune: 'Rivignano Teor',
|
||||||
prov: 'UD',
|
prov: 'UD',
|
||||||
reg: 'FVG',
|
reg: 'FVG',
|
||||||
pref: '0432',
|
pref: '0432',
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ const shared_consts = require('../tools/shared_nodejs');
|
|||||||
|
|
||||||
const sharp = require('sharp');
|
const sharp = require('sharp');
|
||||||
|
|
||||||
|
const axios = require('axios');
|
||||||
|
|
||||||
const server_constants = require('../tools/server_constants');
|
const server_constants = require('../tools/server_constants');
|
||||||
|
|
||||||
// const {ListaIngresso} = require('../models/listaingresso');
|
// const {ListaIngresso} = require('../models/listaingresso');
|
||||||
@@ -911,6 +913,7 @@ const MyTelegramBot = {
|
|||||||
|
|
||||||
if (myfunc === shared_consts.CallFunz.REGISTRATION) {
|
if (myfunc === shared_consts.CallFunz.REGISTRATION) {
|
||||||
|
|
||||||
|
if (telegid > 0) {
|
||||||
cl.setPhotoProfile(myuser, telegid, false);
|
cl.setPhotoProfile(myuser, telegid, false);
|
||||||
|
|
||||||
const rismsg = await MsgTemplate.getMsgByLang(idapp, myuser, shared_consts.TypeMsgTemplate.MSG_BENVENUTO, myuser.lang);
|
const rismsg = await MsgTemplate.getMsgByLang(idapp, myuser, shared_consts.TypeMsgTemplate.MSG_BENVENUTO, myuser.lang);
|
||||||
@@ -918,6 +921,7 @@ const MyTelegramBot = {
|
|||||||
|
|
||||||
await cl.sendMsgLog(telegid, rismsg.body);
|
await cl.sendMsgLog(telegid, rismsg.body);
|
||||||
await cl.sendMsg(telegid, rismsg2.body);
|
await cl.sendMsg(telegid, rismsg2.body);
|
||||||
|
}
|
||||||
|
|
||||||
userDest = myuser.aportador_solidario;
|
userDest = myuser.aportador_solidario;
|
||||||
let notask_verif = await User.notAsk_VerifByUsername(idapp, userDest);
|
let notask_verif = await User.notAsk_VerifByUsername(idapp, userDest);
|
||||||
@@ -3813,6 +3817,85 @@ class Telegram {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Soluzione 1: Converti PNG in JPG prima dell'invio
|
||||||
|
async sendPhoto(chatId, imageUrl, opt) {
|
||||||
|
try {
|
||||||
|
// Scarica l'immagine
|
||||||
|
const response = await axios.get(imageUrl, { responseType: 'arraybuffer' });
|
||||||
|
const imageBuffer = Buffer.from(response.data);
|
||||||
|
|
||||||
|
// Controlla il formato e converti se necessario
|
||||||
|
const metadata = await sharp(imageBuffer).metadata();
|
||||||
|
|
||||||
|
if (metadata.format === 'png') {
|
||||||
|
console.log('Conversione PNG in JPG...');
|
||||||
|
const jpgBuffer = await sharp(imageBuffer)
|
||||||
|
.jpeg({ quality: 90 })
|
||||||
|
.toBuffer();
|
||||||
|
|
||||||
|
return await this.bot.sendPhoto(chatId, jpgBuffer, opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Se non è PNG, invia direttamente
|
||||||
|
return await this.bot.sendPhoto(chatId, imageBuffer, opt);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Errore nell\'invio della foto:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Soluzione 2: Prova prima come PNG, se fallisce invia come documento
|
||||||
|
async sendPhotoWithFallback(chatId, imageUrl, opt) {
|
||||||
|
try {
|
||||||
|
// Prova prima a inviare come foto
|
||||||
|
await this.bot.sendPhoto(chatId, imageUrl, opt);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('Invio come foto fallito, provo come documento...');
|
||||||
|
try {
|
||||||
|
// Se fallisce, invia come documento
|
||||||
|
await this.bot.sendDocument(chatId, imageUrl, opt);
|
||||||
|
} catch (docError) {
|
||||||
|
console.error('Anche l\'invio come documento è fallito:', docError);
|
||||||
|
throw docError;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Soluzione 3: Implementazione completa con gestione errori e tentativi multipli
|
||||||
|
async sendImageToTelegram(chatId, imageUrl, opt) {
|
||||||
|
try {
|
||||||
|
// Prima prova: invia direttamente l'URL
|
||||||
|
try {
|
||||||
|
return await this.bot.sendPhoto(chatId, imageUrl, opt);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('Primo tentativo fallito, provo a convertire...');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Seconda prova: scarica e converti in JPG
|
||||||
|
const response = await axios.get(imageUrl, { responseType: 'arraybuffer' });
|
||||||
|
const imageBuffer = Buffer.from(response.data);
|
||||||
|
|
||||||
|
const jpgBuffer = await sharp(imageBuffer)
|
||||||
|
.jpeg({ quality: 90 })
|
||||||
|
.toBuffer();
|
||||||
|
|
||||||
|
try {
|
||||||
|
return await this.bot.sendPhoto(chatId, jpgBuffer, opt);
|
||||||
|
} catch (error) {
|
||||||
|
console.log('Secondo tentativo fallito, provo come documento...');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ultima prova: invia come documento
|
||||||
|
return await this.bot.sendDocument(chatId, imageBuffer, opt);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Tutti i tentativi di invio sono falliti:', error);
|
||||||
|
return false;
|
||||||
|
//throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async _inviaMsg(id, text, form, menu, msg_id, chat_id, ripr_menuPrec, opt) {
|
async _inviaMsg(id, text, form, menu, msg_id, chat_id, ripr_menuPrec, opt) {
|
||||||
if (!text)
|
if (!text)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -3884,10 +3967,20 @@ class Telegram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let inviato = false;
|
||||||
|
|
||||||
|
let risSendPhoto = null;
|
||||||
|
|
||||||
if (opt && opt.img) {
|
if (opt && opt.img) {
|
||||||
|
if (false) {
|
||||||
|
opt.img = 'https://riso.app/upload/profile/paoloar77/mybachecas/Fermentazione-Ruello-sito.png';
|
||||||
|
//opt.img = 'https://riso.app/upload/profile/paoloar77/mybachecas/Fermentazione-Ruello-sito.jpg';
|
||||||
|
// opt.img = 'https://riso.app/upload/profile/SoniaVioletFlame/myskills/1000133092.jpg';
|
||||||
|
}
|
||||||
opt.img = tools.fixUrl(opt.img, opt.idapp);
|
opt.img = tools.fixUrl(opt.img, opt.idapp);
|
||||||
console.log('opt.img', opt.img)
|
console.log('opt.img', opt.img)
|
||||||
return this.bot.sendPhoto(id, opt.img, { caption: text, ...form }).catch((e) => {
|
risSendPhoto = await this.sendImageToTelegram(id, opt.img, { caption: text, ...form });
|
||||||
|
/*return this.bot.sendPhoto(id, opt.img, { caption: text, ...form }).catch((e) => {
|
||||||
let blocked = false;
|
let blocked = false;
|
||||||
if ((e.message.indexOf('Forbidden') > 0) ||
|
if ((e.message.indexOf('Forbidden') > 0) ||
|
||||||
(e.message.indexOf('chat not found') > 0)) {
|
(e.message.indexOf('chat not found') > 0)) {
|
||||||
@@ -3901,8 +3994,13 @@ class Telegram {
|
|||||||
// ++Todo: DA FARE ! local_sendMsgTelegramToTheManagers(this.idapp, addtext + text);
|
// ++Todo: DA FARE ! local_sendMsgTelegramToTheManagers(this.idapp, addtext + text);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});*/
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (risSendPhoto) {
|
||||||
|
inviato = true;
|
||||||
|
}
|
||||||
|
if (!inviato) {
|
||||||
return this.bot.sendMessage(id, text, form).catch((e) => {
|
return this.bot.sendMessage(id, text, form).catch((e) => {
|
||||||
let blocked = false;
|
let blocked = false;
|
||||||
if ((e.message.indexOf('Forbidden') > 0) ||
|
if ((e.message.indexOf('Forbidden') > 0) ||
|
||||||
@@ -3920,6 +4018,8 @@ class Telegram {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return risSendPhoto
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e, 'text', text);
|
console.error(e, 'text', text);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -4943,7 +4943,7 @@ module.exports = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
addRowTelegram(icon, title, content, acapo, islink) {
|
addRowTelegram(icon, title, content, acapo, acapofine, islink) {
|
||||||
let mystr = '';
|
let mystr = '';
|
||||||
|
|
||||||
let descrcontent = content;
|
let descrcontent = content;
|
||||||
@@ -4952,11 +4952,16 @@ module.exports = {
|
|||||||
descrcontent = '';
|
descrcontent = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
mystr += `${icon} <strong>${title}</strong>\n`;
|
mystr += `${icon} <strong>${title}</strong>`;
|
||||||
|
if (acapo) {
|
||||||
|
mystr += `\n`;
|
||||||
|
} else {
|
||||||
|
mystr += `: `;
|
||||||
|
}
|
||||||
if (descrcontent) {
|
if (descrcontent) {
|
||||||
mystr += `${descrcontent}\n`;
|
mystr += `${descrcontent}\n`;
|
||||||
|
|
||||||
if (acapo) {
|
if (acapofine) {
|
||||||
mystr += `\n`;
|
mystr += `\n`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5289,25 +5294,25 @@ module.exports = {
|
|||||||
if ((myrec.contact_telegram && myrec.contact_telegram.toLowerCase() !== contatto_telegram.toLowerCase()) || !contatto) {
|
if ((myrec.contact_telegram && myrec.contact_telegram.toLowerCase() !== contatto_telegram.toLowerCase()) || !contatto) {
|
||||||
contatto += '\n' + myrec.contact_telegram;
|
contatto += '\n' + myrec.contact_telegram;
|
||||||
}
|
}
|
||||||
if (myrec.contact_phone) {
|
/*if (myrec.contact_phone) {
|
||||||
contatto += ' - ' + this.get__('TELEFONO', lang) + ': ' + myrec.contact_phone;
|
contatto += ' 📞 ' + myrec.contact_phone;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
// let out = i18n.__('NEW_ANNUNCIO_TELEGRAM', mydescr, dovestr, descrestesa, userorig);
|
// let out = i18n.__('NEW_ANNUNCIO_TELEGRAM', mydescr, dovestr, descrestesa, userorig);
|
||||||
|
|
||||||
if (tiposcambio)
|
if (tiposcambio)
|
||||||
out += this.addRowTelegram(iconascambio, tiposcambio + status, '', false);
|
out += this.addRowTelegram(iconascambio, tiposcambio + status, '', true, false);
|
||||||
|
|
||||||
const url = this.getHostByIdApp(myrec.idapp) + shared_consts.getDirectoryByTable(tablerec, true) + myrec._id;
|
const url = this.getHostByIdApp(myrec.idapp) + shared_consts.getDirectoryByTable(tablerec, true) + myrec._id;
|
||||||
|
|
||||||
out += `<strong>${myrec.descr}</strong>\n\n`;
|
out += `<strong>${myrec.descr}</strong>\n\n`;
|
||||||
|
|
||||||
if (datastr)
|
if (datastr)
|
||||||
out += this.addRowTelegram('✨', 'Data Evento', datastr, true);
|
out += this.addRowTelegram('✨', 'Data Evento', datastr, true, true);
|
||||||
|
|
||||||
if (cat)
|
if (cat)
|
||||||
out += this.addRowTelegram('⭐️', 'Categoria', cat, true);
|
out += this.addRowTelegram('⭐️', 'Categoria', cat, true, true);
|
||||||
|
|
||||||
let descrcontent = this.convertAndTruncateHTMLForTelegram(myrec.note, 500, url)
|
let descrcontent = this.convertAndTruncateHTMLForTelegram(myrec.note, 500, url)
|
||||||
|
|
||||||
@@ -5318,39 +5323,44 @@ module.exports = {
|
|||||||
// descrcontent = '<span size="3"><b>Prova Pao</b> Ciaooo</span>';
|
// descrcontent = '<span size="3"><b>Prova Pao</b> Ciaooo</span>';
|
||||||
|
|
||||||
if (descrcontent)
|
if (descrcontent)
|
||||||
out += this.addRowTelegram('📝', 'Descrizione ' + newdescr, descrcontent, true);
|
out += this.addRowTelegram('📝', 'Descrizione ' + newdescr, descrcontent, true, true);
|
||||||
|
|
||||||
const localita = this.getComuniEProvinceByRec(myrec);
|
const localita = this.getComuniEProvinceByRec(myrec);
|
||||||
|
|
||||||
if (!solo_online)
|
if (!solo_online)
|
||||||
out += this.addRowTelegram('🏠', 'Località', localita, true);
|
out += this.addRowTelegram('🏠', 'Località', localita, false, true);
|
||||||
|
|
||||||
const incambiodi = await this.getInCambioDiByRec(myrec);
|
const incambiodi = await this.getInCambioDiByRec(myrec);
|
||||||
if (incambiodi)
|
if (incambiodi)
|
||||||
out += this.addRowTelegram('⚖️', 'In cambio di', incambiodi, true);
|
out += this.addRowTelegram('⚖️', 'In cambio di', incambiodi, false, true);
|
||||||
|
|
||||||
if (organizedBy) {
|
if (organizedBy) {
|
||||||
out += this.addRowTelegram('🏠', 'Organizzato da', organizedBy, true);
|
out += this.addRowTelegram('🏠', 'Organizzato da', organizedBy, false, true);
|
||||||
} else {
|
} else {
|
||||||
out += this.addRowTelegram('👤', 'Contatto', contatto, true);
|
out += this.addRowTelegram('👤', 'Contatto', contatto, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contributo)
|
if (contributo)
|
||||||
out += this.addRowTelegram('💰', 'Contributo Richiesto', contributo, true);
|
out += this.addRowTelegram('💰', 'Contributo Richiesto', contributo, false, true);
|
||||||
|
|
||||||
if (contact_phone || contact_email || sitoweb) {
|
if (contact_phone || contact_email || sitoweb) {
|
||||||
out += this.addRowTelegram('ℹ️', 'Info',
|
out += this.addRowTelegram('ℹ️', 'Per Info:',
|
||||||
(contact_phone ? ('📞 ' + contact_phone + ' ') : '')
|
(contact_phone ? ('📞 ' + contact_phone + ' ') : '')
|
||||||
+ (contact_email ? (' 📨 ' + contact_email + ' ') : '')
|
+ (contact_email ? (' 📨 ' + contact_email + ' ') : '')
|
||||||
+ (sitoweb ? (' 🌐 ' + sitoweb + ' ') : '')
|
+ (sitoweb ? (' 🌐 ' + sitoweb + ' ') : '')
|
||||||
, true);
|
, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (writtenby && organizedBy) {
|
if (writtenby && organizedBy) {
|
||||||
out += this.addRowTelegram('✍️', 'Redatto da', '@' + writtenby, true);
|
out += this.addRowTelegram('✍️', 'Redatto da', '@' + writtenby, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
out += this.addRowTelegram('', `👉🏻 Vedi Annuncio completo su RISO`, url, true, true);
|
let cosastr = 'Annuncio';
|
||||||
|
if (tablerec === shared_consts.TABLES_MYBACHECAS) {
|
||||||
|
cosastr = 'Evento';
|
||||||
|
}
|
||||||
|
|
||||||
|
out += this.addRowTelegram('', `👉🏻 Vedi ${cosastr} completo su RISO`, url, true, true, true);
|
||||||
|
|
||||||
if (myrec.photos && myrec.photos.length > 0) {
|
if (myrec.photos && myrec.photos.length > 0) {
|
||||||
// prende la prima foto ! ;
|
// prende la prima foto ! ;
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ module.exports = {
|
|||||||
|
|
||||||
const allquery = { ...query, ...addquery };
|
const allquery = { ...query, ...addquery };
|
||||||
|
|
||||||
const arrusers = await User.find(
|
let arrusers = await User.find(
|
||||||
allquery,
|
allquery,
|
||||||
{
|
{
|
||||||
username: 1,
|
username: 1,
|
||||||
@@ -417,6 +417,9 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
).lean();
|
).lean();
|
||||||
|
|
||||||
|
if (!tools.sulServer()) {
|
||||||
|
arrusers = await User.find({ idapp, username: telegrambot.ADMIN_USER_SERVER });
|
||||||
|
}
|
||||||
|
|
||||||
for (const user of arrusers) {
|
for (const user of arrusers) {
|
||||||
|
|
||||||
@@ -461,7 +464,12 @@ module.exports = {
|
|||||||
risult = await telegrambot.local_sendMsgTelegramByIdTelegram(idapp, telegid, text, undefined, undefined, undefined, undefined, params.img);
|
risult = await telegrambot.local_sendMsgTelegramByIdTelegram(idapp, telegid, text, undefined, undefined, undefined, undefined, params.img);
|
||||||
await tools.snooze(25);
|
await tools.snooze(25);
|
||||||
|
|
||||||
textsent = risult.text;
|
try {
|
||||||
|
if (risult && (risult.text || risult.caption))
|
||||||
|
textsent = (risult.text || risult.caption);
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.1.9
|
1.1.11
|
||||||
Reference in New Issue
Block a user