@social-mail/social-mail-web-server 1.8.392 → 1.8.394
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/dist/server/seed/ui/seed-ui.js +1 -1
- package/dist/server/services/files/WebSiteContentService.d.ts.map +1 -1
- package/dist/server/services/files/WebSiteContentService.js +3 -1
- package/dist/server/services/files/WebSiteContentService.js.map +1 -1
- package/dist/server/services/files/web-content/WebContentTranspileService.d.ts.map +1 -1
- package/dist/server/services/files/web-content/WebContentTranspileService.js +13 -6
- package/dist/server/services/files/web-content/WebContentTranspileService.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/server/seed/ui/seed-ui.ts +1 -1
- package/src/server/services/files/WebSiteContentService.ts +3 -1
- package/src/server/services/files/web-content/WebContentTranspileService.ts +13 -6
package/package.json
CHANGED
|
@@ -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.
|
|
20
|
+
version: "1.9.86"
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
await config.saveVersion(WebComponentsPackageConfig, {
|
|
@@ -10,6 +10,7 @@ import WebContentTranspileService from "./web-content/WebContentTranspileService
|
|
|
10
10
|
import { ISiteFolder } from "./ISiteFolder.js";
|
|
11
11
|
import EncryptionService from "../encryption/EncryptionService.js";
|
|
12
12
|
import { hash } from "crypto";
|
|
13
|
+
import Sql from "@entity-access/entity-access/dist/sql/Sql.js";
|
|
13
14
|
|
|
14
15
|
@RegisterScoped
|
|
15
16
|
export default class WebSiteContentService
|
|
@@ -93,8 +94,9 @@ export default class WebSiteContentService
|
|
|
93
94
|
async getFileInfo(folderID, ... segments: string[]): Promise<IFileInfo> {
|
|
94
95
|
const [top, ... paths] = segments;
|
|
95
96
|
const child = await this.db.appFiles
|
|
96
|
-
.where({ folderID, top },(p) => (x) => x.parentID === p.folderID && x.name
|
|
97
|
+
.where({ folderID, top },(p) => (x) => x.parentID === p.folderID && Sql.text.iLike(x.name, p.top))
|
|
97
98
|
.orderBy(void 0, (p) => (x) => x.isDeleted)
|
|
99
|
+
.thenByDescending({ top }, (p) => (x) => x.name === p.top)
|
|
98
100
|
.first();
|
|
99
101
|
if (!child) {
|
|
100
102
|
return null;
|
|
@@ -21,10 +21,14 @@ const updateAttribute = (root: string, name: string, element: Element) => {
|
|
|
21
21
|
if (!value) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
if
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
if(/^https?\:\/\//i.test(value)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (value.startsWith("/")) {
|
|
28
|
+
return;
|
|
27
29
|
}
|
|
30
|
+
const v = join(root, value);
|
|
31
|
+
element.setAttribute(name, v.toString());
|
|
28
32
|
};
|
|
29
33
|
|
|
30
34
|
@RegisterScoped
|
|
@@ -272,14 +276,17 @@ export default class WebContentTranspileService
|
|
|
272
276
|
|
|
273
277
|
async injectFragment(siteFolder: ISiteFolder, node: HTMLElement, doc: Document, currentPath: string) {
|
|
274
278
|
let src = node.getAttribute("src");
|
|
279
|
+
let isAbsolute = null as string;
|
|
275
280
|
if (src.startsWith("/")) {
|
|
276
281
|
src = src.substring(1);
|
|
282
|
+
isAbsolute = src;
|
|
277
283
|
}
|
|
278
284
|
|
|
279
|
-
const dir = src.split("/").slice(0, -1).join("/");
|
|
285
|
+
const dir = isAbsolute ? ("/" + src.split("/").slice(0, -1).join("/")) : (src.split("/").slice(0, -1).join("/"));
|
|
286
|
+
const filePath = isAbsolute ? isAbsolute.split("/") : join(currentPath, src).split("/");
|
|
280
287
|
|
|
281
288
|
const contentService = ServiceProvider.resolve(this, WebSiteContentService);
|
|
282
|
-
const file = await contentService.getFile(siteFolder.snapshotFolderID, ...
|
|
289
|
+
const file = await contentService.getFile(siteFolder.snapshotFolderID, ... filePath);
|
|
283
290
|
const html = await file.readAsText();
|
|
284
291
|
const parser = new doc.defaultView.DOMParser();
|
|
285
292
|
const parsed = parser.parseFromString(html, "text/html");
|
|
@@ -337,7 +344,7 @@ export default class WebContentTranspileService
|
|
|
337
344
|
if (!/^((\/\/)|https?\:\/\/|data\:)/i.test(value)) {
|
|
338
345
|
// need to set path to CDN url
|
|
339
346
|
const cdn = globalEnv.cdn ? `https://${globalEnv.cdn}` : "";
|
|
340
|
-
const rewritePath = value.startsWith("/") ? value : join(currentPath, value);
|
|
347
|
+
const rewritePath = value.startsWith("/") ? value.substring(1) : join(currentPath, value);
|
|
341
348
|
const contentService = ServiceProvider.resolve(this, WebSiteContentService);
|
|
342
349
|
const fileInfo = await contentService.getFileInfo(siteFolder.snapshotFolderID, ... rewritePath.split("/"));
|
|
343
350
|
if (!fileInfo) {
|