@social-mail/social-mail-web-server 1.8.421 → 1.8.423

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.
Files changed (54) hide show
  1. package/dist/server/seed/ui/seed-ui.js +1 -1
  2. package/dist/server/services/replica/ReplicaReader.d.ts +7 -0
  3. package/dist/server/services/replica/ReplicaReader.d.ts.map +1 -0
  4. package/dist/server/services/replica/ReplicaReader.js +45 -0
  5. package/dist/server/services/replica/ReplicaReader.js.map +1 -0
  6. package/dist/tsconfig.tsbuildinfo +1 -1
  7. package/dist/wwwroot/routes/api/files/get.d.ts +2 -2
  8. package/dist/wwwroot/routes/api/files/get.d.ts.map +1 -1
  9. package/dist/wwwroot/routes/api/files/get.js +26 -13
  10. package/dist/wwwroot/routes/api/files/get.js.map +1 -1
  11. package/dist/wwwroot/routes/social-mail/c/d/[domain]/[type]/[postID]/[fileID]/index.d.ts +2 -3
  12. package/dist/wwwroot/routes/social-mail/c/d/[domain]/[type]/[postID]/[fileID]/index.d.ts.map +1 -1
  13. package/dist/wwwroot/routes/social-mail/c/d/[domain]/[type]/[postID]/[fileID]/index.js +9 -5
  14. package/dist/wwwroot/routes/social-mail/c/d/[domain]/[type]/[postID]/[fileID]/index.js.map +1 -1
  15. package/dist/wwwroot/routes/social-mail/c/e/[eDomain]/[type]/[eFileContentID]/index.d.ts +2 -3
  16. package/dist/wwwroot/routes/social-mail/c/e/[eDomain]/[type]/[eFileContentID]/index.d.ts.map +1 -1
  17. package/dist/wwwroot/routes/social-mail/c/e/[eDomain]/[type]/[eFileContentID]/index.js +9 -5
  18. package/dist/wwwroot/routes/social-mail/c/e/[eDomain]/[type]/[eFileContentID]/index.js.map +1 -1
  19. package/dist/wwwroot/routes/social-mail/c/u/[activityID]/[accessCode]/index.d.ts +2 -0
  20. package/dist/wwwroot/routes/social-mail/c/u/[activityID]/[accessCode]/index.d.ts.map +1 -1
  21. package/dist/wwwroot/routes/social-mail/c/u/[activityID]/[accessCode]/index.js +7 -2
  22. package/dist/wwwroot/routes/social-mail/c/u/[activityID]/[accessCode]/index.js.map +1 -1
  23. package/dist/wwwroot/routes/social-mail/cd/[domain]/[type]/[postID]/[fileID]/index.d.ts +1 -1
  24. package/dist/wwwroot/routes/social-mail/cd/[domain]/[type]/[postID]/[fileID]/index.d.ts.map +1 -1
  25. package/dist/wwwroot/routes/social-mail/cd/[domain]/[type]/[postID]/[fileID]/index.js +5 -5
  26. package/dist/wwwroot/routes/social-mail/cd/[domain]/[type]/[postID]/[fileID]/index.js.map +1 -1
  27. package/dist/wwwroot/routes/social-mail/fd/[type]/[eFileID]/[eFileContentID]/[name]/index.d.ts +2 -3
  28. package/dist/wwwroot/routes/social-mail/fd/[type]/[eFileID]/[eFileContentID]/[name]/index.d.ts.map +1 -1
  29. package/dist/wwwroot/routes/social-mail/fd/[type]/[eFileID]/[eFileContentID]/[name]/index.js +8 -4
  30. package/dist/wwwroot/routes/social-mail/fd/[type]/[eFileID]/[eFileContentID]/[name]/index.js.map +1 -1
  31. package/dist/wwwroot/routes/social-mail/social/t/index.d.ts +2 -0
  32. package/dist/wwwroot/routes/social-mail/social/t/index.d.ts.map +1 -1
  33. package/dist/wwwroot/routes/social-mail/social/t/index.js +11 -5
  34. package/dist/wwwroot/routes/social-mail/social/t/index.js.map +1 -1
  35. package/package.json +1 -1
  36. package/src/server/seed/ui/seed-ui.ts +1 -1
  37. package/src/server/services/replica/ReplicaReader.ts +34 -0
  38. package/src/wwwroot/routes/api/files/get.ts +29 -15
  39. package/src/wwwroot/routes/social-mail/c/d/[domain]/[type]/[postID]/[fileID]/index.ts +9 -4
  40. package/src/wwwroot/routes/social-mail/c/e/[eDomain]/[type]/[eFileContentID]/index.ts +9 -4
  41. package/src/wwwroot/routes/social-mail/c/u/[activityID]/[accessCode]/index.tsx +6 -2
  42. package/src/wwwroot/routes/social-mail/cd/[domain]/[type]/[postID]/[fileID]/index.ts +4 -4
  43. package/src/wwwroot/routes/social-mail/fd/[type]/[eFileID]/[eFileContentID]/[name]/index.ts +7 -3
  44. package/src/wwwroot/routes/social-mail/social/t/index.tsx +9 -3
  45. package/dist/wwwroot/routes/api/emails/content/attachment/index.d.ts +0 -2
  46. package/dist/wwwroot/routes/api/emails/content/attachment/index.d.ts.map +0 -1
  47. package/dist/wwwroot/routes/api/emails/content/attachment/index.js +0 -41
  48. package/dist/wwwroot/routes/api/emails/content/attachment/index.js.map +0 -1
  49. package/dist/wwwroot/routes/api/emails/content/html/index.d.ts +0 -2
  50. package/dist/wwwroot/routes/api/emails/content/html/index.d.ts.map +0 -1
  51. package/dist/wwwroot/routes/api/emails/content/html/index.js +0 -41
  52. package/dist/wwwroot/routes/api/emails/content/html/index.js.map +0 -1
  53. package/src/wwwroot/routes/api/emails/content/attachment/index.ts +0 -53
  54. package/src/wwwroot/routes/api/emails/content/html/index.ts +0 -52
