@social-mail/social-mail-web-server 1.5.149 → 1.5.151
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/server/seed/ui/seed-ui.js +1 -1
- package/dist/server/services/channels/ChannelPageService.js +1 -1
- package/dist/server/services/channels/ChannelPageService.js.map +1 -1
- package/dist/server/services/ui/renderUIClient.d.ts.map +1 -1
- package/dist/server/services/ui/renderUIClient.js +2 -0
- package/dist/server/services/ui/renderUIClient.js.map +1 -1
- package/dist/server/workflows/smtp/DispatchEmailToMX.d.ts +2 -1
- package/dist/server/workflows/smtp/DispatchEmailToMX.d.ts.map +1 -1
- package/dist/server/workflows/smtp/DispatchEmailToMX.js +24 -5
- package/dist/server/workflows/smtp/DispatchEmailToMX.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/server/seed/ui/seed-ui.ts +1 -1
- package/src/server/services/channels/ChannelPageService.tsx +1 -1
- package/src/server/services/ui/renderUIClient.tsx +3 -0
- package/src/server/workflows/smtp/DispatchEmailToMX.ts +26 -4
package/package.json
CHANGED
|
@@ -62,7 +62,7 @@ export default class ChannelPageService {
|
|
|
62
62
|
mailboxSlug = mailboxSlug.toLowerCase();
|
|
63
63
|
postSlug = postSlug.toLowerCase();
|
|
64
64
|
|
|
65
|
-
const { 1: emailIDBase36 } = /\-([^\-]+)
|
|
65
|
+
const { 1: emailIDBase36 } = /\-([^\-]+)\/?$/.exec(postSlug);
|
|
66
66
|
|
|
67
67
|
const emailID = Base36.decode(emailIDBase36) as any;
|
|
68
68
|
|
|
@@ -31,6 +31,9 @@ export const renderUIClient = async (page: Page, view?: string ) => {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
+
page.response.setHeader("Cross-Origin-Opener-Policy", "same-origin");
|
|
35
|
+
page.response.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
|
|
36
|
+
|
|
34
37
|
return Content.html(<HtmlDocument>
|
|
35
38
|
<head>
|
|
36
39
|
<meta charset="utf-8"/>
|
|
@@ -21,6 +21,7 @@ import PostReceiveWorkflow from "../post-receive/PostReceiveWorkflow.js";
|
|
|
21
21
|
import ESmtpClient from "../../../protocols/smtp/ESmtpClient.js";
|
|
22
22
|
import DnsService from "../../smtp/dns/DnsService.js";
|
|
23
23
|
import Sql from "@entity-access/entity-access/dist/sql/Sql.js";
|
|
24
|
+
import EncryptionService from "../../services/encryption/EncryptionService.js";
|
|
24
25
|
|
|
25
26
|
export const smtpPool = new NamedObjectPool<SMTPClient>((host) => ({
|
|
26
27
|
asyncFactory: () => new SMTPClient({ host }).connect(),
|
|
@@ -103,20 +104,41 @@ export default class DispatchEmailToMX extends Workflow<IMessageEnvelope> {
|
|
|
103
104
|
@Inject els?: EmailLogService,
|
|
104
105
|
@Inject eas?: EmailAddressService,
|
|
105
106
|
@Inject db?: SocialMailContext,
|
|
106
|
-
@Inject dnsService?: DnsService
|
|
107
|
+
@Inject dnsService?: DnsService,
|
|
108
|
+
@Inject es?: EncryptionService
|
|
107
109
|
) {
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
let st = await db.mailboxSyncTargets
|
|
110
112
|
.where(this.input, (p) => (x) => x.mailboxID === p.senderID
|
|
111
113
|
&& (x.direction === "out" || x.protocol === "smtp")
|
|
112
114
|
&& x.active === true)
|
|
113
115
|
.first();
|
|
114
116
|
|
|
115
117
|
if (!st) {
|
|
116
|
-
|
|
118
|
+
|
|
119
|
+
// recreate smtp from imap
|
|
120
|
+
const it = await db.mailboxSyncTargets.where(this.input, (p) => (x) => x.mailboxID === p.senderID
|
|
121
|
+
&& x.active === true
|
|
122
|
+
&& (x.direction === "in" || x.protocol === "imap")
|
|
123
|
+
).first();
|
|
124
|
+
|
|
125
|
+
if (it?.host?.startsWith("imap.")) {
|
|
126
|
+
st = {
|
|
127
|
+
... it,
|
|
128
|
+
syncTargetID: void 0,
|
|
129
|
+
host: it.host.replace("imap.", "smtp."),
|
|
130
|
+
port: it.port === 993 ? 465 : 25
|
|
131
|
+
};
|
|
132
|
+
await db.mailboxSyncTargets.statements.insert(st);
|
|
133
|
+
} else {
|
|
134
|
+
throw new Error(`No Smtp Settings Available to send an email.`);
|
|
135
|
+
}
|
|
117
136
|
}
|
|
118
137
|
|
|
119
|
-
const { host, username, password } = st;
|
|
138
|
+
const { host, username, password: passwordEncrypted } = st;
|
|
139
|
+
|
|
140
|
+
const password = es.decrypt(passwordEncrypted);
|
|
141
|
+
|
|
120
142
|
|
|
121
143
|
await using client = await ESmtpClient.connect({
|
|
122
144
|
host,
|