diff --git a/docs/plugins.md b/docs/plugins.md index 0be06793..26b651ce 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -34,4 +34,4 @@ init({ ``` You need to have a _config/targets.js_ in your Q server implementation that configures the targets to be used with the screenshot api as `type: 'web'`. -This gives you an endpoint `/screenshot/{id}.png?target=your_target&width=600&dpr=2&background=white&padding=20` where `dpr` (default: `1`), `background` (default: no background) and `padding` (default: `0`) are optional. \ No newline at end of file +This gives you an endpoint `/screenshot/{id}.png?target=your_target&width=600&dpr=2&background=white&padding=20` where `dpr` (default: `1`), `background` (default: background could be set by any context css loaded for the target. set to none to get transparent in any case) and `padding` (default: `0`) are optional. \ No newline at end of file diff --git a/helper/meta-properties.js b/helper/meta-properties.js index ccdbdf2f..1d29235d 100644 --- a/helper/meta-properties.js +++ b/helper/meta-properties.js @@ -9,10 +9,12 @@ const metaProperties = [ 'department', 'annotations', 'editedBy', + 'updatedBy', 'updatedDate', 'active', 'activateDate', - 'deactivateDate' + 'deactivateDate', + 'publication' ]; const deleteMetaProperties = function(item) { diff --git a/package-lock.json b/package-lock.json index 640a33c1..6a8348a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -85,10 +85,6 @@ "sprintf-js": "1.0.3" } }, - "assertion-error": { - "version": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", - "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=" - }, "async-limiter": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", @@ -104,7 +100,8 @@ "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=" }, "boom": { - "version": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", "requires": { "hoek": "4.2.0" @@ -176,7 +173,8 @@ } }, "catbox-memory": { - "version": "https://registry.npmjs.org/catbox-memory/-/catbox-memory-2.0.4.tgz", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/catbox-memory/-/catbox-memory-2.0.4.tgz", "integrity": "sha1-Qz4lWQLK9UIz0ShkKcj03xToItU=", "requires": { "hoek": "4.2.0" @@ -193,12 +191,40 @@ } }, "chai": { - "version": "https://registry.npmjs.org/chai/-/chai-3.5.0.tgz", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-3.5.0.tgz", "integrity": "sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc=", "requires": { - "assertion-error": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", - "deep-eql": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", - "type-detect": "https://registry.npmjs.org/type-detect/-/type-detect-1.0.0.tgz" + "assertion-error": "1.0.2", + "deep-eql": "0.1.3", + "type-detect": "1.0.0" + }, + "dependencies": { + "assertion-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", + "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=" + }, + "deep-eql": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", + "integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=", + "requires": { + "type-detect": "0.1.1" + }, + "dependencies": { + "type-detect": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz", + "integrity": "sha1-C6XsKohWQORw6k6FBZcZANrFiCI=" + } + } + }, + "type-detect": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-1.0.0.tgz", + "integrity": "sha1-diIXzAbbJY7EiQihKY6LlRIejqI=" + } } }, "cliui": { @@ -667,17 +693,19 @@ } }, "confidence": { - "version": "https://registry.npmjs.org/confidence/-/confidence-3.0.2.tgz", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/confidence/-/confidence-3.0.2.tgz", "integrity": "sha1-0c0pmU47e8P2kwD4f1vCZcUzXlA=", "requires": { "alce": "https://registry.npmjs.org/alce/-/alce-1.2.0.tgz", - "boom": "https://registry.npmjs.org/boom/-/boom-3.2.2.tgz", + "boom": "3.2.2", "hoek": "4.2.0", "yargs": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz" }, "dependencies": { "boom": { - "version": "https://registry.npmjs.org/boom/-/boom-3.2.2.tgz", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/boom/-/boom-3.2.2.tgz", "integrity": "sha1-DwzF0ErcUAO4x9cfQsynJx/vDng=", "requires": { "hoek": "4.2.0" @@ -703,10 +731,6 @@ } } }, - "cookie": { - "version": "https://registry.npmjs.org/cookie/-/cookie-0.1.5.tgz", - "integrity": "sha1-armUiksa4hlSzSWIUwpHItQETXw=" - }, "core-util-is": { "version": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" @@ -733,19 +757,6 @@ "version": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" }, - "deep-eql": { - "version": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", - "integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=", - "requires": { - "type-detect": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz" - }, - "dependencies": { - "type-detect": { - "version": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz", - "integrity": "sha1-C6XsKohWQORw6k6FBZcZANrFiCI=" - } - } - }, "deepmerge": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz", @@ -793,6 +804,29 @@ } } }, + "enjoi": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/enjoi/-/enjoi-2.2.3.tgz", + "integrity": "sha1-jlHxmiTNcJ3HQBVzcOFkQtDSFMw=", + "requires": { + "core-util-is": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "joi": "9.2.0" + }, + "dependencies": { + "joi": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/joi/-/joi-9.2.0.tgz", + "integrity": "sha1-M4WseQGSEwy+Iw6ALsAskhW7/to=", + "requires": { + "hoek": "4.2.0", + "isemail": "https://registry.npmjs.org/isemail/-/isemail-2.2.1.tgz", + "items": "https://registry.npmjs.org/items/-/items-2.1.1.tgz", + "moment": "https://registry.npmjs.org/moment/-/moment-2.15.2.tgz", + "topo": "https://registry.npmjs.org/topo/-/topo-2.0.2.tgz" + } + } + } + }, "error-ex": { "version": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", @@ -872,10 +906,6 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=" }, - "fast-safe-stringify": { - "version": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-1.1.13.tgz", - "integrity": "sha1-oB6c2cnkkXFcmKdaQtXwu9EH/3Y=" - }, "fd-slicer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", @@ -940,33 +970,66 @@ } }, "good-console": { - "version": "https://registry.npmjs.org/good-console/-/good-console-6.4.0.tgz", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/good-console/-/good-console-6.4.0.tgz", "integrity": "sha1-cpTJ2QxMnwWaCC4YBiVJWWbSulk=", "requires": { "hoek": "4.2.0", - "joi": "https://registry.npmjs.org/joi/-/joi-8.1.1.tgz", - "json-stringify-safe": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "moment": "https://registry.npmjs.org/moment/-/moment-2.15.2.tgz" + "joi": "8.1.1", + "json-stringify-safe": "5.0.1", + "moment": "2.15.2" }, "dependencies": { + "isemail": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/isemail/-/isemail-2.2.1.tgz", + "integrity": "sha1-A1PT2aYpUQgMJiwqoKQrjqjp4qY=" + }, "joi": { - "version": "https://registry.npmjs.org/joi/-/joi-8.1.1.tgz", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/joi/-/joi-8.1.1.tgz", "integrity": "sha1-LYtSpdkJ0hftRySFd+7+ixeY9I8=", "requires": { "hoek": "4.2.0", - "isemail": "https://registry.npmjs.org/isemail/-/isemail-2.2.1.tgz", - "moment": "https://registry.npmjs.org/moment/-/moment-2.15.2.tgz", - "topo": "https://registry.npmjs.org/topo/-/topo-2.0.2.tgz" + "isemail": "2.2.1", + "moment": "2.15.2", + "topo": "2.0.2" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "moment": { + "version": "2.15.2", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.15.2.tgz", + "integrity": "sha1-G/3t9qbjRfMi/pVtXfW9CKjOhNw=" + }, + "topo": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/topo/-/topo-2.0.2.tgz", + "integrity": "sha1-zVYVdSU5BXwNwEkaYhw7xvvh0YI=", + "requires": { + "hoek": "4.2.0" } } } }, "good-squeeze": { - "version": "https://registry.npmjs.org/good-squeeze/-/good-squeeze-5.0.2.tgz", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/good-squeeze/-/good-squeeze-5.0.2.tgz", "integrity": "sha1-qOWCQrSgsyzb3zF7YOc6Gafwh5s=", "requires": { - "fast-safe-stringify": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-1.1.13.tgz", + "fast-safe-stringify": "1.1.13", "hoek": "4.2.0" + }, + "dependencies": { + "fast-safe-stringify": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-1.1.13.tgz", + "integrity": "sha1-oB6c2cnkkXFcmKdaQtXwu9EH/3Y=" + } } }, "graceful-fs": { @@ -979,31 +1042,57 @@ "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=" }, "h2o2": { - "version": "https://registry.npmjs.org/h2o2/-/h2o2-5.4.0.tgz", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/h2o2/-/h2o2-5.4.0.tgz", "integrity": "sha1-1oV8oFNVIAyJCzSmZgbKugIp7Vg=", "requires": { - "boom": "https://registry.npmjs.org/boom/-/boom-3.2.2.tgz", + "boom": "3.2.2", "hoek": "4.2.0", - "joi": "https://registry.npmjs.org/joi/-/joi-9.2.0.tgz", + "joi": "9.2.0", "wreck": "9.0.0" }, "dependencies": { "boom": { - "version": "https://registry.npmjs.org/boom/-/boom-3.2.2.tgz", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/boom/-/boom-3.2.2.tgz", "integrity": "sha1-DwzF0ErcUAO4x9cfQsynJx/vDng=", "requires": { "hoek": "4.2.0" } }, + "isemail": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/isemail/-/isemail-2.2.1.tgz", + "integrity": "sha1-A1PT2aYpUQgMJiwqoKQrjqjp4qY=" + }, + "items": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/items/-/items-2.1.1.tgz", + "integrity": "sha1-i9FtnIOxlSneWuoyGsqtp4NkoZg=" + }, "joi": { - "version": "https://registry.npmjs.org/joi/-/joi-9.2.0.tgz", + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/joi/-/joi-9.2.0.tgz", "integrity": "sha1-M4WseQGSEwy+Iw6ALsAskhW7/to=", "requires": { "hoek": "4.2.0", - "isemail": "https://registry.npmjs.org/isemail/-/isemail-2.2.1.tgz", - "items": "https://registry.npmjs.org/items/-/items-2.1.1.tgz", - "moment": "https://registry.npmjs.org/moment/-/moment-2.15.2.tgz", - "topo": "https://registry.npmjs.org/topo/-/topo-2.0.2.tgz" + "isemail": "2.2.1", + "items": "2.1.1", + "moment": "2.19.1", + "topo": "2.0.2" + } + }, + "moment": { + "version": "2.19.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.19.1.tgz", + "integrity": "sha1-VtoaLRy/AdOLfhr8McELz6GSkWc=" + }, + "topo": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/topo/-/topo-2.0.2.tgz", + "integrity": "sha1-zVYVdSU5BXwNwEkaYhw7xvvh0YI=", + "requires": { + "hoek": "4.2.0" } }, "wreck": { @@ -1011,7 +1100,7 @@ "resolved": "https://registry.npmjs.org/wreck/-/wreck-9.0.0.tgz", "integrity": "sha1-HeY9SbsHuU/nGIZLi+YxduYzMew=", "requires": { - "boom": "https://registry.npmjs.org/boom/-/boom-3.2.2.tgz", + "boom": "3.2.2", "hoek": "4.2.0" } } @@ -1045,7 +1134,7 @@ "boom": "5.2.0", "call": "4.0.2", "catbox": "7.1.5", - "catbox-memory": "https://registry.npmjs.org/catbox-memory/-/catbox-memory-2.0.4.tgz", + "catbox-memory": "2.0.4", "cryptiles": "3.1.2", "heavy": "4.0.4", "hoek": "4.2.0", @@ -1102,66 +1191,85 @@ } }, "hapi-auth-couchdb-cookie": { - "version": "https://registry.npmjs.org/hapi-auth-couchdb-cookie/-/hapi-auth-couchdb-cookie-3.1.0.tgz", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hapi-auth-couchdb-cookie/-/hapi-auth-couchdb-cookie-3.1.0.tgz", "integrity": "sha1-7sLTS0jJ6KhrjqdxDG68IJ/GtsE=", "requires": { - "boom": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "cookie": "https://registry.npmjs.org/cookie/-/cookie-0.1.5.tgz", + "boom": "2.10.1", + "cookie": "0.1.5", "nano": "6.4.2" }, "dependencies": { "boom": { - "version": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", "requires": { - "hoek": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz" + "hoek": "2.16.3" } }, + "cookie": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.1.5.tgz", + "integrity": "sha1-armUiksa4hlSzSWIUwpHItQETXw=" + }, "hoek": { - "version": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" } } }, "hapi-etags": { - "version": "https://registry.npmjs.org/hapi-etags/-/hapi-etags-0.1.0.tgz", + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/hapi-etags/-/hapi-etags-0.1.0.tgz", "integrity": "sha1-g3FRmBrrpcL5cCXy/zYgtPcbPi0=", "requires": { - "boom": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "hoek": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "joi": "https://registry.npmjs.org/joi/-/joi-6.10.1.tgz" + "boom": "2.10.1", + "hoek": "2.16.3", + "joi": "6.10.1" }, "dependencies": { "boom": { - "version": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", "requires": { - "hoek": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz" + "hoek": "2.16.3" } }, "hoek": { - "version": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" }, "isemail": { - "version": "https://registry.npmjs.org/isemail/-/isemail-1.2.0.tgz", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/isemail/-/isemail-1.2.0.tgz", "integrity": "sha1-vgPfjMPineTSxd9lASY/H6RZXpo=" }, "joi": { - "version": "https://registry.npmjs.org/joi/-/joi-6.10.1.tgz", + "version": "6.10.1", + "resolved": "https://registry.npmjs.org/joi/-/joi-6.10.1.tgz", "integrity": "sha1-TVDDGAeRIgAP5fFq8f+OGRe3fgY=", "requires": { - "hoek": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "isemail": "https://registry.npmjs.org/isemail/-/isemail-1.2.0.tgz", - "moment": "https://registry.npmjs.org/moment/-/moment-2.15.2.tgz", - "topo": "https://registry.npmjs.org/topo/-/topo-1.1.0.tgz" + "hoek": "2.16.3", + "isemail": "1.2.0", + "moment": "2.19.1", + "topo": "1.1.0" } }, + "moment": { + "version": "2.19.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.19.1.tgz", + "integrity": "sha1-VtoaLRy/AdOLfhr8McELz6GSkWc=" + }, "topo": { - "version": "https://registry.npmjs.org/topo/-/topo-1.1.0.tgz", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/topo/-/topo-1.1.0.tgz", "integrity": "sha1-6ddRYV0buH3IZdsYL6HKCl71NtU=", "requires": { - "hoek": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz" + "hoek": "2.16.3" } } } @@ -1469,10 +1577,6 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" }, - "json-stringify-safe": { - "version": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, "json3": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", @@ -1618,7 +1722,7 @@ }, "minimatch": { "version": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", "requires": { "brace-expansion": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz" } @@ -1868,7 +1972,7 @@ "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", "requires": { - "boom": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "boom": "4.3.1", "cryptiles": "3.1.2", "hoek": "4.2.0", "sntp": "2.0.2" @@ -2287,10 +2391,6 @@ } } }, - "reach": { - "version": "https://registry.npmjs.org/reach/-/reach-1.0.0.tgz", - "integrity": "sha1-TRLRYJYLysZ9xiTw+Ruv6zb3lPY=" - }, "read-pkg": { "version": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", @@ -2455,15 +2555,6 @@ "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=" }, - "string-width": { - "version": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "requires": { - "code-point-at": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "is-fullwidth-code-point": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "strip-ansi": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz" - } - }, "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", @@ -2479,6 +2570,15 @@ } } }, + "string-width": { + "version": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "requires": { + "code-point-at": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "is-fullwidth-code-point": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "strip-ansi": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz" + } + }, "strip-ansi": { "version": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", @@ -2598,14 +2698,6 @@ "hoek": "4.2.0" } }, - "traverse": { - "version": "https://registry.npmjs.org/traverse/-/traverse-0.6.6.tgz", - "integrity": "sha1-y99WD9e5r2MlAv7UD5GMFX6pcTc=" - }, - "type-detect": { - "version": "https://registry.npmjs.org/type-detect/-/type-detect-1.0.0.tgz", - "integrity": "sha1-diIXzAbbJY7EiQihKY6LlRIejqI=" - }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -2719,13 +2811,21 @@ } }, "vision": { - "version": "https://registry.npmjs.org/vision/-/vision-4.1.1.tgz", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/vision/-/vision-4.1.1.tgz", "integrity": "sha1-4bYSstLi8gMQoDkpD9SdUSSPgto=", "requires": { - "boom": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "boom": "4.3.1", "hoek": "4.2.0", - "items": "https://registry.npmjs.org/items/-/items-2.1.1.tgz", + "items": "2.1.1", "joi": "10.6.0" + }, + "dependencies": { + "items": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/items/-/items-2.1.1.tgz", + "integrity": "sha1-i9FtnIOxlSneWuoyGsqtp4NkoZg=" + } } }, "which-module": { @@ -2733,11 +2833,24 @@ "integrity": "sha1-u6Y8qGGUiZT/MHc2CJ47lgJsKk8=" }, "white-out": { - "version": "https://registry.npmjs.org/white-out/-/white-out-2.0.0.tgz", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/white-out/-/white-out-2.0.0.tgz", "integrity": "sha1-lYGfXentpt3inWmnkoMNX9jUIcI=", "requires": { - "reach": "https://registry.npmjs.org/reach/-/reach-1.0.0.tgz", - "traverse": "https://registry.npmjs.org/traverse/-/traverse-0.6.6.tgz" + "reach": "1.0.0", + "traverse": "0.6.6" + }, + "dependencies": { + "reach": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/reach/-/reach-1.0.0.tgz", + "integrity": "sha1-TRLRYJYLysZ9xiTw+Ruv6zb3lPY=" + }, + "traverse": { + "version": "0.6.6", + "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.6.tgz", + "integrity": "sha1-y99WD9e5r2MlAv7UD5GMFX6pcTc=" + } } }, "window-size": { diff --git a/package.json b/package.json index d2287832..a6d4b31c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nzz/q-server", - "version": "2.6.0", + "version": "2.7.0", "description": "", "main": "index.js", "scripts": { @@ -26,6 +26,7 @@ "clone": "^2.1.1", "confidence": "^3.0.2", "deepmerge": "^1.5.0", + "enjoi": "^2.2.3", "good": "^7.1.0", "good-console": "^6.4.0", "good-squeeze": "^5.0.2", diff --git a/plugins/q-screenshot/helpers.js b/plugins/q-screenshot/helpers.js index 7ffd3c5f..972885ac 100644 --- a/plugins/q-screenshot/helpers.js +++ b/plugins/q-screenshot/helpers.js @@ -3,11 +3,6 @@ const fetch = require('node-fetch'); // start a chromium process here const browserPromise = puppeteer.launch({ args: ['--no-sandbox'] }); -let browserWSEndpoint; -browserPromise - .then(browser => { - browserWSEndpoint = browser.wsEndpoint(); - }) // fetches assets and returnes a concatenated string containing everything fetched async function getConcatenatedAssets(assets, userAgent) { @@ -31,16 +26,11 @@ async function getConcatenatedAssets(assets, userAgent) { } async function getScreenshot(emptyPageUrl, markup, scripts, stylesheets, config) { - await browserPromise; - - if (!browserWSEndpoint) { - throw new Error('Browser not ready yet'); - } - const browser = await puppeteer.connect({browserWSEndpoint: browserWSEndpoint}); + const browser = await browserPromise; const page = await browser.newPage(); - // the height of 16384 is just a wild guess that no graphic will ever exceed this + // the height of 16384 is the max height of a GL context in chromium or something await page.setViewport({ width: config.width, height: 16384, @@ -49,42 +39,56 @@ async function getScreenshot(emptyPageUrl, markup, scripts, stylesheets, config) await page.goto(emptyPageUrl); - let bodyStyle = 'margin: 0;'; + const userAgent = await page.evaluate(() => { + return navigator.userAgent; + }) + + const styleContent = await getConcatenatedAssets(stylesheets); + + let bodyStyle = 'margin: 0; padding: 0;'; if (config.background) { bodyStyle += `background: ${config.background}`; } - page.setContent(`
${markup}
`); - const userAgent = await page.evaluate(() => { - return navigator.userAgent; - }) + const content = ` + + + + + + +