nodebb-plugin-simple-contact 2.1.3 → 2.1.5
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/library.js +9 -37
- package/package.json +2 -1
- package/public/templates/emails/contact-reply.tpl +25 -0
package/library.js
CHANGED
|
@@ -222,54 +222,26 @@ async function deleteRequest(req, res) {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
async function replyToContact(req, res) {
|
|
225
|
-
const { email, subject, content
|
|
225
|
+
const { email, subject, content } = req.body;
|
|
226
226
|
|
|
227
227
|
if (!email || !content) {
|
|
228
228
|
return res.status(400).json({ error: 'חסרים נתונים לשליחה' });
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
try {
|
|
232
|
-
const
|
|
232
|
+
const htmlBody = content.replace(/\n/g, '<br>');
|
|
233
|
+
|
|
233
234
|
const siteTitle = meta.config['title'] || 'NetFree';
|
|
235
|
+
const logo = meta.config['brand:emailLogo'] || meta.config['brand:logo'];
|
|
234
236
|
|
|
235
|
-
|
|
236
|
-
if (logoUrl) {
|
|
237
|
-
const fullLogoUrl = logoUrl.startsWith('http') ? logoUrl : (meta.config['url'] + logoUrl);
|
|
238
|
-
logoHtml = `<div style="text-align: center; margin-bottom: 20px;">
|
|
239
|
-
<img src="${fullLogoUrl}" alt="${siteTitle}" style="max-height: 50px; width: auto; border: 0;">
|
|
240
|
-
</div>`;
|
|
241
|
-
} else {
|
|
242
|
-
logoHtml = `<div style="text-align: center; margin-bottom: 20px; font-weight: bold; font-size: 18px;">${siteTitle}</div>`;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
const rawHtml = content.replace(/\n/g, '<br>');
|
|
246
|
-
|
|
247
|
-
const fullBodyHtml = `
|
|
248
|
-
<div dir="rtl" style="direction: rtl; text-align: right; font-family: Arial, sans-serif; background-color: #ffffff; padding: 10px;">
|
|
249
|
-
${logoHtml}
|
|
250
|
-
<div style="font-size: 14px; color: #333; line-height: 1.6;">
|
|
251
|
-
${rawHtml}
|
|
252
|
-
</div>
|
|
253
|
-
</div>
|
|
254
|
-
`;
|
|
255
|
-
|
|
256
|
-
const introHtml = '<div dir="rtl" style="direction: rtl; text-align: right; font-family: Arial, sans-serif;">שלום, קיבלת תשובה חדשה לפנייתך:</div>';
|
|
257
|
-
|
|
258
|
-
await emailer.sendToEmail('notification', email, 'he', {
|
|
237
|
+
await emailer.sendToEmail('contact-reply', email, 'he', {
|
|
259
238
|
subject: subject || 'תשובה לפנייתך בצור קשר',
|
|
260
|
-
|
|
239
|
+
body: htmlBody,
|
|
261
240
|
|
|
262
|
-
notification: {
|
|
263
|
-
type: 'contact-reply',
|
|
264
|
-
bodyShort: subject || 'תשובה לפנייה',
|
|
265
|
-
bodyLong: fullBodyHtml,
|
|
266
|
-
path: ''
|
|
267
|
-
},
|
|
268
|
-
|
|
269
|
-
body: fullBodyHtml,
|
|
270
|
-
intro: introHtml,
|
|
271
241
|
site_title: siteTitle,
|
|
272
|
-
url: meta.config['url']
|
|
242
|
+
url: meta.config['url'],
|
|
243
|
+
"brand:logo": meta.config['brand:logo'],
|
|
244
|
+
"brand:emailLogo": meta.config['brand:emailLogo']
|
|
273
245
|
});
|
|
274
246
|
|
|
275
247
|
res.json({ success: true });
|
package/package.json
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<div dir="rtl" style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; direction: rtl; text-align: right; background-color: #f9f9f9; padding: 20px;">
|
|
2
|
+
|
|
3
|
+
<div style="text-align: center; margin-bottom: 30px;">
|
|
4
|
+
<img src="{url}{brand:emailLogo}" alt="{site_title}" style="max-height: 60px; border: 0;">
|
|
5
|
+
<img src="{url}{brand:logo}" alt="{site_title}" style="max-height: 60px; border: 0;">
|
|
6
|
+
<h1 style="color: #333;">{site_title}</h1>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
<div style="background-color: #ffffff; border: 1px solid #e0e0e0; border-radius: 8px; padding: 30px; max-width: 600px; margin: 0 auto; box-shadow: 0 2px 4px rgba(0,0,0,0.05);">
|
|
10
|
+
|
|
11
|
+
<h2 style="margin-top: 0; color: #333; font-size: 20px; border-bottom: 1px solid #eee; padding-bottom: 15px;">
|
|
12
|
+
שלום, קיבלנו את פנייתך,
|
|
13
|
+
</h2>
|
|
14
|
+
|
|
15
|
+
<div style="font-size: 16px; color: #444; line-height: 1.6; margin-top: 20px;">
|
|
16
|
+
{body}
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div style="text-align: center; margin-top: 20px; font-size: 12px; color: #999;">
|
|
22
|
+
הודעה זו נשלחה אוטומטית מאתר <a href="{url}" style="color: #666; text-decoration: none;">{site_title}</a>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
</div>
|