@social-mail/social-mail-web-server 1.7.91 → 1.7.92
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/dist/protocols/core/ReactionExtractor.d.ts +4 -1
- package/dist/protocols/core/ReactionExtractor.d.ts.map +1 -1
- package/dist/protocols/core/ReactionExtractor.js +9 -3
- package/dist/protocols/core/ReactionExtractor.js.map +1 -1
- package/dist/server/smtp/services/EmailSerializerService.d.ts.map +1 -1
- package/dist/server/smtp/services/EmailSerializerService.js +8 -0
- package/dist/server/smtp/services/EmailSerializerService.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/protocols/core/ReactionExtractor.ts +10 -4
- package/src/server/smtp/services/EmailSerializerService.ts +11 -0
package/package.json
CHANGED
|
@@ -14,14 +14,20 @@ export const ReactionExtractor = {
|
|
|
14
14
|
headers: string | {[key: string]: any}
|
|
15
15
|
}, attachmentsLoader: () => Promise<{ contentType: string }[]>, forceFullMatch = true) {
|
|
16
16
|
try {
|
|
17
|
-
let inReplyTo = null;
|
|
17
|
+
let inReplyTo = null as string;
|
|
18
|
+
let emailID = null as string;
|
|
18
19
|
let engagement: string;
|
|
19
|
-
|
|
20
|
+
let index = email.subject.indexOf(":");
|
|
20
21
|
if (index !== -1 && index <= 50) {
|
|
21
22
|
engagement = email.subject.substring(0, index);
|
|
22
23
|
inReplyTo = email.subject.substring(index + 1);
|
|
24
|
+
index = inReplyTo.indexOf(":");
|
|
25
|
+
if (index !== -1) {
|
|
26
|
+
emailID = inReplyTo.substring(0, index);
|
|
27
|
+
inReplyTo = inReplyTo.substring(index+1);
|
|
28
|
+
}
|
|
23
29
|
if (/\p{Emoji}/u.test(engagement)) {
|
|
24
|
-
return { engagement, inReplyTo };
|
|
30
|
+
return { engagement, inReplyTo, emailID };
|
|
25
31
|
}
|
|
26
32
|
}
|
|
27
33
|
|
|
@@ -40,7 +46,7 @@ export const ReactionExtractor = {
|
|
|
40
46
|
engagement = matches[0];
|
|
41
47
|
|
|
42
48
|
if (engagement === textBody) {
|
|
43
|
-
return { engagement };
|
|
49
|
+
return { engagement, inReplyTo, emailID };
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
/**
|
|
@@ -27,6 +27,7 @@ import { ReactionExtractor } from "../../../protocols/core/ReactionExtractor.js"
|
|
|
27
27
|
import { stripBrackets } from "../../../common/stripBrackets.js";
|
|
28
28
|
import SmtpError from "./SmtpError.js";
|
|
29
29
|
import { SmtpStatusCodes } from "../client/SmtpStatusCodes.js";
|
|
30
|
+
import { Base36 } from "../../../common/Base36.js";
|
|
30
31
|
// import PostReceiveWorkflow from "../../workflows/post-receive/PostReceiveWorkflow.js";
|
|
31
32
|
// import UpdateEmailReferences from "../../workflows/incoming/UpdateEmailReferences.js";
|
|
32
33
|
|
|
@@ -366,6 +367,8 @@ export default class EmailSerializerService {
|
|
|
366
367
|
|
|
367
368
|
let engagement = null;
|
|
368
369
|
|
|
370
|
+
let verifyParentID = null;
|
|
371
|
+
|
|
369
372
|
if (received) {
|
|
370
373
|
// check for engagements...
|
|
371
374
|
const e1 = await ReactionExtractor.extractWithInReplyTo({
|
|
@@ -377,6 +380,7 @@ export default class EmailSerializerService {
|
|
|
377
380
|
engagement = e1.engagement;
|
|
378
381
|
if (!inReplyTo) {
|
|
379
382
|
inReplyTo = e1.inReplyTo;
|
|
383
|
+
verifyParentID = Base36.decode(e1.emailID) as any;
|
|
380
384
|
}
|
|
381
385
|
}
|
|
382
386
|
|
|
@@ -386,6 +390,13 @@ export default class EmailSerializerService {
|
|
|
386
390
|
.orderBy(void 0,(p) => (x) => x.emailID)
|
|
387
391
|
.first();
|
|
388
392
|
if (original) {
|
|
393
|
+
|
|
394
|
+
if (verifyParentID) {
|
|
395
|
+
if(verifyParentID !== original.emailID) {
|
|
396
|
+
throw new SmtpError("Unable to process this email.", SmtpStatusCodes.DeliveryNotPermitted);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
389
400
|
parentID = original.emailID;
|
|
390
401
|
inReplyTo = null;
|
|
391
402
|
}
|