@nka212bg/backend-utils 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/mailSmsTools/index.js +2 -2
- package/misc.js +3 -1
- package/package.json +1 -1
package/mailSmsTools/index.js
CHANGED
|
@@ -22,7 +22,7 @@ const mailTransport = nodemailer.createTransport({
|
|
|
22
22
|
},
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
exports.sendEmail = async ({ email, content, subject, attachments, unsubscribe, userIp } = {}) => {
|
|
25
|
+
exports.sendEmail = async ({ email, content, subject, attachments, unsubscribe, userIp, logoUrl } = {}) => {
|
|
26
26
|
if (!content) return { error: "missing_content" };
|
|
27
27
|
if (!subject || subject === "") subject = email_content.substring(0, 25) + "... ";
|
|
28
28
|
|
|
@@ -61,7 +61,7 @@ exports.sendEmail = async ({ email, content, subject, attachments, unsubscribe,
|
|
|
61
61
|
<tbody>
|
|
62
62
|
<tr>
|
|
63
63
|
<td style="padding-bottom: 6px">
|
|
64
|
-
<img src="${process.env.BASE_URL}/logo_black.png" style="height: 36px; background-size: contain; background-repeat: no-repeat" />
|
|
64
|
+
<img src="${logoUrl || `${process.env.BASE_URL}/logo_black.png`}" style="height: 36px; background-size: contain; background-repeat: no-repeat" />
|
|
65
65
|
</td>
|
|
66
66
|
</tr>
|
|
67
67
|
<tr><td style="padding-bottom: 20px">${content}</td></tr>
|
package/misc.js
CHANGED
|
@@ -415,7 +415,9 @@ exports.urlMetadata = async ({ url }) => {
|
|
|
415
415
|
const fxIndex = tempUrl.pathname.lastIndexOf(".");
|
|
416
416
|
fileExtension = fxIndex < 0 ? null : tempUrl.pathname.substring(fxIndex + 1)?.match(/\w+/)[0];
|
|
417
417
|
|
|
418
|
-
let fetchRes = await fetch(url
|
|
418
|
+
let fetchRes = await fetch(url, {
|
|
419
|
+
headers: { "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0" },
|
|
420
|
+
});
|
|
419
421
|
|
|
420
422
|
const sizeKb = parseInt(Number(fetchRes.headers?.get("content-length")) / 1000);
|
|
421
423
|
let contentType = fetchRes.headers?.get("content-type")?.split("/") || [];
|