- corretto sendemail password... l'ho cambiata. e ho messo dei controlli
This commit is contained in:
BIN
emails/.DS_Store
vendored
BIN
emails/.DS_Store
vendored
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -430,7 +430,7 @@ class GenPdf {
|
||||
}
|
||||
|
||||
async onlinePdfFromIdCatalog(options) {
|
||||
const risout = await GenPdf.onlinePdf(options);
|
||||
const risout = await this.onlinePdf(options);
|
||||
}
|
||||
|
||||
async generatePdfFromIdCatalog(options) {
|
||||
|
||||
@@ -64,9 +64,13 @@ const GenPdf = require('../modules/GenPdf');
|
||||
|
||||
const genPdf = new GenPdf();
|
||||
|
||||
(async () => {
|
||||
await genPdf.launch();
|
||||
})();
|
||||
let genPdfLaunched = false;
|
||||
function launchGenPdfIfNeeded() {
|
||||
if (!genPdfLaunched) {
|
||||
genPdfLaunched = true;
|
||||
genPdf.launch();
|
||||
}
|
||||
}
|
||||
|
||||
async function updateProductInfo(recproductInfoAttuale, product, idapp, mycatstr) {
|
||||
if (!recproductInfoAttuale || !mycatstr) return recproductInfoAttuale;
|
||||
@@ -618,6 +622,8 @@ router.post('/online-pdf', authenticate, async (req, res) => {
|
||||
console.log('/online-pdf');
|
||||
|
||||
try {
|
||||
launchGenPdfIfNeeded(); // Ensure GenPdf is launched before proceeding
|
||||
|
||||
const risout = await GenPdf.onlinePdf(req.body);
|
||||
|
||||
return res.status(200).send(risout);
|
||||
@@ -2641,6 +2647,7 @@ router.post('/generate-pdf', async (req, res) => {
|
||||
}
|
||||
|
||||
try {
|
||||
launchGenPdfIfNeeded(); // Ensure GenPdf is launched before proceeding
|
||||
const pdfPath = await genPdf.generatePdfFromUrl(url, filename);
|
||||
res.download(pdfPath);
|
||||
} catch (error) {
|
||||
|
||||
@@ -52,7 +52,7 @@ router.post('/track-pageview', authenticate_noerror, async (req, res) => {
|
||||
|
||||
await pageView.save();
|
||||
|
||||
res.status(200).json({ message: 'Visita registrata' });
|
||||
res.status(200).json({ message: '' });
|
||||
} catch (error) {
|
||||
console.error('Errore nel salvataggio della visita:', error);
|
||||
res.status(500).json({ error: 'Impossibile registrare la visita' });
|
||||
|
||||
@@ -106,6 +106,15 @@ module.exports = {
|
||||
}*/
|
||||
}
|
||||
|
||||
// se non è presente la password, non inviare l'email e manda messaggio di errore !
|
||||
|
||||
if (!paramemail.transport.options.auth.pass) {
|
||||
let email = paramemail.transport.options.auth.user;
|
||||
|
||||
console.error('❌ Password mancante ! Impossibile inviare le email. user=', email);
|
||||
return false;
|
||||
}
|
||||
|
||||
// console.table(paramemail.transport);
|
||||
|
||||
// console.log('2 . paramemail.transport', paramemail.transport);
|
||||
@@ -125,9 +134,13 @@ module.exports = {
|
||||
},
|
||||
locals: mylocalsconf,
|
||||
}).then((ris) => {
|
||||
if (ris?.response && ris.response.includes('Ok')) {
|
||||
console.log('✅ Email INVIATA')
|
||||
}
|
||||
// console.log('ris EMAIL', ris);
|
||||
return !!ris;
|
||||
}).catch((err) => {
|
||||
console.log('❌ Email NON INVIATA!');
|
||||
console.error('sendEmail_base Error: ', err);
|
||||
return false;
|
||||
});
|
||||
@@ -754,7 +767,7 @@ module.exports = {
|
||||
},
|
||||
|
||||
getTransport: (mylocalsconf) => {
|
||||
console.log('getTransport');
|
||||
// console.log('getTransport');
|
||||
|
||||
// Create Transport
|
||||
let smtpTransport = null;
|
||||
|
||||
@@ -267,13 +267,13 @@ connectToDatabase(connectionUrl, options)
|
||||
|
||||
await tools.getApps();
|
||||
|
||||
let miapass = '';
|
||||
|
||||
if (process.env.PROD !== 1) {
|
||||
testmsgwebpush();
|
||||
|
||||
// tools.sendNotifToAdmin('Riparti', 'Riparti');
|
||||
|
||||
let miapass = '';
|
||||
|
||||
if (miapass !== '') {
|
||||
let crypt = tools.cryptdata(miapass);
|
||||
let decrypt = tools.decryptdata(crypt);
|
||||
@@ -285,8 +285,24 @@ connectToDatabase(connectionUrl, options)
|
||||
mycron();
|
||||
}
|
||||
|
||||
miapass = 'PROVA123@';
|
||||
let crypt = tools.cryptdata(miapass);
|
||||
let decrypt = tools.decryptdata(crypt);
|
||||
|
||||
telegrambot = require('./telegram/telegrambot');
|
||||
|
||||
if (decrypt === miapass) {
|
||||
console.log('✅ Decrypt OK');
|
||||
// OK FUNZIONA
|
||||
} else {
|
||||
let msgerr = '❌ ERRORE! la decrittazione non funziona! ';
|
||||
console.error(msgerr);
|
||||
await telegrambot.sendMsgTelegramToTheAdminAllSites(
|
||||
msgerr,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
await inizia();
|
||||
|
||||
await resetProcessingJob();
|
||||
@@ -536,14 +552,14 @@ connectToDatabase(connectionUrl, options)
|
||||
|
||||
try {
|
||||
// console.log('checkdir', folderprof);
|
||||
if (!await tools.isFileExistsAsync(folderprof)) {
|
||||
if (!(await tools.isFileExistsAsync(folderprof))) {
|
||||
console.log('*** Creadir', folderprof);
|
||||
await fs.mkdirSync(folderprof);
|
||||
}
|
||||
|
||||
folderprof = dir + 'profile/' + myuser.username + '/' + table;
|
||||
// console.log('checkdir', folderprof);
|
||||
if (!await tools.isFileExistsAsync(folderprof)) {
|
||||
if (!(await tools.isFileExistsAsync(folderprof))) {
|
||||
console.log('creadir', folderprof);
|
||||
await fs.mkdirSync(folderprof);
|
||||
}
|
||||
@@ -559,18 +575,18 @@ connectToDatabase(connectionUrl, options)
|
||||
// console.log('file', file);
|
||||
// console.log('filefrom', filefrom);
|
||||
|
||||
if (!await tools.isFileExistsAsync(file)) {
|
||||
if (!(await tools.isFileExistsAsync(file))) {
|
||||
// non esiste
|
||||
console.log('non esiste', file);
|
||||
console.log(' filefrom', filefrom);
|
||||
console.log(' filefrom2', filefrom2);
|
||||
}
|
||||
|
||||
if (!await tools.isFileExistsAsync(file) && await tools.isFileExistsAsync(filefrom)) {
|
||||
if (!(await tools.isFileExistsAsync(file)) && (await tools.isFileExistsAsync(filefrom))) {
|
||||
console.log('@@@@@@ copia file:', filefrom, 'a', file);
|
||||
tools.copy(filefrom, file);
|
||||
}
|
||||
if (!await tools.isFileExistsAsync(file) && await tools.isFileExistsAsync(filefrom2)) {
|
||||
if (!(await tools.isFileExistsAsync(file)) && (await tools.isFileExistsAsync(filefrom2))) {
|
||||
console.log('@@@@@@ copia file 2:', filefrom2, 'a', file);
|
||||
tools.copy(filefrom2, file);
|
||||
}
|
||||
@@ -693,10 +709,10 @@ connectToDatabase(connectionUrl, options)
|
||||
}
|
||||
|
||||
// Verifica esistenza file
|
||||
if (!await tools.isFileExistsAsync(keyPath)) {
|
||||
if (!(await tools.isFileExistsAsync(keyPath))) {
|
||||
throw new Error(`Chiave privata non trovata: ${keyPath}`);
|
||||
}
|
||||
if (!await tools.isFileExistsAsync(certPath)) {
|
||||
if (!(await tools.isFileExistsAsync(certPath))) {
|
||||
throw new Error(`Certificato non trovato: ${certPath}`);
|
||||
}
|
||||
|
||||
@@ -772,8 +788,13 @@ connectToDatabase(connectionUrl, options)
|
||||
|
||||
function buildAllowedOrigins(domains, domainsAllowed, isProduction) {
|
||||
if (!isProduction) {
|
||||
return ['https://localhost:3000', 'https://localhost:8089', 'https://localhost:8084',
|
||||
'https://localhost:8088', 'https://localhost:8099'];
|
||||
return [
|
||||
'https://localhost:3000',
|
||||
'https://localhost:8089',
|
||||
'https://localhost:8084',
|
||||
'https://localhost:8088',
|
||||
'https://localhost:8099',
|
||||
];
|
||||
}
|
||||
|
||||
const baseOrigins = domains.flatMap((domain) => [
|
||||
@@ -804,7 +825,7 @@ connectToDatabase(connectionUrl, options)
|
||||
|
||||
const originValidator = (origin, callback) => {
|
||||
if (!origin) {
|
||||
console.log('✅ Origin undefined or empty — allowing');
|
||||
// console.log('✅ Origin undefined or empty — allowing');
|
||||
return callback(null, true);
|
||||
}
|
||||
|
||||
@@ -947,7 +968,7 @@ connectToDatabase(connectionUrl, options)
|
||||
if (scriptProcess) scriptProcess.kill();
|
||||
|
||||
const scriptPath = path.join(__dirname, '..', '..', parsed.scriptName);
|
||||
if (!await tools.isFileExistsAsync(scriptPath)) {
|
||||
if (!(await tools.isFileExistsAsync(scriptPath))) {
|
||||
return ws.send(JSON.stringify({ type: 'error', data: 'Script non trovato o non autorizzato' }));
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -361,6 +361,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
for (const user of arrusers) {
|
||||
try {
|
||||
const mytitle = await tools.convertSpecialTags(user, params.title);
|
||||
const mycontent = await tools.convertSpecialTags(
|
||||
user,
|
||||
@@ -402,7 +403,7 @@ module.exports = {
|
||||
myparam.actions,
|
||||
myparam.id
|
||||
)
|
||||
.then((ris) => {})
|
||||
.then((ris) => { })
|
||||
.catch((e) => {
|
||||
console.error(e.message);
|
||||
});
|
||||
@@ -426,7 +427,7 @@ module.exports = {
|
||||
|
||||
try {
|
||||
if (risult && (risult.text || risult.caption)) textsent = risult.text || risult.caption;
|
||||
} catch (e) {}
|
||||
} catch (e) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -440,6 +441,9 @@ module.exports = {
|
||||
console.log('Inviati ', nummsgsent, 'messaggi...');
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Errore Invio Notifica a ', user.username, 'Err:', e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user