Skip to content

Commit 7df0d05

Browse files
committed
Fixes
1 parent 59a1436 commit 7df0d05

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

api/utils/render.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ exports.renderView = function(options, cb) {
6868
XDG_CONFIG_HOME: pathModule.resolve(__dirname, "../../.cache/chrome/tmp/.chromium"),
6969
XDG_CACHE_HOME: pathModule.resolve(__dirname, "../../.cache/chrome/tmp/.chromium")
7070
},
71-
args: ['--no-sandbox', '--disable-setuid-sandbox', '--ignore-certificate-errors'],
71+
args: ['--no-sandbox', '--disable-setuid-sandbox', '--ignore-certificate-errors', '--disable-web-security'],
7272
ignoreHTTPSErrors: true,
7373
userDataDir: pathModule.resolve(__dirname, "../../dump/chrome/" + Date.now())
7474
};
@@ -82,6 +82,7 @@ exports.renderView = function(options, cb) {
8282
try {
8383
log.d('Started rendering images');
8484
var page = await browser.newPage();
85+
await page.setBypassCSP(true);
8586

8687
page.on('console', (msg) => {
8788
log.d("Headless chrome page log", msg.text());

plugins/reports/api/api.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ const FEATURE_NAME = 'reports';
417417
common.returnMessage(params, 200, err2);
418418
}
419419
else {
420-
if (params && params.res) {
420+
if (res) {
421421
var html = res.message;
422422
if (result.report_type !== "core") {
423423
html = ejs.render(res.message.template, res.message.data);
@@ -455,13 +455,14 @@ const FEATURE_NAME = 'reports';
455455
common.returnMessage(params, 200, err2);
456456
}
457457
else {
458-
if (params && params.res) {
458+
if (res) {
459459
var html = res.message;
460460
if (result.report_type !== "core") {
461461
html = ejs.render(res.message.template, res.message.data);
462462
}
463463
const filePath = '/tmp/email_report_' + new Date().getTime() + '.pdf';
464464
const options = { "path": filePath, "width": "1028px", height: "1000px" };
465+
465466
pdf.renderPDF(html, function() {
466467
//output created file to browser
467468
fs.readFile(filePath, function(err3, data) {

plugins/reports/frontend/public/templates/email.html

100755100644
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@
9090
#report-title { font-size: 25px !important; line-height: 30px !important; }
9191
#report-title span { font-size: 20px; }
9292
}
93+
@media print {
94+
.mobile-no-margin {
95+
margin:0px 0px !important;
96+
max-width: 100% !important;
97+
}
98+
}
9399
</style>
94100
</head>
95101
<body style="margin: 0; padding: 0; background-color:#f2f2f2;">
@@ -398,7 +404,8 @@
398404

399405
<% } %>
400406
<% } %>
401-
<tr class=" <td>
407+
<tr class="desktop-table" >
408+
<td>
402409
<!-- ONE COLUMN SECTION -->
403410
<table border="0" cellpadding="0" cellspacing="0" width="100%">
404411
<tr>

0 commit comments

Comments
 (0)