@social-mail/social-mail-web-server 1.7.665 → 1.7.669

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.
@@ -0,0 +1,10 @@
1
+ import Page from "@entity-access/server-pages/dist/Page.js";
2
+ export default class extends Page {
3
+ private type;
4
+ private eSiteID;
5
+ private eFileContentID;
6
+ private name;
7
+ private wcs;
8
+ run(): Promise<import("@entity-access/server-pages/dist/Content.js").default>;
9
+ }
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/wwwroot/routes/social-mail/site/snapshot-preview/[type]/[eSiteID]/[eFileContentID]/[name]/index.ts"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,0CAA0C,CAAC;AAG5D,MAAM,CAAC,OAAO,MAAO,SAAQ,IAAI;IAG7B,OAAO,CAAC,IAAI,CAAS;IAGrB,OAAO,CAAC,OAAO,CAAM;IAGrB,OAAO,CAAC,cAAc,CAAM;IAG5B,OAAO,CAAC,IAAI,CAAM;IAGlB,OAAO,CAAC,GAAG,CAAwB;IAE7B,GAAG;CAsBZ"}
@@ -0,0 +1,52 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import Inject from "@entity-access/entity-access/dist/di/di.js";
11
+ import { Route } from "@entity-access/server-pages/dist/core/Route.js";
12
+ import Page from "@entity-access/server-pages/dist/Page.js";
13
+ import WebSiteContentService from "../../../../../../../../../server/services/files/WebSiteContentService.js";
14
+ export default class default_1 extends Page {
15
+ async run() {
16
+ const { name } = this;
17
+ const snapshot = await this.wcs.getCurrentSnapshotFolder(this.request.hostName);
18
+ const blogFile = await this.wcs.getSnapshotFile(snapshot, ["blog.html"]);
19
+ if (/\.pdf$/i.test(name)) {
20
+ const content = await blogFile.readAsText();
21
+ const body = content.replace(`"dist/public/channel/ChannelApp"`, `"dist/public/preview/pdf/PreviewPDF"`);
22
+ return this.content({
23
+ body,
24
+ headers: {
25
+ "content-type": "text/html"
26
+ }
27
+ });
28
+ }
29
+ return this.notFound();
30
+ }
31
+ }
32
+ __decorate([
33
+ Route,
34
+ __metadata("design:type", String)
35
+ ], default_1.prototype, "type", void 0);
36
+ __decorate([
37
+ Route,
38
+ __metadata("design:type", Object)
39
+ ], default_1.prototype, "eSiteID", void 0);
40
+ __decorate([
41
+ Route,
42
+ __metadata("design:type", Object)
43
+ ], default_1.prototype, "eFileContentID", void 0);
44
+ __decorate([
45
+ Route,
46
+ __metadata("design:type", Object)
47
+ ], default_1.prototype, "name", void 0);
48
+ __decorate([
49
+ Inject,
50
+ __metadata("design:type", WebSiteContentService)
51
+ ], default_1.prototype, "wcs", void 0);
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../../src/wwwroot/routes/social-mail/site/snapshot-preview/[type]/[eSiteID]/[eFileContentID]/[name]/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,MAAM,MAAM,4CAA4C,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,gDAAgD,CAAC;AACvE,OAAO,IAAI,MAAM,0CAA0C,CAAC;AAC5D,OAAO,qBAAqB,MAAM,2EAA2E,CAAC;AAE9G,MAAM,CAAC,OAAO,gBAAO,SAAQ,IAAI;IAiB7B,KAAK,CAAC,GAAG;QAEL,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;QAEtB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEhF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;QAEzE,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC;YAC5C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,kCAAkC,EAAE,sCAAsC,CAAC,CAAC;YACzG,OAAO,IAAI,CAAC,OAAO,CAAC;gBAChB,IAAI;gBACJ,OAAO,EAAE;oBACL,cAAc,EAAE,WAAW;iBAC9B;aACJ,CAAC,CAAC;QACP,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;CAEJ;AApCW;IADP,KAAK;;uCACe;AAGb;IADP,KAAK;;0CACe;AAGb;IADP,KAAK;;iDACsB;AAGpB;IADP,KAAK;;uCACY;AAGV;IADP,MAAM;8BACM,qBAAqB;sCAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-web-server",
3
- "version": "1.7.665",
3
+ "version": "1.7.669",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -5,13 +5,13 @@ 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.169"
8
+ version: "1.8.174"
9
9
  });