@@ -1,9 +1,10 @@
1
1
  import Inject from "@entity-access/entity-access/dist/di/di.js";
2
- import SocialMailContext from "../../../../server/model/SocialMailContext.js";
3
2
  import { TempFileResult } from "@entity-access/server-pages/dist/Content.js";
4
3
  import Page from "@entity-access/server-pages/dist/Page.js";
5
4
  import { Prepare } from "@entity-access/server-pages/dist/decorators/Prepare.js";
6
5
  import FileConversionService from "../../../../server/services/convert/FileConversionService.js";
6
+ import ReplicaReader from "../../../../server/services/replica/ReplicaReader.js";
7
+ import SocialMailContext from "../../../../server/model/SocialMailContext.js";
7
8
 
8
9
  @Prepare.authorize
9
10
  export default class extends Page {
@@ -11,6 +12,9 @@ export default class extends Page {
11
12
  @Inject
12
13
  private fcs: FileConversionService;
13
14
 
15
+ @Inject
16
+ private replica: ReplicaReader;
17
+
14
18
  @Inject
15
19
  private db: SocialMailContext;
16
20
 
@@ -20,25 +24,35 @@ export default class extends Page {
20
24
  // we will not convert as BigInt might have loss of data
21
25
  const fileID = this.childPath[1] as unknown as number;
22
26
  let fileContentID = this.childPath[2] as unknown as number;
23
-
24
27
  const fileName = this.childPath[this.childPath.length-1];
25
28
 
26
- if (!fileContentID) {
27
- // redirect...
28
- const fc1 = await this.db.appFiles.where({ fileID }, (p) => (x) => x.appFileID === p.fileID)
29
- .select(void 0, (p) => (x) => ({fileContentID: x.fileContentID}))
29
+ const appFile = await this.replica.query(async (db) => {
30
+
31
+ if (!fileContentID) {
32
+ // redirect...
33
+ const fc1 = await db.appFiles.where({ fileID }, (p) => (x) => x.appFileID === p.fileID)
34
+ .select(void 0, (p) => (x) => ({fileContentID: x.fileContentID}))
35
+ .first();
36
+ if (!fc1) {
37
+ return null;
38
+ }
39
+ fileContentID = fc1.fileContentID;
40
+ }
41
+
42
+ db.verifyFilters = true;
43
+ return await db.appFiles
44
+ .filtered("read")
45
+ .where({ fileID, fileContentID },
46
+ (p) => (x) => x.fileContentID === p.fileContentID
47
+ && x.appFileID === p.fileID)
48
+ .include((x) => x.fileContent)
30
49
  .first();
31
- fileContentID = fc1.fileContentID;
50
+ });
51
+
52
+ if (!appFile) {
53
+ return this.notFound();
32
54
  }
33
55
 
34
- this.db.verifyFilters = true;
35
- const appFile = await this.db.appFiles
36
- .filtered("read")
37
- .where({ fileID, fileContentID },
38
- (p) => (x) => x.fileContentID === p.fileContentID
39
- && x.appFileID === p.fileID)
40
- .include((x) => x.fileContent)
41
- .firstOrFail();
42
56
  this.db.verifyFilters = false;
43
57
  this.db.raiseEvents = false;
44
58
  this.cacheControl = "public, max-age=2592000, immutable";
@@ -3,9 +3,9 @@ import { TempFileResult } from "@entity-access/server-pages/dist/Content.js";
3
3
  import Page from "@entity-access/server-pages/dist/Page.js";
4
4
  import { Route } from "@entity-access/server-pages/dist/core/Route.js";
5
5
  import { CORS } from "../../../../../../../../../common/CORS.js";
6
- import SocialMailContext from "../../../../../../../../../server/model/SocialMailContext.js";
7
6
  import FileConversionService from "../../../../../../../../../server/services/convert/FileConversionService.js";
8
7
  import EncryptionService from "../../../../../../../../../server/services/encryption/EncryptionService.js";
8
+ import ReplicaReader from "../../../../../../../../../server/services/replica/ReplicaReader.js";
9
9
 
10
10
  export default class extends Page {
11
11
 
@@ -13,7 +13,7 @@ export default class extends Page {
13
13
  private fcs: FileConversionService;
14
14
 
15
15
  @Inject
16
- private db: SocialMailContext;
16
+ private replica: ReplicaReader;
17
17
 
18
18
  @Inject
19
19
  private ecs: EncryptionService;
@@ -39,13 +39,18 @@ export default class extends Page {
39
39
  const fileName = this.domain + "." + this.childPath[this.childPath.length-1];
40
40
 
41
41
  // verify host ...
42
- const appFile = await this.db.appFiles
42
+ const appFile = await this.replica.query((db) => db.appFiles
43
43
  .where({ fileID, emailID }, (p) => (x) =>
44
44
  x.appFileID === p.fileID
45
45
  && x.emailID === p.emailID
46
46
  )
47
47
  .include((x) => x.fileContent)
48
- .first();
48
+ .first());
49
+
50
+ if (!appFile) {
51
+ this.cacheControl = "public, max-age=600";
52
+ return this.notFound();
53
+ }
49
54
 
50
55
  this.cacheControl = "public, max-age=2592000, immutable";
51
56
 
@@ -3,9 +3,9 @@ import { TempFileResult } from "@entity-access/server-pages/dist/Content.js";
3
3
  import Page from "@entity-access/server-pages/dist/Page.js";
4
4
  import { Route } from "@entity-access/server-pages/dist/core/Route.js";
5
5
  import { CORS } from "../../../../../../../../common/CORS.js";
6
- import SocialMailContext from "../../../../../../../../server/model/SocialMailContext.js";
7
6
  import FileConversionService from "../../../../../../../../server/services/convert/FileConversionService.js";
8
7
  import EncryptionService from "../../../../../../../../server/services/encryption/EncryptionService.js";
8
+ import ReplicaReader from "../../../../../../../../server/services/replica/ReplicaReader.js";
9
9
 
10
10
  export default class extends Page {
11
11
 
@@ -13,7 +13,7 @@ export default class extends Page {
13
13
  private fcs: FileConversionService;
14
14
 
15
15
  @Inject
16
- private db: SocialMailContext;
16
+ private replica: ReplicaReader;
17
17
 
18
18
  @Inject
19
19
  private ecs: EncryptionService;
@@ -38,12 +38,17 @@ export default class extends Page {
38
38
  const fileName = senderDomain + "." + this.childPath[this.childPath.length-1];
39
39
 
40
40
  // verify host ...
41
- const appFile = await this.db.appFiles
41
+ const appFile = await this.replica.query((db) => db.appFiles
42
42
  .where({ eFileContentID }, (p) => (x) =>
43
43
  x.fileContentID === p.eFileContentID
44
44
  )
45
45
  .include((x) => x.fileContent)
46
- .first();
46
+ .first());
47
+
48
+ if (!appFile) {
49
+ this.cacheControl = "public, max-age=600";
50
+ return this.notFound();
51
+ }
47
52
 
48
53
  this.cacheControl = "public, max-age=2592000, immutable";
49
54
 
@@ -6,6 +6,7 @@ import XNode from "@entity-access/server-pages/dist/html/XNode.js";
6
6
  import Page from "@entity-access/server-pages/dist/Page.js";
7
7
  import SocialMailContext from "../../../../../../../server/model/SocialMailContext.js";
8
8
  import { Base36 } from "../../../../../../../common/Base36.js";
9
+ import ReplicaReader from "../../../../../../../server/services/replica/ReplicaReader.js";
9
10
 
10
11
  export default class UnsubscribePage extends Page {
11
12
 
@@ -18,16 +19,19 @@ export default class UnsubscribePage extends Page {
18
19
  @Inject
19
20
  db: SocialMailContext;
20
21
 
22
+ @Inject
23
+ replica: ReplicaReader;
24
+
21
25
  async run() {
22
26
 
23
27
  const { accessCode, activityID } = this;
24
28
 
25
29
  const uid = Base36.decode(activityID) as any;
26
30
 
27
- const sentActivity = await this.db.subscriberActivities.where({ uid, accessCode }, (p) => (x) =>
31
+ const sentActivity = await this.replica.query((db) => db.subscriberActivities.where({ uid, accessCode }, (p) => (x) =>
28
32
  x.accessCode === p.accessCode
29
33
  && x.activityID === p.uid
30
- ).first();
34
+ ).first());
31
35
 
32
36
  if (!sentActivity) {
33
37
  return Content.html(<HtmlDocument>
@@ -4,9 +4,9 @@ import Page from "@entity-access/server-pages/dist/Page.js";
4
4
  import { Prepare } from "@entity-access/server-pages/dist/decorators/Prepare.js";
5
5
  import { Route } from "@entity-access/server-pages/dist/core/Route.js";
6
6
  import { CORS } from "../../../../../../../../common/CORS.js";
7
- import SocialMailContext from "../../../../../../../../server/model/SocialMailContext.js";
8
7
  import FileConversionService from "../../../../../../../../server/services/convert/FileConversionService.js";
9
8
  import EncryptionService from "../../../../../../../../server/services/encryption/EncryptionService.js";
9
+ import ReplicaReader from "../../../../../../../../server/services/replica/ReplicaReader.js";
10
10
 
11
11
  @Prepare.authorize
12
12
  export default class extends Page {
@@ -15,7 +15,7 @@ export default class extends Page {
15
15
  private fcs: FileConversionService;
16
16
 
17
17
  @Inject
18
- private db: SocialMailContext;
18
+ private replica: ReplicaReader;
19
19
 
20
20
  @Inject
21
21
  private ecs: EncryptionService;
@@ -41,13 +41,13 @@ export default class extends Page {
41
41
  const fileName = this.domain + "." + this.childPath[this.childPath.length-1];
42
42
 
43
43
  // verify host ...
44
- const appFile = await this.db.appFiles
44
+ const appFile = await this.replica.query((db) => db.appFiles
45
45
  .where({ fileID, emailID }, (p) => (x) =>
46
46
  x.appFileID === p.fileID
47
47
  && x.emailID === p.emailID
48
48
  )
49
49
  .include((x) => x.fileContent)
50
- .first();
50
+ .first());
51
51
 
52
52
  this.cacheControl = "public, max-age=2592000, immutable";
53
53
 
@@ -4,10 +4,10 @@ import Page from "@entity-access/server-pages/dist/Page.js";
4
4
  import { Prepare } from "@entity-access/server-pages/dist/decorators/Prepare.js";
5
5
  import { Route } from "@entity-access/server-pages/dist/core/Route.js";
6
6
  import { CORS } from "../../../../../../../../common/CORS.js";
7
- import SocialMailContext from "../../../../../../../../server/model/SocialMailContext.js";
8
7
  import FileConversionService from "../../../../../../../../server/services/convert/FileConversionService.js";
9
8
  import EncryptionService from "../../../../../../../../server/services/encryption/EncryptionService.js";
10
9
  import SessionSecurity from "@entity-access/server-pages/dist/services/SessionSecurity.js";
10
+ import ReplicaReader from "../../../../../../../../server/services/replica/ReplicaReader.js";
11
11
 
12
12
  @Prepare.authorize
13
13
  export default class extends Page {
@@ -16,7 +16,7 @@ export default class extends Page {
16
16
  private fcs: FileConversionService;
17
17
 
18
18
  @Inject
19
- private db: SocialMailContext;
19
+ private replica: ReplicaReader;
20
20
 
21
21
  @Inject
22
22
  private sessionSecurity: SessionSecurity;
@@ -44,8 +44,12 @@ export default class extends Page {
44
44
 
45
45
  const { type } = this;
46
46
 
47
- const appFile = await this.db.appFiles.loadByKeys(keys);
47
+ const appFile = await this.replica.query((db) => db.appFiles.loadByKeys(keys));
48
48
 
49
+ if (!appFile) {
50
+ this.cacheControl = "public, max-age=300";
51
+ return this.notFound();
52
+ }
49
53
 
50
54
  this.cacheControl = "public, max-age=2592000, immutable";
51
55
 
@@ -3,6 +3,7 @@ import { Base36 } from "../../../../../common/Base36.js";
3
3
  import Inject from "@entity-access/entity-access/dist/di/di.js";
4
4
  import SocialMailContext from "../../../../../server/model/SocialMailContext.js";
5
5
  import UnreadCountService from "../../../../../server/services/emails/UnreadCountService.js";
6
+ import ReplicaReader from "../../../../../server/services/replica/ReplicaReader.js";
6
7
 
7
8
  const body = Buffer.from("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==", "base64");
8
9
 
@@ -27,6 +28,9 @@ export default class extends Page {
27
28
  return true;
28
29
  }
29
30
 
31
+ @Inject
32
+ replica: ReplicaReader;
33
+
30
34
  @Inject
31
35
  db: SocialMailContext;
32
36
 
@@ -36,17 +40,19 @@ export default class extends Page {
36
40
  // send 1x1 gif
37
41
  async run() {
38
42
 
39
- const { db } = this;
40
43
 
41
44
  const [ _p0, p1 ] = this.childPath;
42
45
 
43
- db.verifyFilters = false;
44
46
  const activityID = Base36.decode(p1) as any;
45
47
 
46
48
  if (activityID) {
47
- const activity = await db.subscriberActivities
49
+ const activity = await this.replica.query((db) => {
50
+ db.verifyFilters = false;
51
+
52
+ return db.subscriberActivities
48
53
  .where({ activityID}, (p) => (x) => x.activityID === p.activityID)
49
54
  .first();
55
+ });
50
56
  if (!activity) {
51
57
  return;
52
58
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/wwwroot/routes/api/emails/content/attachment/index.ts"],"names":[],"mappings":""}
@@ -1,41 +0,0 @@
1
- // import Inject from "@entity-access/entity-access/dist/di/di.js";
2
- // import SocialMailContext from "../../../../../../server/model/SocialMailContext.js";
3
- // import CacheService from "../../../../../../server/services/cache/CacheService.js";
4
- // import TimeSpan from "@entity-access/entity-access/dist/types/TimeSpan.js";
5
- // import EmailAttachmentStorage from "../../../../../../server/storage/EmailAttachmentStorage.js";
6
- // import { TempFileResult } from "@entity-access/server-pages/dist/Content.js";
7
- // import Page from "@entity-access/server-pages/dist/Page.js";
8
- // import { Prepare } from "@entity-access/server-pages/dist/decorators/Prepare.js";
9
- export {};
10
- // @Prepare.authorize
11
- // export default class extends Page {
12
- // @Inject
13
- // private db: SocialMailContext;
14
- // @Inject
15
- // private cacheService: CacheService;
16
- // @Inject
17
- // private emailAttachmentStorage: EmailAttachmentStorage;
18
- // async run() {
19
- // const emailID = this.childPath[0] as any;
20
- // const attachmentNumber = this.childPath[1] as any;
21
- // // verify security...
22
- // await this.db.emails.filtered("read").where({ emailID }, (p) => (x) => x.emailID === p.emailID)
23
- // .some();
24
- // const factory = () => {
25
- // this.db.verifyFilters = false;
26
- // return this.emailAttachmentStorage.downloadAttachmentFile(emailID, attachmentNumber);
27
- // };
28
- // const tf = await this.cacheService.get({
29
- // key: `cached-email-attachment-${emailID}-${attachmentNumber}`,
30
- // factory,
31
- // ttl: TimeSpan.fromDays(30)
32
- // });
33
- // this.cacheControl = "public, max-age=2592000, immutable";
34
- // return new TempFileResult(tf, {
35
- // contentDisposition: "attachment",
36
- // immutable: true,
37
- // etag: false
38
- // });
39
- // }
40
- // }
41
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/wwwroot/routes/api/emails/content/attachment/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,uFAAuF;AACvF,sFAAsF;AACtF,8EAA8E;AAC9E,mGAAmG;AACnG,gFAAgF;AAChF,+DAA+D;AAC/D,oFAAoF;;AAGpF,qBAAqB;AACrB,sCAAsC;AAEtC,cAAc;AACd,qCAAqC;AAErC,cAAc;AACd,0CAA0C;AAE1C,cAAc;AACd,8DAA8D;AAE9D,oBAAoB;AAEpB,oDAAoD;AAEpD,6DAA6D;AAE7D,gCAAgC;AAChC,0GAA0G;AAC1G,uBAAuB;AAEvB,kCAAkC;AAClC,6CAA6C;AAC7C,oGAAoG;AACpG,aAAa;AAEb,mDAAmD;AACnD,6EAA6E;AAC7E,uBAAuB;AACvB,yCAAyC;AACzC,cAAc;AAEd,oEAAoE;AAEpE,0CAA0C;AAC1C,gDAAgD;AAChD,+BAA+B;AAC/B,0BAA0B;AAC1B,cAAc;AACd,QAAQ;AAER,IAAI"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/wwwroot/routes/api/emails/content/html/index.ts"],"names":[],"mappings":""}
@@ -1,41 +0,0 @@
1
- // import Inject from "@entity-access/entity-access/dist/di/di.js";
2
- // import SocialMailContext from "../../../../../../server/model/SocialMailContext.js";
3
- // import Page from "@entity-access/server-pages/dist/Page.js";
4
- // import { Prepare } from "@entity-access/server-pages/dist/decorators/Prepare.js";
5
- // import CachedEmailService from "../../../../../../server/smtp/services/CachedEmailService.js";
6
- // import EntityAccessError from "@entity-access/entity-access/dist/common/EntityAccessError.js";
7
- export {};
8
- // @Prepare.authorize
9
- // export default class extends Page {
10
- // @Inject
11
- // private db: SocialMailContext;
12
- // @Inject
13
- // private cacheEmailService: CachedEmailService;
14
- // async run() {
15
- // const [emailID, p2] = this.childPath as any[];
16
- // const signedFileLogID = BigInt(p2 || "0") as any as number;
17
- // // verify security...
18
- // const email = await this.db.emails.filtered("read").where({ emailID }, (p) => (x) => x.emailID === p.emailID)
19
- // .first();
20
- // if (!email) {
21
- // throw new EntityAccessError(`User: ${this.sessionUser.userID} doesn't have access to ${emailID}`);
22
- // }
23
- // this.cacheControl = "public, max-age=2592000, immutable";
24
- // // if (!signedFileLogID) {
25
- // // if (!email.mimeFileID && !email.htmlBodyID) {
26
- // // return this.content({
27
- // // body: email.htmlBody,
28
- // // contentType: "text/plain",
29
- // // compress: true
30
- // // });
31
- // // }
32
- // // }
33
- // const body = await this.cacheEmailService.getHtmlForRecipient({ emailID, signedFileLogID });
34
- // return this.content({
35
- // body,
36
- // contentType: "text/plain",
37
- // compress: true
38
- // });
39
- // }
40
- // }
41
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/wwwroot/routes/api/emails/content/html/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,uFAAuF;AACvF,+DAA+D;AAC/D,oFAAoF;AACpF,iGAAiG;AACjG,iGAAiG;;AAGjG,qBAAqB;AACrB,sCAAsC;AAEtC,cAAc;AACd,qCAAqC;AAErC,cAAc;AACd,qDAAqD;AAErD,oBAAoB;AAEpB,yDAAyD;AAEzD,sEAAsE;AAEtE,gCAAgC;AAChC,wHAAwH;AACxH,wBAAwB;AAExB,wBAAwB;AACxB,iHAAiH;AACjH,YAAY;AAEZ,oEAAoE;AACpE,qCAAqC;AACrC,+DAA+D;AAC/D,2CAA2C;AAC3C,+CAA+C;AAC/C,oDAAoD;AACpD,wCAAwC;AACxC,yBAAyB;AACzB,mBAAmB;AACnB,eAAe;AAEf,uGAAuG;AAEvG,gCAAgC;AAChC,oBAAoB;AACpB,yCAAyC;AACzC,6BAA6B;AAC7B,cAAc;AACd,QAAQ;AAER,IAAI"}
@@ -1,53 +0,0 @@
1
- // import Inject from "@entity-access/entity-access/dist/di/di.js";
2
- // import SocialMailContext from "../../../../../../server/model/SocialMailContext.js";
3
- // import CacheService from "../../../../../../server/services/cache/CacheService.js";
4
- // import TimeSpan from "@entity-access/entity-access/dist/types/TimeSpan.js";
5
- // import EmailAttachmentStorage from "../../../../../../server/storage/EmailAttachmentStorage.js";
6
- // import { TempFileResult } from "@entity-access/server-pages/dist/Content.js";
7
- // import Page from "@entity-access/server-pages/dist/Page.js";
8
- // import { Prepare } from "@entity-access/server-pages/dist/decorators/Prepare.js";
9
-
10
-
11
- // @Prepare.authorize
12
- // export default class extends Page {
13
-
14
- // @Inject
15
- // private db: SocialMailContext;
16
-
17
- // @Inject
18
- // private cacheService: CacheService;
19
-
20
- // @Inject
21
- // private emailAttachmentStorage: EmailAttachmentStorage;
22
-
23
- // async run() {
24
-
25
- // const emailID = this.childPath[0] as any;
26
-
27
- // const attachmentNumber = this.childPath[1] as any;
28
-
29
- // // verify security...
30
- // await this.db.emails.filtered("read").where({ emailID }, (p) => (x) => x.emailID === p.emailID)
31
- // .some();
32
-
33
- // const factory = () => {
34
- // this.db.verifyFilters = false;
35
- // return this.emailAttachmentStorage.downloadAttachmentFile(emailID, attachmentNumber);
36
- // };
37
-
38
- // const tf = await this.cacheService.get({
39
- // key: `cached-email-attachment-${emailID}-${attachmentNumber}`,
40
- // factory,
41
- // ttl: TimeSpan.fromDays(30)
42
- // });
43
-
44
- // this.cacheControl = "public, max-age=2592000, immutable";
45
-
46
- // return new TempFileResult(tf, {
47
- // contentDisposition: "attachment",
48
- // immutable: true,
49
- // etag: false
50
- // });
51
- // }
52
-
53
- // }
@@ -1,52 +0,0 @@
1
- // import Inject from "@entity-access/entity-access/dist/di/di.js";
2
- // import SocialMailContext from "../../../../../../server/model/SocialMailContext.js";
3
- // import Page from "@entity-access/server-pages/dist/Page.js";
4
- // import { Prepare } from "@entity-access/server-pages/dist/decorators/Prepare.js";
5
- // import CachedEmailService from "../../../../../../server/smtp/services/CachedEmailService.js";
6
- // import EntityAccessError from "@entity-access/entity-access/dist/common/EntityAccessError.js";
7
-
8
-
9
- // @Prepare.authorize
10
- // export default class extends Page {
11
-
12
- // @Inject
13
- // private db: SocialMailContext;
14
-
15
- // @Inject
16
- // private cacheEmailService: CachedEmailService;
17
-
18
- // async run() {
19
-
20
- // const [emailID, p2] = this.childPath as any[];
21
-
22
- // const signedFileLogID = BigInt(p2 || "0") as any as number;
23
-
24
- // // verify security...
25
- // const email = await this.db.emails.filtered("read").where({ emailID }, (p) => (x) => x.emailID === p.emailID)
26
- // .first();
27
-
28
- // if (!email) {
29
- // throw new EntityAccessError(`User: ${this.sessionUser.userID} doesn't have access to ${emailID}`);
30
- // }
31
-
32
- // this.cacheControl = "public, max-age=2592000, immutable";
33
- // // if (!signedFileLogID) {
34
- // // if (!email.mimeFileID && !email.htmlBodyID) {
35
- // // return this.content({
36
- // // body: email.htmlBody,
37
- // // contentType: "text/plain",
38
- // // compress: true
39
- // // });
40
- // // }
41
- // // }
42
-
43
- // const body = await this.cacheEmailService.getHtmlForRecipient({ emailID, signedFileLogID });
44
-
45
- // return this.content({
46
- // body,
47
- // contentType: "text/plain",
48
- // compress: true
49
- // });
50
- // }
51
-
52
- // }