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

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.381",
3
+ "version": "1.8.383",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -12,7 +12,7 @@ import MailboxContactEmail from "./MailboxContactEmail.js";
12
12
  import type ChannelEmail from "./ChannelEmail.js";
13
13
  import { User } from "./User.js";
14
14
  import type SubscriberActivity from "./SubscriberActivity.js";
15
- import { IgnoreJsonProperty, ReadOnlyJsonProperty } from "@entity-access/server-pages/dist/services/ModelService.js";
15
+ import { IgnoreJsonProperty, JsonProperty, ReadOnlyJsonProperty } from "@entity-access/server-pages/dist/services/ModelService.js";
16
16
  import type EmailEngagement from "./EmailEngagement.js";
17
17
  import Sql from "@entity-access/entity-access/dist/sql/Sql.js";
18
18
  import { apiPath } from "../../../common/globalEnv.js";
@@ -262,6 +262,9 @@ export class Email {
262
262
  @ReadOnlyJsonProperty
263
263
  postID: string;
264
264
 
265
+ @JsonProperty()
266
+ public sanitizedHtml: string;
267
+
265
268
  public tempID: any;
266
269
 
267
270
  public mimeFile: EmailLog;
@@ -352,29 +352,7 @@ export default class EmailEvents extends AuthenticatedEvents<Email> {
352
352
  if (entity.htmlBody) {
353
353
  if (entity.status === "published") {
354
354
  entity.htmlBody = null;
355
- } else {
356
- const htmlService = ServiceProvider.resolve(this, HtmlSanitizer);
357
- const encryptionService = ServiceProvider.resolve(this, EncryptionService);
358
- const emailID = entity.emailID.toString();
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
- }
369
- const result = htmlService.sanitizeExternalResources({
370
- html: entity.htmlBody,
371
- text: entity.textBody,
372
- prefix
373
- });
374
- entity.htmlBody = result.html;
375
- entity.textBody = result.text;
376
355
  }
377
-
378
356
  // const blog = entity.status === "published"
379
357
  // ? `@` + entity.senderName.split("@")[0]
380
358
  // : "";
@@ -15,7 +15,7 @@ export default class StoreAccountEmailEvents extends AuthenticatedEvents<StoreAc
15
15
  }
16
16
 
17
17
  return query.where(this.sessionUser, (p) => (x) =>
18
- x.accountID === p.userID
18
+ x.storeAccount.userID === p.userID
19
19
  || Sql.text.likeAny(x.storeAccount.store.folder.path, p.writeFileAccess)
20
20
  );
21
21
  }
@@ -3,12 +3,9 @@ import AuthenticatedEvents from "./AuthenticatedEvents.js";
3
3
  import EntityAccessError from "@entity-access/entity-access/dist/common/EntityAccessError.js";
4
4
  import { StoreAccount } from "../entities/StoreAccount.js";
5
5
  import ChangeEntry from "@entity-access/entity-access/dist/model/changes/ChangeEntry.js";
6
- import Inject, { ServiceProvider } from "@entity-access/entity-access/dist/di/di.js";
6
+ import Inject from "@entity-access/entity-access/dist/di/di.js";
7
7
  import Sql from "@entity-access/entity-access/dist/sql/Sql.js";
8
8
  import SocialMailContext from "../SocialMailContext.js";
9
- import { randomUUID } from "crypto";
10
- import DateTime from "@entity-access/entity-access/dist/types/DateTime.js";
11
- import CryptoService from "../../services/CryptoService.js";
12
9
 
13
10
  export default class StoreAccountEvents extends AuthenticatedEvents<StoreAccount> {
14
11
 
@@ -24,7 +21,8 @@ export default class StoreAccountEvents extends AuthenticatedEvents<StoreAccount
24
21
  return query;
25
22
  }
26
23
  return query.where(sessionUser, (p) => (x) =>
27
- Sql.text.likeAny(x.store.folder.path, p.writeFileAccess)
24
+ x.userID === p.userID
25
+ || Sql.text.likeAny(x.store.folder.path, p.writeFileAccess)
28
26
  );
29
27
  }
30
28
 
@@ -49,29 +47,7 @@ export default class StoreAccountEvents extends AuthenticatedEvents<StoreAccount
49
47
 
50
48
  async beforeInsert(entity: StoreAccount, entry: ChangeEntry<StoreAccount>) {
51
49
  this.sessionUser.ensureLoggedIn();
52
-
53
- // create a user...
54
- if (!(entity.user || entity.accountID)) {
55
- const dateCreated = DateTime.now;
56
-
57
- const password = randomUUID();
58
-
59
- const cryptoService = ServiceProvider.resolve(this, CryptoService);
60
-
61
- const passwordSalt = cryptoService.generateSalt();
62
- const passwordHash = cryptoService.hash(passwordSalt, password);
63
-
64
- const user = await this.db.users.statements.insert({
65
- userName: randomUUID(),
66
- displayName: entity.name,
67
- passwordSalt,
68
- passwordHash,
69
- multiFactor: false,
70
- dateUpdated: dateCreated,
71
- isExternal: true
72
- });
73
- entity.accountID = user.userID;
74
- }
50
+ entity.userID = this.sessionUser.userID;
75
51
  }
76
52
 
77
53
  beforeUpdate(entity: StoreAccount, entry: ChangeEntry<StoreAccount>) {
@@ -15,7 +15,7 @@ export default class StoreAccountPhoneEvents extends AuthenticatedEvents<StoreAc
15
15
  }
16
16
 
17
17
  return query.where(this.sessionUser, (p) => (x) =>
18
- x.accountID === p.userID
18
+ x.storeAccount.userID === p.userID
19
19
  || Sql.text.likeAny(x.storeAccount.store.folder.path, p.writeFileAccess)
20
20
  );
21
21
  }
@@ -17,7 +17,7 @@ export default async function seedUI(config: DBConfig) {
17
17
  await config.saveVersion(UIPackageConfig, {
18
18
  package: "@social-mail/social-mail-client",
19
19
  view: "dist/web/AppIndex",
20
- version: "1.9.75"
20
+ version: "1.9.78"
21
21
  });
22
22
 
23
23
  await config.saveVersion(WebComponentsPackageConfig, {