Spaces:
Build error
Build error
fix: deps and bugs
Browse files
backend/functions/package-lock.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
| 15 |
"archiver": "^6.0.1",
|
| 16 |
"axios": "^1.3.3",
|
| 17 |
"bcrypt": "^5.1.0",
|
| 18 |
-
"civkit": "^0.8.2-
|
| 19 |
"core-js": "^3.37.1",
|
| 20 |
"cors": "^2.8.5",
|
| 21 |
"dayjs": "^1.11.9",
|
|
@@ -3729,10 +3729,9 @@
|
|
| 3729 |
}
|
| 3730 |
},
|
| 3731 |
"node_modules/civkit": {
|
| 3732 |
-
"version": "0.8.2-
|
| 3733 |
-
"resolved": "https://registry.npmjs.org/civkit/-/civkit-0.8.2-
|
| 3734 |
-
"integrity": "sha512-
|
| 3735 |
-
"license": "AGPL",
|
| 3736 |
"dependencies": {
|
| 3737 |
"lodash": "^4.17.21",
|
| 3738 |
"tslib": "^2.5.0"
|
|
|
|
| 15 |
"archiver": "^6.0.1",
|
| 16 |
"axios": "^1.3.3",
|
| 17 |
"bcrypt": "^5.1.0",
|
| 18 |
+
"civkit": "^0.8.2-2eddf1b",
|
| 19 |
"core-js": "^3.37.1",
|
| 20 |
"cors": "^2.8.5",
|
| 21 |
"dayjs": "^1.11.9",
|
|
|
|
| 3729 |
}
|
| 3730 |
},
|
| 3731 |
"node_modules/civkit": {
|
| 3732 |
+
"version": "0.8.2-2eddf1b",
|
| 3733 |
+
"resolved": "https://registry.npmjs.org/civkit/-/civkit-0.8.2-2eddf1b.tgz",
|
| 3734 |
+
"integrity": "sha512-iRYQKasePTQYIajPZpTh+uQn09XF7e6+tBaFwxs7mlUIHoU8ci8CT307ITYMnppDLzCh7BRpSgt53mz4Jwg78w==",
|
|
|
|
| 3735 |
"dependencies": {
|
| 3736 |
"lodash": "^4.17.21",
|
| 3737 |
"tslib": "^2.5.0"
|
backend/functions/package.json
CHANGED
|
@@ -35,7 +35,7 @@
|
|
| 35 |
"archiver": "^6.0.1",
|
| 36 |
"axios": "^1.3.3",
|
| 37 |
"bcrypt": "^5.1.0",
|
| 38 |
-
"civkit": "^0.8.2-
|
| 39 |
"core-js": "^3.37.1",
|
| 40 |
"cors": "^2.8.5",
|
| 41 |
"dayjs": "^1.11.9",
|
|
|
|
| 35 |
"archiver": "^6.0.1",
|
| 36 |
"axios": "^1.3.3",
|
| 37 |
"bcrypt": "^5.1.0",
|
| 38 |
+
"civkit": "^0.8.2-2eddf1b",
|
| 39 |
"core-js": "^3.37.1",
|
| 40 |
"cors": "^2.8.5",
|
| 41 |
"dayjs": "^1.11.9",
|
backend/functions/src/services/jsdom.ts
CHANGED
|
@@ -113,7 +113,7 @@ export class JSDomControl extends AsyncService {
|
|
| 113 |
let rootDoc: Document;
|
| 114 |
if (allNodes.length === 1 && allNodes[0].nodeName === '#document') {
|
| 115 |
rootDoc = allNodes[0] as any;
|
| 116 |
-
if (rootDoc.body.innerText) {
|
| 117 |
textNodes.push(rootDoc.body);
|
| 118 |
}
|
| 119 |
} else {
|
|
|
|
| 113 |
let rootDoc: Document;
|
| 114 |
if (allNodes.length === 1 && allNodes[0].nodeName === '#document') {
|
| 115 |
rootDoc = allNodes[0] as any;
|
| 116 |
+
if (rootDoc.documentElement && rootDoc.body?.innerText) {
|
| 117 |
textNodes.push(rootDoc.body);
|
| 118 |
}
|
| 119 |
} else {
|
backend/functions/src/services/snapshot-formatter.ts
CHANGED
|
@@ -76,7 +76,10 @@ export class SnapshotFormatter extends AsyncService {
|
|
| 76 |
const f = {
|
| 77 |
...this.getGeneralSnapshotMixins(snapshot),
|
| 78 |
};
|
|
|
|
|
|
|
| 79 |
if (mode.includes('screenshot')) {
|
|
|
|
| 80 |
if (snapshot.screenshot && !snapshot.screenshotUrl) {
|
| 81 |
const fid = `instant-screenshots/${randomUUID()}`;
|
| 82 |
await this.firebaseObjectStorage.saveFile(fid, snapshot.screenshot, {
|
|
@@ -86,7 +89,6 @@ export class SnapshotFormatter extends AsyncService {
|
|
| 86 |
});
|
| 87 |
snapshot.screenshotUrl = await this.firebaseObjectStorage.signDownloadUrl(fid, Date.now() + urlValidMs);
|
| 88 |
}
|
| 89 |
-
|
| 90 |
Object.assign(f, {
|
| 91 |
screenshotUrl: snapshot.screenshotUrl,
|
| 92 |
});
|
|
@@ -94,6 +96,7 @@ export class SnapshotFormatter extends AsyncService {
|
|
| 94 |
Object.defineProperty(f, 'textRepresentation', { value: `${f.screenshotUrl}\n`, enumerable: false, configurable: true });
|
| 95 |
}
|
| 96 |
if (mode.includes('pageshot')) {
|
|
|
|
| 97 |
if (snapshot.pageshot && !snapshot.pageshotUrl) {
|
| 98 |
const fid = `instant-screenshots/${randomUUID()}`;
|
| 99 |
await this.firebaseObjectStorage.saveFile(fid, snapshot.pageshot, {
|
|
@@ -103,7 +106,6 @@ export class SnapshotFormatter extends AsyncService {
|
|
| 103 |
});
|
| 104 |
snapshot.pageshotUrl = await this.firebaseObjectStorage.signDownloadUrl(fid, Date.now() + urlValidMs);
|
| 105 |
}
|
| 106 |
-
|
| 107 |
Object.assign(f, {
|
| 108 |
html: snapshot.html,
|
| 109 |
pageshotUrl: snapshot.pageshotUrl,
|
|
@@ -111,6 +113,7 @@ export class SnapshotFormatter extends AsyncService {
|
|
| 111 |
Object.defineProperty(f, 'textRepresentation', { value: `${f.pageshotUrl}\n`, enumerable: false, configurable: true });
|
| 112 |
}
|
| 113 |
if (mode.includes('html')) {
|
|
|
|
| 114 |
Object.assign(f, {
|
| 115 |
html: snapshot.html,
|
| 116 |
});
|
|
@@ -141,13 +144,14 @@ export class SnapshotFormatter extends AsyncService {
|
|
| 141 |
}
|
| 142 |
|
| 143 |
if (mode.includes('text')) {
|
|
|
|
| 144 |
Object.assign(f, {
|
| 145 |
text: snapshot.text,
|
| 146 |
});
|
| 147 |
Object.defineProperty(f, 'textRepresentation', { value: snapshot.text, enumerable: false, configurable: true });
|
| 148 |
}
|
| 149 |
|
| 150 |
-
if (!mode.includes('markdown') && !mode.includes('content')) {
|
| 151 |
const dt = Date.now() - t0;
|
| 152 |
this.logger.info(`Formatting took ${dt}ms`, { mode, url: nominalUrl?.toString(), dt });
|
| 153 |
|
|
|
|
| 76 |
const f = {
|
| 77 |
...this.getGeneralSnapshotMixins(snapshot),
|
| 78 |
};
|
| 79 |
+
let modeOK = false;
|
| 80 |
+
|
| 81 |
if (mode.includes('screenshot')) {
|
| 82 |
+
modeOK = true;
|
| 83 |
if (snapshot.screenshot && !snapshot.screenshotUrl) {
|
| 84 |
const fid = `instant-screenshots/${randomUUID()}`;
|
| 85 |
await this.firebaseObjectStorage.saveFile(fid, snapshot.screenshot, {
|
|
|
|
| 89 |
});
|
| 90 |
snapshot.screenshotUrl = await this.firebaseObjectStorage.signDownloadUrl(fid, Date.now() + urlValidMs);
|
| 91 |
}
|
|
|
|
| 92 |
Object.assign(f, {
|
| 93 |
screenshotUrl: snapshot.screenshotUrl,
|
| 94 |
});
|
|
|
|
| 96 |
Object.defineProperty(f, 'textRepresentation', { value: `${f.screenshotUrl}\n`, enumerable: false, configurable: true });
|
| 97 |
}
|
| 98 |
if (mode.includes('pageshot')) {
|
| 99 |
+
modeOK = true;
|
| 100 |
if (snapshot.pageshot && !snapshot.pageshotUrl) {
|
| 101 |
const fid = `instant-screenshots/${randomUUID()}`;
|
| 102 |
await this.firebaseObjectStorage.saveFile(fid, snapshot.pageshot, {
|
|
|
|
| 106 |
});
|
| 107 |
snapshot.pageshotUrl = await this.firebaseObjectStorage.signDownloadUrl(fid, Date.now() + urlValidMs);
|
| 108 |
}
|
|
|
|
| 109 |
Object.assign(f, {
|
| 110 |
html: snapshot.html,
|
| 111 |
pageshotUrl: snapshot.pageshotUrl,
|
|
|
|
| 113 |
Object.defineProperty(f, 'textRepresentation', { value: `${f.pageshotUrl}\n`, enumerable: false, configurable: true });
|
| 114 |
}
|
| 115 |
if (mode.includes('html')) {
|
| 116 |
+
modeOK = true;
|
| 117 |
Object.assign(f, {
|
| 118 |
html: snapshot.html,
|
| 119 |
});
|
|
|
|
| 144 |
}
|
| 145 |
|
| 146 |
if (mode.includes('text')) {
|
| 147 |
+
modeOK = true;
|
| 148 |
Object.assign(f, {
|
| 149 |
text: snapshot.text,
|
| 150 |
});
|
| 151 |
Object.defineProperty(f, 'textRepresentation', { value: snapshot.text, enumerable: false, configurable: true });
|
| 152 |
}
|
| 153 |
|
| 154 |
+
if (modeOK && !mode.includes('markdown') && !mode.includes('content')) {
|
| 155 |
const dt = Date.now() - t0;
|
| 156 |
this.logger.info(`Formatting took ${dt}ms`, { mode, url: nominalUrl?.toString(), dt });
|
| 157 |
|
thinapps-shared
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
Subproject commit
|
|
|
|
| 1 |
+
Subproject commit 081595c106d3b777a8bc4a6c3b129645ca1c1e21
|