diff --git a/CHANGELOG.md b/CHANGELOG.md index 00c032b86..392a403b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## 6.0.0 - 2023-02-08 + +- **BREAKING CHANGE**: Removed IE11 support (enketo-core#946) +- Fix: include drawings, signatures and annotated images in PDFs (#513) +- Fix: support single-column CSV (#520) +- fix: load external data when served with 'application/geo+json' Content-Type header (#519) +- Fix: rank widget on touch devices (enketo-core#947) +- Fix: undesired autocompletion of manually entered incomplete month-year (enketo-core#944) +- Optimize expensive XPath expressions in HTML transform (enketo-transformer#165) + ## 5.0.2 - 2022-12-22 - Fix: global install of pm2 (now with version pinned in package.json) in Dockerfile (#509) diff --git a/docs/app_lib_pdf.js.html b/docs/app_lib_pdf.js.html index af73cb352..38d655a32 100644 --- a/docs/app_lib_pdf.js.html +++ b/docs/app_lib_pdf.js.html @@ -113,6 +113,34 @@

app/lib/pdf.js

throw e; }); + /* + * This works around an issue with puppeteer not printing canvas + * images that were loaded from a file. + * It is likely this issue: https://bugs.chromium.org/p/chromium/issues/detail?id=809065 + * (though not WebGL-related as some of the commenters suggest) + */ + await page.evaluate(() => { + /* eslint-env browser */ + function canvasToImage(element) { + const image = document.createElement('img'); + image.src = element.toDataURL(); + + ['width', 'height', 'position', 'left', 'top'].forEach( + (property) => + (image.style[property] = element.style[property]) + ); + // overriding a general image style + image.style['max-width'] = '100%'; + image.className = element.className; + + element.parentNode && + element.parentNode.insertBefore(image, element); + element.parentNode && element.parentNode.removeChild(element); + } + + document.querySelectorAll('canvas').forEach(canvasToImage); + }); + pdf = await page.pdf({ landscape: options.landscape, format: options.format, diff --git a/locales/src/fr/translation.json b/locales/src/fr/translation.json index b5cdf801a..59332d103 100644 --- a/locales/src/fr/translation.json +++ b/locales/src/fr/translation.json @@ -221,10 +221,8 @@ "instancenotfound": "L'enregistrement n'a pas été trouvé. Il a peut-être expiré.", "invalidediturl": "Ceci n'est pas une URL d'édition valide", "loadfailed": "Impossible de charger __resource__", - "notfoundinformlist": [ - "Oups, ce formulaire n'existe plus. Le propriétaire du formulaire l'a probablement supprimé, archivé ou désactivé. Veuillez le contacter pour avoir de plus amples informations.", - "Erreur détaillée : Le formulaire avec l'ID __formId__ n'a pas été trouvé dans /formList." - ], + "notfoundinformlist": "Ce formulaire n'existe pas ou vous n'y avez plus accès. Veuillez vérifier l'URL et vous assurer qu'elle ne manque pas de caractères.\n\nSi le formulaire existait précédemment, il a peut-être été archivé, désactivé ou suprimmé. Si ceci est inattendu, veuillez contacter la personne qui vous a demandé de remplir le formulaire.\n\n(Tentative d'accès du formulaire avec ID: __formId__)", + "notfounddirectformurl": "Ce formulaire n'existe pas ou vous n'y avez plus accès. Veuillez vérifier l'URL et vous assurer qu'elle ne manque pas de caractères.\n\nSi le formulaire existait précédemment, il a peut-être été archivé, désactivé ou suprimmé. Si ceci est inattendu, veuillez contacter la personne qui vous a demandé de remplir le formulaire.\n\n(Tentative d'accès du formulaire: __notfounddirectformurl__)", "pagenotfound": "Page non trouvée", "surveyidnotactive": "L'enquête avec cet ID n'est plus active", "surveyidnotfound": "L'enquête avec cet ID n'a pas été trouvée", diff --git a/package-lock.json b/package-lock.json index 5594b03da..d6fde5bb3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "enketo-express", - "version": "5.0.2", + "version": "6.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1294,13 +1294,13 @@ "dev": true }, "@types/express": { - "version": "4.17.16", - "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.16.tgz", - "integrity": "sha512-LkKpqRZ7zqXJuvoELakaFYuETHjZkSol8EV6cNnyishutDBCCdv6+dsKPbKkCcIk57qRphOLY5sEgClw1bO3gA==", + "version": "4.17.17", + "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz", + "integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==", "dev": true, "requires": { "@types/body-parser": "*", - "@types/express-serve-static-core": "^4.17.31", + "@types/express-serve-static-core": "^4.17.33", "@types/qs": "*", "@types/serve-static": "*" } @@ -2706,6 +2706,11 @@ } } }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==" + }, "bootstrap-datepicker": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/bootstrap-datepicker/-/bootstrap-datepicker-1.9.0.tgz", @@ -3426,6 +3431,33 @@ "uid-safe": "2.1.5" } }, + "css-select": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", + "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", + "requires": { + "boolbase": "^1.0.0", + "css-what": "^6.1.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "nth-check": "^2.0.1" + } + }, + "css-what": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", + "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==" + }, + "css.escape": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", + "integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==" + }, + "cssom": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz", + "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==" + }, "csurf": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/csurf/-/csurf-1.11.0.tgz", @@ -3791,11 +3823,56 @@ } } }, + "dom-serializer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", + "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "requires": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "entities": "^4.2.0" + }, + "dependencies": { + "entities": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz", + "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==" + } + } + }, + "domelementtype": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", + "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==" + }, + "domhandler": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", + "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "requires": { + "domelementtype": "^2.3.0" + } + }, "domify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/domify/-/domify-1.4.0.tgz", "integrity": "sha512-CBzequt8IJiKV8fav4tn0qA9KSiZ76w3C2EkyfC8+df6UGNcZJRfvfBcRzLW39eGeETcunkOvvRBj/gKXIdULw==" }, + "domutils": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.0.1.tgz", + "integrity": "sha512-z08c1l761iKhDFtfXO04C7kTdPBLi41zwOZl00WS8b5eiaebNpY00HKbztwBq+e3vyqWNwWF3mP9YLUeqIrF+Q==", + "requires": { + "dom-serializer": "^2.0.0", + "domelementtype": "^2.3.0", + "domhandler": "^5.0.1" + } + }, + "drag-drop-touch": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/drag-drop-touch/-/drag-drop-touch-1.3.1.tgz", + "integrity": "sha512-Q0/ZgsnW7VUjn+YqSnp1rvxjjPnZX5YLyVaw28einood+eTMcLzgOgHk8nyqIF9O18J68l+2htlEnbw5GsyTvQ==" + }, "duplexify": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", @@ -3910,13 +3987,14 @@ "dev": true }, "enketo-core": { - "version": "6.1.7", - "resolved": "https://registry.npmjs.org/enketo-core/-/enketo-core-6.1.7.tgz", - "integrity": "sha512-hU42lu7600xVjBM1rMnxneDmLmrQzjgAEDXioy1E+4IiWAZs3BJeVg2Jn+Pgz6l7L/Qx6VTsPzU3Q7eWhUJeaA==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/enketo-core/-/enketo-core-7.0.0.tgz", + "integrity": "sha512-ylWbrA4A4gWw0dPFBx7llu/Cpq+noIBPxly6zWCSOqBBOvb8msx93vm3O3x/Af+7b15bG2x3CIJrpci+4jvw/g==", "requires": { "bootstrap-datepicker": "1.9.x", + "drag-drop-touch": "^1.3.1", "html5sortable": "^0.13.3", - "jquery": "^3.6.2", + "jquery": "^3.6.3", "jquery-touchswipe": "^1.6.19", "leaflet": "^1.9.3", "leaflet-draw": "github:enketo/Leaflet.draw#ff73078", @@ -3928,16 +4006,20 @@ } }, "enketo-transformer": { - "version": "2.1.7", - "resolved": "https://registry.npmjs.org/enketo-transformer/-/enketo-transformer-2.1.7.tgz", - "integrity": "sha512-/w3OvSQwzHiLN6lWkOIG4wmeBOXPeRkkzUhnG1TkIqcqE6D+LLiRJgNj43Gmh6SPef7z6skgR72r9k6OnZn+eg==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/enketo-transformer/-/enketo-transformer-2.2.1.tgz", + "integrity": "sha512-cvgYAXua2A/M1VbHjj+o1syoqMSGq9OUpUUm3p3Vk7WejeIRVHidu3BTGb3CMWdyyaERkPhPdyB8q9v0TRsGtQ==", "requires": { "body-parser": "^1.20.1", + "css.escape": "^1.5.1", "express": "^4.18.2", "language-tags": "1.0.5", "libxslt": "0.10.0", + "linkedom": "^0.14.21", + "prettier": "^2.8.3", "string-direction": "0.1.x", - "undici": "^5.13.0" + "undici": "^5.18.0", + "xpath-to-css": "^1.1.0" } }, "enquirer": { @@ -6637,6 +6719,24 @@ "resolved": "https://registry.npmjs.org/html5sortable/-/html5sortable-0.13.3.tgz", "integrity": "sha512-rmglSaNttGo4LY33PFW51mgeD1ItvHyfS9cRCD+Cj9Msj/xFaG/sZjLGVtPbtxYJmhY/c8jtw6G07yWhC2ifEw==" }, + "htmlparser2": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.1.tgz", + "integrity": "sha512-4lVbmc1diZC7GUJQtRQ5yBAeUCL1exyMwmForWkRLnwyzWBFxN633SALPMGYaWZvKe9j1pRZJpauvmxENSp/EA==", + "requires": { + "domelementtype": "^2.3.0", + "domhandler": "^5.0.2", + "domutils": "^3.0.1", + "entities": "^4.3.0" + }, + "dependencies": { + "entities": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz", + "integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==" + } + } + }, "http-cache-semantics": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", @@ -8033,6 +8133,25 @@ "integrity": "sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=", "dev": true }, + "linkedom": { + "version": "0.14.21", + "resolved": "https://registry.npmjs.org/linkedom/-/linkedom-0.14.21.tgz", + "integrity": "sha512-V+c0AAFMTVJA2iAhrdd+u44lL0TjL6hBenVB061VQ6BHqTAHtXw1v5F1/CHGKtwg0OHm+hrGbepb9ZSFJ7lJkg==", + "requires": { + "css-select": "^5.1.0", + "cssom": "^0.5.0", + "html-escaper": "^3.0.3", + "htmlparser2": "^8.0.1", + "uhyphen": "^0.1.0" + }, + "dependencies": { + "html-escaper": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz", + "integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==" + } + } + }, "linkify-it": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz", @@ -9814,6 +9933,14 @@ "lazy": "~1.0.11" } }, + "nth-check": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", + "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "requires": { + "boolbase": "^1.0.0" + } + }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", @@ -11147,10 +11274,9 @@ "dev": true }, "prettier": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.3.tgz", - "integrity": "sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw==", - "dev": true + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", + "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==" }, "prettier-linter-helpers": { "version": "1.0.0", @@ -13248,7 +13374,7 @@ "strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", "dev": true } } @@ -13359,6 +13485,11 @@ "dev": true, "optional": true }, + "uhyphen": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/uhyphen/-/uhyphen-0.1.0.tgz", + "integrity": "sha512-o0QVGuFg24FK765Qdd5kk0zU/U4dEsCtN/GSiwNI9i8xsSVtjIAOdTaVhLwZ1nrbWxFVMxNDDl+9fednsOMsBw==" + }, "uid-safe": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz", @@ -13417,9 +13548,9 @@ } }, "undici": { - "version": "5.14.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.14.0.tgz", - "integrity": "sha512-yJlHYw6yXPPsuOH0x2Ib1Km61vu4hLiRRQoafs+WUgX1vO64vgnxiCEN9dpIrhZyHFsai3F0AEj4P9zy19enEQ==", + "version": "5.18.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.18.0.tgz", + "integrity": "sha512-1iVwbhonhFytNdg0P4PqyIAXbdlVZVebtPDvuM36m66mRw4OGrCm2MYynJv/UENFLdP13J1nPVQzVE2zTs1OeA==", "requires": { "busboy": "^1.6.0" } @@ -13808,6 +13939,11 @@ "resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.27.tgz", "integrity": "sha512-fg03WRxtkCV6ohClePNAECYsmpKKTv5L8y/X3Dn1hQrec3POx2jHZ/0P2qQ6HvsrU1BmeqXcof3NGGueG6LxwQ==" }, + "xpath-to-css": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xpath-to-css/-/xpath-to-css-1.1.0.tgz", + "integrity": "sha512-+LkgkWUFj10DQujqovkQKiHdnfF01exhbr0UrXbIkq88vXTuAF1RcUvYV9YzE8dSKR9exKtCc8hgwl1xfs701A==" + }, "xregexp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz", diff --git a/package.json b/package.json index d4edecffa..55fc643f5 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "enketo-express", "description": "Webforms evolved.", "homepage": "https://enketo.org", - "version": "5.0.2", + "version": "6.0.0", "main": "./app.js", "engines": { "node": ">=14.8.0 <17", @@ -45,8 +45,8 @@ "csurf": "^1.11.0", "db.js": "^0.15.0", "debug": "^4.3.4", - "enketo-core": "^6.1.7", - "enketo-transformer": "2.1.7", + "enketo-core": "7.0.0", + "enketo-transformer": "2.2.1", "evp_bytestokey": "^1.0.3", "express": "^4.18.2", "express-cls-hooked": "^0.3.8", @@ -83,7 +83,7 @@ "@babel/eslint-parser": "^7.19.1", "@baladins/grunt-nodemon": "^0.4.6", "@types/db.js": "^0.14.7", - "@types/express": "^4.17.16", + "@types/express": "^4.17.17", "@types/geojson": "^7946.0.10", "@types/redis": "^2.8.32", "@types/sinon": "^10.0.13", @@ -133,7 +133,7 @@ "nock": "^13.3.0", "node-sass": "^7.0.3", "nyc": "^15.1.0", - "prettier": "^2.8.3", + "prettier": "^2.8.4", "rimraf": "^3.0.2", "sinon": "^11.1.2", "sinon-chai": "^3.7.0",