@social-mail/social-mail-web-server 1.8.380 → 1.8.381

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-web-server",
3
- "version": "1.8.380",
3
+ "version": "1.8.381",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -356,11 +356,20 @@ export default class EmailEvents extends AuthenticatedEvents<Email> {
356
356
  const htmlService = ServiceProvider.resolve(this, HtmlSanitizer);
357
357
  const encryptionService = ServiceProvider.resolve(this, EncryptionService);
358
358
  const emailID = entity.emailID.toString();
359
- const ei = encryptionService.general.encrypt(emailID);
359
+ let ei;
360
+ let prefix;
361
+ const { host, encryptionKey } = globalEnv.emailContentProxy;
362
+ if (host) {
363
+ ei = encryptionService.global.encrypt(emailID.toString(), encryptionKey, host);
364
+ prefix = `https://${host}/api/emails/d/${ei}/${emailID}/`;
365
+ } else {
366
+ ei = encryptionService.general.encrypt(emailID.toString());
367
+ prefix = `/api/emails/d/${ei}/${emailID}/`;
368
+ }
360
369
  const result = htmlService.sanitizeExternalResources({
361
370
  html: entity.htmlBody,
362
371
  text: entity.textBody,
363
- prefix: `/api/emails/d/${ei}/${emailID}/`
372
+ prefix
364
373
  });
365
374
  entity.htmlBody = result.html;
366
375
  entity.textBody = result.text;