@social-mail/social-mail-web-server 1.8.97 → 1.8.99

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.97",
3
+ "version": "1.8.99",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -524,8 +524,15 @@ export default class AppFileEvents extends AuthenticatedEvents<AppFile> {
524
524
  const eDomain = this.encryptionService.general.encrypt(domain);
525
525
  fileContentID = this.encryptionService.general.encrypt(fileContentID.toString()) as any;
526
526
  postID = this.encryptionService.general.encrypt(postID.toString()) as any;
527
+
528
+ const isPublished = entity.email?.channelEmails?.some((x) => x.datePublished !== null);
529
+
527
530
  Object.defineProperty(entity, "postID", { value: postID, enumerable: true });
528
- Object.defineProperty(entity, "url", { value: urlService.toChannelFileUrl({ eDomain, file: entity, postID }) , enumerable: true });
531
+ if (isPublished) {
532
+ Object.defineProperty(entity, "url", { value: urlService.toChannelFileUrl({ eDomain, file: entity, postID }) , enumerable: true });
533
+ } else {
534
+ Object.defineProperty(entity, "url", { value: `/social-mail/fd/view/${$key}/${fileContentID}/${entity.name}`, enumerable: true });
535
+ }
529
536
  // Object.defineProperty(entity, "downloadUrl", { value: `/social-mail/fd/download/${$key}/${fileContentID}/${entity.name}`, enumerable: true });
530
537
  } else {
531
538
  if (fileContentID) {
@@ -5,7 +5,7 @@ export default async function seedUI(config: DBConfig) {
5
5
  await config.saveVersion(UIPackageConfig, {
6
6
  package: "@social-mail/social-mail-client",
7
7
  view: "dist/web/AppIndex",
8
- version: "1.8.276"
8
+ version: "1.8.278"
9
9
  });
10
10
 
11
11
  await config.saveVersion(WebComponentsPackageConfig, {
@@ -41,7 +41,10 @@ export default class ChannelUrlService {
41
41
  if (/video/i.test(fo.file.contentType)) {
42
42
  return this.toWebMUrl(fo);
43
43
  }
44
- return this.toImageUrl(fo);
44
+ if (/image/i.test(fo.file.contentType)) {
45
+ return this.toImageUrl(fo);
46
+ }
47
+ return this.toFileUrl(fo);
45
48
  }
46
49
 
47
50
  toImageUrl({
@@ -65,5 +68,15 @@ export default class ChannelUrlService {
65
68
  return `https://${globalEnv.cdnOrHost}/social-mail/c/e/${eDomain}/${method}/${cid}/${name}`;
66
69
  }
67
70
 
71
+ toFileUrl({
72
+ senderDomain = globalEnv.host,
73
+ eDomain = this.ecs.general.encrypt(senderDomain),
74
+ file,
75
+ }: IFileUrlOptions) {
76
+ const cid = this.ecs.general.encrypt(file.fileContentID.toString());
77
+ const method = "view";
78
+ const name = file.name;
79
+ return `https://${globalEnv.cdnOrHost}/social-mail/c/e/${eDomain}/${method}/${cid}/${name}`;
80
+ }
68
81
 
69
82
  }