10
10
 
11
11
  await config.saveVersion(WebComponentsPackageConfig, {
12
12
  package: "@social-mail/web-components",
13
13
  view: "dist/index.js",
14
- version: "1.0.309"
14
+ version: "1.0.316"
15
15
  });
16
16
 
17
17
  await config.saveVersion(FAFreePackageConfig, {
@@ -114,6 +114,39 @@ export default class WebContentTranspileService
114
114
  continue;
115
115
  }
116
116
 
117
+ if(/pdf\-viewer/i.test(node.nodeName)) {
118
+ await this.rewriteLink(node, "src", siteFolder, currentPath);
119
+ const poster = node.getAttribute("poster");
120
+ if (!poster) {
121
+ const src = WebUrl.transform(node.getAttribute("src"), "webp", "preview.webp", 700);
122
+ node.setAttribute("poster", src);
123
+ } else {
124
+ await this.rewriteLink(node, "poster", siteFolder, currentPath, "webp");
125
+ }
126
+ await this.transformImageLink(node as HTMLElement, "poster");
127
+ continue;
128
+ }
129
+
130
+ if(/pdf\-link/i.test(node.nodeName)) {
131
+ const src = await this.rewriteLink(node, "src", siteFolder, currentPath);
132
+ const previewSrc = src.replace("/snapshot/", "/snapshot-preview/");
133
+ node.setAttribute("src", previewSrc);
134
+ const poster = node.getAttribute("poster");
135
+ if (!poster) {
136
+ node.setAttribute("poster", WebUrl.transform(src, "webp", "preview.webp", 700));
137
+ } else {
138
+ await this.rewriteLink(node, "poster", siteFolder, currentPath, "webp");
139
+ }
140
+ await this.transformImageLink(node as HTMLElement, "poster");
141
+ continue;
142
+ }
143
+
144
+ if(/pdf\-flip/i.test(node.nodeName)) {
145
+ await this.rewriteLink(node, "src", siteFolder, currentPath);
146
+ await this.rewriteLink(node, "poster", siteFolder, currentPath, "webp");
147
+ await this.transformImageLink(node as HTMLElement, "poster");
148
+ continue;
149
+ }
117
150
  }
118
151
 
119
152
  document.body.setAttribute("styler-attributes-expanded", "yes");
@@ -197,6 +230,7 @@ export default class WebContentTranspileService
197
230
  value = await this.toAbsoluteUrl(value, siteFolder, currentPath);
198
231
 
199
232
  node.setAttribute(attributeName, value);
233
+ return value;
200
234
  }
201
235
 
202
236
  async injectFragment(siteFolder: ISiteFolder, node: HTMLElement, doc: Document, currentPath: string) {
@@ -0,0 +1,45 @@
1
+ import Inject from "@entity-access/entity-access/dist/di/di.js";
2
+ import { Route } from "@entity-access/server-pages/dist/core/Route.js";
3
+ import Page from "@entity-access/server-pages/dist/Page.js";
4
+ import WebSiteContentService from "../../../../../../../../../server/services/files/WebSiteContentService.js";
5
+
6
+ export default class extends Page {
7
+
8
+ @Route
9
+ private type: string;
10
+
11
+ @Route
12
+ private eSiteID: any;
13
+
14
+ @Route
15
+ private eFileContentID: any;
16
+
17
+ @Route
18
+ private name: any;
19
+
20
+ @Inject
21
+ private wcs: WebSiteContentService;
22
+
23
+ async run() {
24
+
25
+ const { name } = this;
26
+
27
+ const snapshot = await this.wcs.getCurrentSnapshotFolder(this.request.hostName);
28
+
29
+ const blogFile = await this.wcs.getSnapshotFile(snapshot, ["blog.html"]);
30
+
31
+ if (/\.pdf$/i.test(name)) {
32
+ const content = await blogFile.readAsText();
33
+ const body = content.replace(`"dist/public/channel/ChannelApp"`, `"dist/public/preview/pdf/PreviewPDF"`);
34
+ return this.content({
35
+ body,
36
+ headers: {
37
+ "content-type": "text/html"
38
+ }
39
+ });
40
+ }
41
+
42
+ return this.notFound();
43
+ }
44
+
45
+ }