- corretto sendemail password... l'ho cambiata. e ho messo dei controlli
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user