From 6862166064f72078cd6236aa2a256312413140f2 Mon Sep 17 00:00:00 2001 From: Maximilian Haye Date: Tue, 7 Jul 2020 14:08:29 +0200 Subject: [PATCH 01/35] fix: Allow Sequelize CLI to use options set in config.json Adds a config.js which uses lib/config to provide the Sequelize CLI with the same options as the application. Fixes #1396 Signed-off-by: Maximilian Haye --- .sequelizerc.example | 4 ++-- config.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 config.js diff --git a/.sequelizerc.example b/.sequelizerc.example index 868712f44b..e7a489e659 100644 --- a/.sequelizerc.example +++ b/.sequelizerc.example @@ -2,8 +2,8 @@ const path = require('path') const config = require('./lib/config') module.exports = { - config: path.resolve('config.json'), + config: path.resolve('config.js'), 'migrations-path': path.resolve('lib', 'migrations'), 'models-path': path.resolve('lib', 'models'), - url: process.env['CMD_DB_URL'] || config.dbURL + url: config.dbURL } diff --git a/config.js b/config.js new file mode 100644 index 0000000000..c8ad532fce --- /dev/null +++ b/config.js @@ -0,0 +1,3 @@ +const config = require('./lib/config') + +module.exports = config.db From 66d53956c4043773e5769fe80400516b0e10f605 Mon Sep 17 00:00:00 2001 From: James Tsai Date: Tue, 21 Jul 2020 00:09:44 +0800 Subject: [PATCH 02/35] Add delete note api Signed-off-by: James Tsai --- lib/note/index.js | 30 ++++++++++- lib/routes.js | 2 + package-lock.json | 134 +++++++++++++++++++++++----------------------- 3 files changed, 98 insertions(+), 68 deletions(-) diff --git a/lib/note/index.js b/lib/note/index.js index a387b59dba..eac2845ace 100644 --- a/lib/note/index.js +++ b/lib/note/index.js @@ -5,7 +5,7 @@ const logger = require('../logger') const { Note, User } = require('../models') const { newCheckViewPermission, errorForbidden, responseCodiMD, errorNotFound, errorInternalError } = require('../response') -const { updateHistory } = require('../history') +const { updateHistory, historyDelete } = require('../history') const { actionPublish, actionSlide, actionInfo, actionDownload, actionPDF, actionGist, actionRevision, actionPandoc } = require('./noteActions') async function getNoteById (noteId, { includeUser } = { includeUser: false }) { @@ -232,7 +232,35 @@ function listMyNotes (req, res) { } } +const deleteNote = async (req, res) => { + if(req.isAuthenticated()) { + const noteId = await Note.parseNoteIdAsync(req.params.noteId) + try { + const destroyed = await Note.destroy({ + where: { + id: noteId, + ownerId: req.user.id + } + }) + if (!destroyed) { + logger.error('Delete note failed: Make sure the noteId and ownerId are correct.') + return errorNotFound(req, res) + } + historyDelete(req, res) + res.send({ + status: 'ok' + }) + } catch (err) { + logger.error('Delete note failed: Internal Error.') + return errorInternalError(req, res) + } + } else { + return errorForbidden(req, res) + } +} + exports.showNote = showNote exports.showPublishNote = showPublishNote exports.noteActions = noteActions exports.listMyNotes = listMyNotes +exports.deleteNote = deleteNote diff --git a/lib/routes.js b/lib/routes.js index 48ac61f3dc..d36d3cdffd 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -72,6 +72,8 @@ appRouter.get('/p/:shortid', response.showPublishSlide) appRouter.get('/p/:shortid/:action', response.publishSlideActions) // gey my note list appRouter.get('/api/notes/myNotes', noteController.listMyNotes) +// delete note by id +appRouter.delete('/api/notes/:noteId', noteController.deleteNote) // get note by id appRouter.get('/:noteId', wrap(noteController.showNote)) // note actions diff --git a/package-lock.json b/package-lock.json index 59bce6982e..c5ceaba2fc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7434,28 +7434,28 @@ "dependencies": { "abbrev": { "version": "1.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true, "optional": true }, "ansi-regex": { "version": "2.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true, "optional": true }, "aproba": { "version": "1.2.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "dev": true, "optional": true }, "are-we-there-yet": { "version": "1.1.5", - "resolved": false, + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", "dev": true, "optional": true, @@ -7466,14 +7466,14 @@ }, "balanced-match": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true, "optional": true }, "brace-expansion": { "version": "1.1.11", - "resolved": false, + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "optional": true, @@ -7484,42 +7484,42 @@ }, "chownr": { "version": "1.1.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz", "integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==", "dev": true, "optional": true }, "code-point-at": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true, "optional": true }, "concat-map": { "version": "0.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true, "optional": true }, "console-control-strings": { "version": "1.1.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", "dev": true, "optional": true }, "core-util-is": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true, "optional": true }, "debug": { "version": "3.2.6", - "resolved": false, + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", "dev": true, "optional": true, @@ -7529,28 +7529,28 @@ }, "deep-extend": { "version": "0.6.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "dev": true, "optional": true }, "delegates": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "dev": true, "optional": true }, "detect-libc": { "version": "1.0.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", "dev": true, "optional": true }, "fs-minipass": { "version": "1.2.7", - "resolved": false, + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", "dev": true, "optional": true, @@ -7560,14 +7560,14 @@ }, "fs.realpath": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true, "optional": true }, "gauge": { "version": "2.7.4", - "resolved": false, + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "dev": true, "optional": true, @@ -7584,7 +7584,7 @@ }, "glob": { "version": "7.1.6", - "resolved": false, + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", "dev": true, "optional": true, @@ -7599,14 +7599,14 @@ }, "has-unicode": { "version": "2.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", "dev": true, "optional": true }, "iconv-lite": { "version": "0.4.24", - "resolved": false, + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, "optional": true, @@ -7616,7 +7616,7 @@ }, "ignore-walk": { "version": "3.0.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", "dev": true, "optional": true, @@ -7626,7 +7626,7 @@ }, "inflight": { "version": "1.0.6", - "resolved": false, + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "optional": true, @@ -7637,21 +7637,21 @@ }, "inherits": { "version": "2.0.4", - "resolved": false, + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true, "optional": true }, "ini": { "version": "1.3.5", - "resolved": false, + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "dev": true, "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true, "optional": true, @@ -7661,14 +7661,14 @@ }, "isarray": { "version": "1.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true, "optional": true }, "minimatch": { "version": "3.0.4", - "resolved": false, + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "optional": true, @@ -7678,14 +7678,14 @@ }, "minimist": { "version": "0.0.8", - "resolved": false, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true, "optional": true }, "minipass": { "version": "2.9.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz", "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", "dev": true, "optional": true, @@ -7696,7 +7696,7 @@ }, "minizlib": { "version": "1.3.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz", "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", "dev": true, "optional": true, @@ -7706,7 +7706,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "optional": true, @@ -7716,14 +7716,14 @@ }, "ms": { "version": "2.1.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true, "optional": true }, "needle": { "version": "2.4.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/needle/-/needle-2.4.0.tgz", "integrity": "sha512-4Hnwzr3mi5L97hMYeNl8wRW/Onhy4nUKR/lVemJ8gJedxxUyBLm9kkrDColJvoSfwi0jCNhD+xCdOtiGDQiRZg==", "dev": true, "optional": true, @@ -7735,7 +7735,7 @@ }, "node-pre-gyp": { "version": "0.14.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.14.0.tgz", "integrity": "sha512-+CvDC7ZttU/sSt9rFjix/P05iS43qHCOOGzcr3Ry99bXG7VX953+vFyEuph/tfqoYu8dttBkE86JSKBO2OzcxA==", "dev": true, "optional": true, @@ -7754,7 +7754,7 @@ }, "nopt": { "version": "4.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", "dev": true, "optional": true, @@ -7765,7 +7765,7 @@ }, "npm-bundled": { "version": "1.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.1.1.tgz", "integrity": "sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA==", "dev": true, "optional": true, @@ -7775,14 +7775,14 @@ }, "npm-normalize-package-bin": { "version": "1.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz", "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==", "dev": true, "optional": true }, "npm-packlist": { "version": "1.4.7", - "resolved": false, + "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.7.tgz", "integrity": "sha512-vAj7dIkp5NhieaGZxBJB8fF4R0078rqsmhJcAfXZ6O7JJhjhPK96n5Ry1oZcfLXgfun0GWTZPOxaEyqv8GBykQ==", "dev": true, "optional": true, @@ -7793,7 +7793,7 @@ }, "npmlog": { "version": "4.1.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "dev": true, "optional": true, @@ -7806,21 +7806,21 @@ }, "number-is-nan": { "version": "1.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true, "optional": true }, "object-assign": { "version": "4.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true, "optional": true }, "once": { "version": "1.4.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "optional": true, @@ -7830,21 +7830,21 @@ }, "os-homedir": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true, "optional": true }, "os-tmpdir": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true, "optional": true }, "osenv": { "version": "0.1.5", - "resolved": false, + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "dev": true, "optional": true, @@ -7855,21 +7855,21 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true, "optional": true }, "process-nextick-args": { "version": "2.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true, "optional": true }, "rc": { "version": "1.2.8", - "resolved": false, + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "dev": true, "optional": true, @@ -7882,7 +7882,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true, "optional": true @@ -7891,7 +7891,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": false, + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "optional": true, @@ -7907,7 +7907,7 @@ }, "rimraf": { "version": "2.7.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", "dev": true, "optional": true, @@ -7917,49 +7917,49 @@ }, "safe-buffer": { "version": "5.1.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true, "optional": true }, "safer-buffer": { "version": "2.1.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true, "optional": true }, "sax": { "version": "1.2.4", - "resolved": false, + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "dev": true, "optional": true }, "semver": { "version": "5.7.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true, "optional": true }, "set-blocking": { "version": "2.0.0", - "resolved": false, + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true, "optional": true }, "signal-exit": { "version": "3.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true, "optional": true }, "string-width": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true, "optional": true, @@ -7971,7 +7971,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "optional": true, @@ -7981,7 +7981,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "optional": true, @@ -7991,14 +7991,14 @@ }, "strip-json-comments": { "version": "2.0.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true, "optional": true }, "tar": { "version": "4.4.13", - "resolved": false, + "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz", "integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==", "dev": true, "optional": true, @@ -8014,14 +8014,14 @@ }, "util-deprecate": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true, "optional": true }, "wide-align": { "version": "1.1.3", - "resolved": false, + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "dev": true, "optional": true, @@ -8031,14 +8031,14 @@ }, "wrappy": { "version": "1.0.2", - "resolved": false, + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true, "optional": true }, "yallist": { "version": "3.1.1", - "resolved": false, + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true, "optional": true From b597dc981195607a9f9f4c3f80c7275b4724bc59 Mon Sep 17 00:00:00 2001 From: James Tsai Date: Tue, 21 Jul 2020 09:14:02 +0800 Subject: [PATCH 03/35] Add update note api Signed-off-by: James Tsai --- lib/note/index.js | 34 ++++++++++++++++++++++++++++++++++ lib/routes.js | 2 ++ 2 files changed, 36 insertions(+) diff --git a/lib/note/index.js b/lib/note/index.js index eac2845ace..f0e5de203f 100644 --- a/lib/note/index.js +++ b/lib/note/index.js @@ -259,8 +259,42 @@ const deleteNote = async (req, res) => { } } +const updateNote = async (req, res) => { + if(req.isAuthenticated()) { + const noteId = await Note.parseNoteIdAsync(req.params.noteId) + try { + const note = await Note.findOne({ + where: { + id: noteId, + } + }) + if (!note) { + logger.error('Update note failed: Can\'t find the note.') + return errorNotFound(req, res) + } + + const updated = await note.update({ + content: req.body.content, + }) + if (!updated) { + logger.error('Update note failed: Write data error.') + return errorInternalError(req, res) + } + res.send({ + status: 'ok' + }) + } catch (err) { + logger.error('Update note failed: Internal Error.') + return errorInternalError(req, res) + } + } else { + return errorForbidden(req, res) + } +} + exports.showNote = showNote exports.showPublishNote = showPublishNote exports.noteActions = noteActions exports.listMyNotes = listMyNotes exports.deleteNote = deleteNote +exports.updateNote = updateNote diff --git a/lib/routes.js b/lib/routes.js index d36d3cdffd..744339e595 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -74,6 +74,8 @@ appRouter.get('/p/:shortid/:action', response.publishSlideActions) appRouter.get('/api/notes/myNotes', noteController.listMyNotes) // delete note by id appRouter.delete('/api/notes/:noteId', noteController.deleteNote) +// update note content by id +appRouter.put('/api/notes/:noteId', urlencodedParser, noteController.updateNote) // get note by id appRouter.get('/:noteId', wrap(noteController.showNote)) // note actions From b3cf98b329ae07f8af4536e0675123cff4bf770b Mon Sep 17 00:00:00 2001 From: James Tsai Date: Tue, 21 Jul 2020 09:16:32 +0800 Subject: [PATCH 04/35] Fix linter Signed-off-by: James Tsai --- lib/note/index.js | 10 +++++----- public/js/extra.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/note/index.js b/lib/note/index.js index f0e5de203f..664ad46592 100644 --- a/lib/note/index.js +++ b/lib/note/index.js @@ -233,7 +233,7 @@ function listMyNotes (req, res) { } const deleteNote = async (req, res) => { - if(req.isAuthenticated()) { + if (req.isAuthenticated()) { const noteId = await Note.parseNoteIdAsync(req.params.noteId) try { const destroyed = await Note.destroy({ @@ -260,21 +260,21 @@ const deleteNote = async (req, res) => { } const updateNote = async (req, res) => { - if(req.isAuthenticated()) { + if (req.isAuthenticated()) { const noteId = await Note.parseNoteIdAsync(req.params.noteId) try { const note = await Note.findOne({ where: { - id: noteId, + id: noteId } }) if (!note) { logger.error('Update note failed: Can\'t find the note.') return errorNotFound(req, res) } - + const updated = await note.update({ - content: req.body.content, + content: req.body.content }) if (!updated) { logger.error('Update note failed: Write data error.') diff --git a/public/js/extra.js b/public/js/extra.js index 954a161ce0..8870b57ba0 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -516,7 +516,7 @@ export function finishView (view) { $value.unwrap() try { const data = transform(content) - $elem.html(`
`) + $elem.html('
') markmap($elem.find('svg')[0], data, { duration: 0 }) From cf1a25a62773f7631f32b290b2b4d7b932dd4fc7 Mon Sep 17 00:00:00 2001 From: James Tsai Date: Wed, 22 Jul 2020 22:41:53 +0800 Subject: [PATCH 05/35] Fix package-lock dependencies config Signed-off-by: James Tsai --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index c5ceaba2fc..130b5ec186 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7434,7 +7434,7 @@ "dependencies": { "abbrev": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "resolved": false, "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true, "optional": true From 96f8f06b008a66927794c8cb3f27a2d2386bc01e Mon Sep 17 00:00:00 2001 From: James Tsai Date: Thu, 23 Jul 2020 00:24:58 +0800 Subject: [PATCH 06/35] Disconnect online users by delete API Signed-off-by: James Tsai --- lib/note/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/note/index.js b/lib/note/index.js index 664ad46592..d020b46fbc 100644 --- a/lib/note/index.js +++ b/lib/note/index.js @@ -7,6 +7,7 @@ const { Note, User } = require('../models') const { newCheckViewPermission, errorForbidden, responseCodiMD, errorNotFound, errorInternalError } = require('../response') const { updateHistory, historyDelete } = require('../history') const { actionPublish, actionSlide, actionInfo, actionDownload, actionPDF, actionGist, actionRevision, actionPandoc } = require('./noteActions') +const realtime = require('../realtime/realtime') async function getNoteById (noteId, { includeUser } = { includeUser: false }) { const id = await Note.parseNoteIdAsync(noteId) @@ -246,7 +247,14 @@ const deleteNote = async (req, res) => { logger.error('Delete note failed: Make sure the noteId and ownerId are correct.') return errorNotFound(req, res) } + historyDelete(req, res) + + if (realtime.isNoteExistsInPool(noteId)) { + const note = realtime.getNoteFromNotePool(noteId) + realtime.disconnectSocketOnNote(note) + } + res.send({ status: 'ok' }) From 53526c154a6c9bed6a635266ca9f8d3f3539f55d Mon Sep 17 00:00:00 2001 From: James Tsai Date: Mon, 27 Jul 2020 17:59:51 +0800 Subject: [PATCH 07/35] Check online users, update authorships, save revisions in update note content API Signed-off-by: James Tsai --- lib/note/index.js | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/lib/note/index.js b/lib/note/index.js index d020b46fbc..9ae7a16050 100644 --- a/lib/note/index.js +++ b/lib/note/index.js @@ -2,12 +2,13 @@ const config = require('../config') const logger = require('../logger') -const { Note, User } = require('../models') +const { Note, User, Revision } = require('../models') const { newCheckViewPermission, errorForbidden, responseCodiMD, errorNotFound, errorInternalError } = require('../response') const { updateHistory, historyDelete } = require('../history') const { actionPublish, actionSlide, actionInfo, actionDownload, actionPDF, actionGist, actionRevision, actionPandoc } = require('./noteActions') const realtime = require('../realtime/realtime') +const moment = require('moment') async function getNoteById (noteId, { includeUser } = { includeUser: false }) { const id = await Note.parseNoteIdAsync(noteId) @@ -281,13 +282,37 @@ const updateNote = async (req, res) => { return errorNotFound(req, res) } + if (realtime.isNoteExistsInPool(noteId)) { + logger.error('Update note failed: There are online users opening this note.') + return res.status('403').send({ status: 'error', message: 'Update API can only be used when no users is online' }) + } + + const now = Date.now() + const content = req.body.content const updated = await note.update({ - content: req.body.content + content: content, + lastchangeAt: moment(now).format('YYYY-MM-DD HH:mm:ss'), + authorship: [ + [ + req.user.id, + 0, + content.length, + now, + now + ] + ] }) + if (!updated) { - logger.error('Update note failed: Write data error.') + logger.error('Update note failed: Write note content error.') return errorInternalError(req, res) } + + Revision.saveNoteRevision(note, (err, revision) => { + if (err) return errorInternalError(req, res) + if (!revision) return errorNotFound(req, res) + }) + res.send({ status: 'ok' }) From 04fe74d52011fa73bff74762a722dad98be11305 Mon Sep 17 00:00:00 2001 From: James Tsai Date: Thu, 30 Jul 2020 18:13:35 +0800 Subject: [PATCH 08/35] Refactor, use body parser, adjust update api content column Signed-off-by: James Tsai --- lib/note/index.js | 16 +++++++++------- lib/routes.js | 3 ++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/note/index.js b/lib/note/index.js index 9ae7a16050..de401883d1 100644 --- a/lib/note/index.js +++ b/lib/note/index.js @@ -8,7 +8,6 @@ const { newCheckViewPermission, errorForbidden, responseCodiMD, errorNotFound, e const { updateHistory, historyDelete } = require('../history') const { actionPublish, actionSlide, actionInfo, actionDownload, actionPDF, actionGist, actionRevision, actionPandoc } = require('./noteActions') const realtime = require('../realtime/realtime') -const moment = require('moment') async function getNoteById (noteId, { includeUser } = { includeUser: false }) { const id = await Note.parseNoteIdAsync(noteId) @@ -291,7 +290,7 @@ const updateNote = async (req, res) => { const content = req.body.content const updated = await note.update({ content: content, - lastchangeAt: moment(now).format('YYYY-MM-DD HH:mm:ss'), + lastchangeAt: now, authorship: [ [ req.user.id, @@ -309,14 +308,17 @@ const updateNote = async (req, res) => { } Revision.saveNoteRevision(note, (err, revision) => { - if (err) return errorInternalError(req, res) + if (err) { + logger.error(err) + return errorInternalError(req, res) + } if (!revision) return errorNotFound(req, res) - }) - - res.send({ - status: 'ok' + res.send({ + status: 'ok' + }) }) } catch (err) { + logger.error(err) logger.error('Update note failed: Internal Error.') return errorInternalError(req, res) } diff --git a/lib/routes.js b/lib/routes.js index 744339e595..9d15c3499b 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -12,6 +12,7 @@ const historyController = require('./history') const userController = require('./user') const noteController = require('./note') const response = require('./response') +const bodyParser = require('body-parser') const appRouter = Router() // register route @@ -75,7 +76,7 @@ appRouter.get('/api/notes/myNotes', noteController.listMyNotes) // delete note by id appRouter.delete('/api/notes/:noteId', noteController.deleteNote) // update note content by id -appRouter.put('/api/notes/:noteId', urlencodedParser, noteController.updateNote) +appRouter.put('/api/notes/:noteId', bodyParser.json(), noteController.updateNote) // get note by id appRouter.get('/:noteId', wrap(noteController.showNote)) // note actions From 091c77bdb1f05263543f85f5c6f04f5bfaf3c722 Mon Sep 17 00:00:00 2001 From: James Tsai Date: Thu, 30 Jul 2020 18:55:36 +0800 Subject: [PATCH 09/35] Refactor, change response type to json in update-api user online checking Signed-off-by: James Tsai --- lib/note/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/note/index.js b/lib/note/index.js index de401883d1..be4f8aceb2 100644 --- a/lib/note/index.js +++ b/lib/note/index.js @@ -283,7 +283,7 @@ const updateNote = async (req, res) => { if (realtime.isNoteExistsInPool(noteId)) { logger.error('Update note failed: There are online users opening this note.') - return res.status('403').send({ status: 'error', message: 'Update API can only be used when no users is online' }) + return res.status('403').json({ status: 'error', message: 'Update API can only be used when no users is online' }) } const now = Date.now() From e7a4996cbe7b962a54233bfa2d3b53d39ad336e5 Mon Sep 17 00:00:00 2001 From: James Tsai Date: Tue, 4 Aug 2020 16:47:57 +0800 Subject: [PATCH 10/35] Update note title and history in update api Signed-off-by: James Tsai --- lib/note/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/note/index.js b/lib/note/index.js index be4f8aceb2..8f41876f60 100644 --- a/lib/note/index.js +++ b/lib/note/index.js @@ -289,6 +289,7 @@ const updateNote = async (req, res) => { const now = Date.now() const content = req.body.content const updated = await note.update({ + title: Note.parseNoteTitle(content), content: content, lastchangeAt: now, authorship: [ @@ -307,6 +308,8 @@ const updateNote = async (req, res) => { return errorInternalError(req, res) } + updateHistory(req.user.id, note) + Revision.saveNoteRevision(note, (err, revision) => { if (err) { logger.error(err) From 47929081699041aecba2de8ab62caee34d1e5ad9 Mon Sep 17 00:00:00 2001 From: James Tsai Date: Tue, 4 Aug 2020 17:10:45 +0800 Subject: [PATCH 11/35] Fix linter Signed-off-by: James Tsai --- lib/note/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/note/index.js b/lib/note/index.js index 8f41876f60..68ca792ade 100644 --- a/lib/note/index.js +++ b/lib/note/index.js @@ -308,7 +308,7 @@ const updateNote = async (req, res) => { return errorInternalError(req, res) } - updateHistory(req.user.id, note) + updateHistory(req.user.id, note) Revision.saveNoteRevision(note, (err, revision) => { if (err) { From 94aa54b4958381ea8aaf4fdb679bf1601c6d47d1 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 12 Aug 2020 17:19:20 +0800 Subject: [PATCH 12/35] Support empty fretboard title Signed-off-by: Yukai Huang --- public/js/lib/renderer/fretboard/fretboard.js | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/public/js/lib/renderer/fretboard/fretboard.js b/public/js/lib/renderer/fretboard/fretboard.js index fdd97fd624..48d1cb7854 100644 --- a/public/js/lib/renderer/fretboard/fretboard.js +++ b/public/js/lib/renderer/fretboard/fretboard.js @@ -32,26 +32,33 @@ const switchListH = { '\n': `
${dotEmptyH}
${dotEmptyH}
` } -export const renderFretBoard = (content, { title: fretTitle, type }) => { - const fretType = type.split(' ') - const containerClass = fretType && fretType[0].startsWith('h') ? 'fretContainer_h' : 'fretContainer' +export const renderFretBoard = (content, { title: fretTitle = '', type = '' }) => { + const isVertical = !(typeof type[0] === 'string' && type[0].startsWith('h')) + + const containerClass = isVertical ? 'fretContainer' : 'fretContainer_h' + + const [fretType, nutOption] = type.split(' ') const fretboardHTML = $(`
`) - $(fretboardHTML).append($(`
${fretTitle}
`)) + if (fretTitle) { + $(fretboardHTML).append(`
${fretTitle}
`) + } // create fretboard background HTML - const fretbOrientation = fretType && fretType[0].startsWith('v') ? 'vert' : 'horiz' - const fretbLen = fretType && fretType[0].substring(1) - const fretbClass = fretType && fretType[0][0] + ' ' + fretType[0] - const nut = (fretType[1] && fretType[1] === 'noNut') ? 'noNut' : '' + const fretbOrientation = isVertical ? 'vert' : 'horiz' + const fretbLen = fretType && fretType.substring(1) + const fretbClass = fretType && fretType[0] + ' ' + fretType + const nut = nutOption === 'noNut' ? 'noNut' : '' + const svgHTML = $(`
`) const fretbBg = require(`./svg/fretb_${fretbOrientation}_${fretbLen}.svg`) + $(svgHTML).append($(fretbBg)) // create cells HTML const cellsHTML = $('
') - let switchList = '' - if (fretbOrientation && fretbOrientation === 'vert') { + let switchList = {} + if (isVertical) { switchList = switchListV } else { // calculate position @@ -66,16 +73,16 @@ export const renderFretBoard = (content, { title: fretTitle, type }) => { const numArray = [...Array(10).keys()].slice(1) contentCell && contentCell.forEach(char => { if (numArray.toString().indexOf(char) !== -1) { - const numType = fretType && fretType[0].startsWith('h') ? '_h' : '' + const numType = isVertical ? '' : '_h' const numSvg = require(`./svg/number${char}${numType}.svg`) - cellsHTML.append($(`
${numSvg}
`)) - } else if (switchList[char] !== undefined) { - cellsHTML.append($(switchList[char])) + cellsHTML.append(`
${numSvg}
`) + } else if (typeof switchList[char] !== 'undefined') { + cellsHTML.append(switchList[char]) } }) - $(svgHTML).append($(cellsHTML)) - $(fretboardHTML).append($(svgHTML)) + $(svgHTML).append(cellsHTML) + $(fretboardHTML).append(svgHTML) return fretboardHTML[0].outerHTML } From 12b8f09d52d4383225361dbf9079f71f19743cbc Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 12 Aug 2020 17:21:21 +0800 Subject: [PATCH 13/35] Finetune fretboard css Signed-off-by: Yukai Huang --- public/js/extra.js | 1 + public/js/lib/renderer/fretboard/css/i.css | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/public/js/extra.js b/public/js/extra.js index 954a161ce0..9a7c8f8dbf 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -502,6 +502,7 @@ export function finishView (view) { try { const $ele = $(value).parent().parent() $ele.html(renderFretBoard($value.text(), params)) + $ele.addClass('fretboard') } catch (err) { $value.unwrap() $value.parent().append(`
${escapeHTML(err)}
`) diff --git a/public/js/lib/renderer/fretboard/css/i.css b/public/js/lib/renderer/fretboard/css/i.css index 86e15080c6..4ce5336660 100644 --- a/public/js/lib/renderer/fretboard/css/i.css +++ b/public/js/lib/renderer/fretboard/css/i.css @@ -1,8 +1,8 @@ /* -- GENERAL TYPOGRAPHY -- */ .fretTitle { color: #555; + text-align: center; font-family: "Helvetica Neue", sans-serif; - background: #eee; line-height: 1.4; font-size: 1.6em; margin: 10px 0 10px 0; @@ -20,14 +20,19 @@ section { } /* Fretboard Container/Wrapper */ + +.fretContainer, .fretContainer_h { + outline: solid 1px #eeee; + margin: 0 auto; + padding: 15px 0; +} + .fretContainer { width: 320px; - margin: 0 auto; } .fretContainer_h { max-width: 400px; - margin: 0 auto; } @media all and (max-width: 400px) { @@ -59,7 +64,6 @@ section { position: absolute; top: 0; left: 0; - z-index: 10; } .svg_wrapper.v4 { @@ -181,3 +185,7 @@ section { } /*# sourceMappingURL=i.css.map */ + +.markdown-body pre.fretboard { + background-color: transparent; +} From ab0ac83582ff8a09f3e5b0a9ad461e99129eaeef Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 12 Aug 2020 18:10:39 +0800 Subject: [PATCH 14/35] Fix updateHistory parameter Signed-off-by: Yukai Huang --- lib/note/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/note/index.js b/lib/note/index.js index 68ca792ade..0a20238ed8 100644 --- a/lib/note/index.js +++ b/lib/note/index.js @@ -308,7 +308,7 @@ const updateNote = async (req, res) => { return errorInternalError(req, res) } - updateHistory(req.user.id, note) + updateHistory(req.user.id, note.id, content) Revision.saveNoteRevision(note, (err, revision) => { if (err) { From 038fac1e9174f372e92f7e6086d98e6351b6453c Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Thu, 13 Aug 2020 15:01:04 +0800 Subject: [PATCH 15/35] Add fretboard example and link to features.md Signed-off-by: Yukai Huang --- public/docs/features.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/public/docs/features.md b/public/docs/features.md index d806dd834b..541b5d691b 100644 --- a/public/docs/features.md +++ b/public/docs/features.md @@ -369,6 +369,18 @@ stop } ``` +### Fretboard + +```fretboard {title="horizontal, 6 frets, with nut", type="h6"} +-oO-*- +--o-o- +-o-oo- +-o-oO- +-oo-o- +-*O-o- + 3 +``` + > More information about **sequence diagrams** syntax [here](http://bramp.github.io/js-sequence-diagrams/). > More information about **flow charts** syntax [here](http://adrai.github.io/flowchart.js/). > More information about **graphviz** syntax [here](http://www.tonyballantyne.com/graphs.html) @@ -376,6 +388,7 @@ stop > More information about **abc** syntax [here](http://abcnotation.com/learn) > More information about **plantuml** syntax [here](http://plantuml.com/index) > More information about **vega** syntax [here](https://vega.github.io/vega-lite/docs) +> More information about **fretboard** syntax [here](https://hackmd.io/@docs/fretboard-syntax) Alert Area --- From cfbae54ef8ab0041f263d78b3ed9763115e4c98d Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Thu, 13 Aug 2020 17:46:42 +0800 Subject: [PATCH 16/35] Allow specifying option for graphviz Signed-off-by: Yukai Huang --- public/js/extra.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/js/extra.js b/public/js/extra.js index 21163adb82..d1f605c3ec 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -368,9 +368,10 @@ export function finishView (view) { graphvizs.each(function (key, value) { try { var $value = $(value) + const options = deserializeParamAttributeFromElement(value) var $ele = $(value).parent().parent() $value.unwrap() - viz.renderString($value.text()) + viz.renderString($value.text(), options) .then(graphviz => { if (!graphviz) throw Error('viz.js output empty graph') $value.html(graphviz) From 1585abdb848b4697c2323e81fba37ad907cdcdb8 Mon Sep 17 00:00:00 2001 From: Santiago Gil Date: Thu, 13 Aug 2020 22:55:34 +0100 Subject: [PATCH 17/35] Spellcheck: add en_GB dictionary Signed-off-by: Santiago Gil --- package-lock.json | 6 ++++++ package.json | 1 + public/js/lib/editor/spellcheck.js | 12 ++++++++++++ webpack.common.js | 5 +++++ 4 files changed, 24 insertions(+) diff --git a/package-lock.json b/package-lock.json index 130b5ec186..cfeb332afe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5403,6 +5403,12 @@ "resolved": "https://registry.npmjs.org/dictionary-de-ch/-/dictionary-de-ch-2.0.3.tgz", "integrity": "sha512-+eqpz5j8WONSzxmc4avCN4XX/6q5+J6JfWz2AaluZIOVNgXPxUjXBhKS73+nRhM3nE1pGeRMqkyZevTQWgYTTw==", "dev": true + }, + "dictionary-en-gb": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/dictionary-en-gb/-/dictionary-en-gb-2.2.2.tgz", + "integrity": "sha512-36Pz/2BGmJfXtAo5+IGOi+U6gwtxFsFXFJMOX0FC1z2YeLd1IXkxsfAhieC06OrdGie3SqCZmUOYeYgct5Hzzw==", + "dev": true }, "diff": { "version": "3.5.0", diff --git a/package.json b/package.json index 0e38cb5990..70090dfa31 100644 --- a/package.json +++ b/package.json @@ -121,6 +121,7 @@ "dictionary-de": "^2.0.3", "dictionary-de-at": "^2.0.3", "dictionary-de-ch": "^2.0.3", + "dictionary-en-gb": "^2.2.2", "doctoc": "~1.4.0", "ejs-loader": "~0.3.1", "exports-loader": "~0.7.0", diff --git a/public/js/lib/editor/spellcheck.js b/public/js/lib/editor/spellcheck.js index c3d619a566..00aa0062a0 100644 --- a/public/js/lib/editor/spellcheck.js +++ b/public/js/lib/editor/spellcheck.js @@ -18,6 +18,18 @@ export const supportLanguages = [ cdnUrl: `${serverurl}/vendor/codemirror-spell-checker/en_US.dic` } }, + { + name: 'English (United Kingdom)', + value: 'en_GB', + aff: { + url: `${serverurl}/build/dictionary-en-gb/index.aff`, + cdnUrl: 'https://cdn.jsdelivr.net/npm/dictionary-en-gb@2.2.2/index.aff' + }, + dic: { + url: `${serverurl}/build/dictionary-en-gb/index.dic`, + cdnUrl: 'https://cdn.jsdelivr.net/npm/dictionary-en-gb@2.2.2/index.dic' + } + }, { name: 'German', value: 'de', diff --git a/webpack.common.js b/webpack.common.js index 4866b51e37..fabf1c35ce 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -181,6 +181,11 @@ module.exports = { from: '*', to: 'dictionary-de-ch/' }, + { + context: path.join(__dirname, 'node_modules/dictionary-en-gb'), + from: '*', + to: 'dictionary-en-gb/' + }, { context: path.join(__dirname, 'node_modules/leaflet'), from: 'dist', From d89caac21ab7169ba7be2cbc11dd9d4669184914 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Fri, 14 Aug 2020 12:12:24 +0800 Subject: [PATCH 18/35] Bump codemirror version to 5.49.8 Signed-off-by: Yukai Huang --- package-lock.json | 74 +++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/package-lock.json b/package-lock.json index 130b5ec186..1bcfc87d9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -786,9 +786,9 @@ "dev": true }, "@hackmd/codemirror": { - "version": "5.49.5", - "resolved": "https://registry.npmjs.org/@hackmd/codemirror/-/codemirror-5.49.5.tgz", - "integrity": "sha512-9R/5wfex+Ik0L5TChqByf/SpwMTRXCrbiD0TB+R61CTfpRIv4LJp/khOxRFoZNvpFu6LXuejey+2gjD47PDS9g==", + "version": "5.49.8", + "resolved": "https://registry.npmjs.org/@hackmd/codemirror/-/codemirror-5.49.8.tgz", + "integrity": "sha512-UIkcTHeVDta9/Otr1IljP9d52YfDQq35ypndichvAEWoTGpq+s9ED2zv2QkYdsdoJ0z6ggwOooFJAoWiHFfYVQ==", "dev": true, "requires": { "blint": "^1", @@ -3190,9 +3190,9 @@ } }, "blint": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/blint/-/blint-1.1.0.tgz", - "integrity": "sha512-XSNoVy5Hu6fE3xSL4M7EDrIL5UrxkMlSpOChF9rf3aEKyx1/hI/WIetmfS72JVcDUozbl7usaVt5hWx620Fjig==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/blint/-/blint-1.1.1.tgz", + "integrity": "sha512-kpYOL/1xnokcGTUpwfpsfw25YyYHrbgTfx6ym2zgSWb+ok7ga30/ha8qOaiPQufSNIGcnNcZQUkQkRF6YkmmXQ==", "dev": true, "requires": { "acorn": "^7.0.0", @@ -3201,15 +3201,15 @@ }, "dependencies": { "acorn": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", - "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==", + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.0.tgz", + "integrity": "sha512-+G7P8jJmCHr+S+cLfQxygbWhXy+8YTVGzAkpEbcLo2mLoL7tij/VG41QSHACSf5QgYRhMZYHuNc6drJaO0Da+w==", "dev": true }, "acorn-walk": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.1.1.tgz", - "integrity": "sha512-wdlPY2tm/9XBr7QkKlq0WQVgiuGTX6YWPyRyBviSoScBuLfTVQhvwg6wJ369GJ/1nPfTLMfnrFIfjqVg6d+jQQ==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", + "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", "dev": true } } @@ -10272,9 +10272,9 @@ } }, "magic-string": { - "version": "0.25.6", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.6.tgz", - "integrity": "sha512-3a5LOMSGoCTH5rbqobC2HuDNRtE2glHZ8J7pK+QZYppyWA36yuNpsX994rIY2nCuyP7CZYy7lQq/X2jygiZ89g==", + "version": "0.25.7", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", + "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", "dev": true, "requires": { "sourcemap-codec": "^1.4.4" @@ -14092,9 +14092,9 @@ "dev": true }, "regenerate-unicode-properties": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz", - "integrity": "sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz", + "integrity": "sha512-F9DjY1vKLo/tPePDycuH3dn9H1OTPIkVD9Kz4LODu+F2C75mgjAJ7x/gwy6ZcSNRAAkhNlJSOHRe8k3p+K9WhA==", "dev": true, "requires": { "regenerate": "^1.4.0" @@ -14142,29 +14142,29 @@ "dev": true }, "regexpu-core": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.6.0.tgz", - "integrity": "sha512-YlVaefl8P5BnFYOITTNzDvan1ulLOiXJzCNZxduTIosN17b87h3bvG9yHMoHaRuo88H4mQ06Aodj5VtYGGGiTg==", + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.7.0.tgz", + "integrity": "sha512-TQ4KXRnIn6tz6tjnrXEkD/sshygKH/j5KzK86X8MkeHyZ8qst/LZ89j3X4/8HEIfHANTFIP/AbXakeRhWIl5YQ==", "dev": true, "requires": { "regenerate": "^1.4.0", - "regenerate-unicode-properties": "^8.1.0", - "regjsgen": "^0.5.0", - "regjsparser": "^0.6.0", + "regenerate-unicode-properties": "^8.2.0", + "regjsgen": "^0.5.1", + "regjsparser": "^0.6.4", "unicode-match-property-ecmascript": "^1.0.4", - "unicode-match-property-value-ecmascript": "^1.1.0" + "unicode-match-property-value-ecmascript": "^1.2.0" }, "dependencies": { "regjsgen": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.1.tgz", - "integrity": "sha512-5qxzGZjDs9w4tzT3TPhCJqWdCc3RLYwy9J2NB0nm5Lz+S273lvWcpjaTGHsT1dc6Hhfq41uSEOw8wBmxrKOuyg==", + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz", + "integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==", "dev": true }, "regjsparser": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.3.tgz", - "integrity": "sha512-8uZvYbnfAtEm9Ab8NTb3hdLwL4g/LQzEYP7Xs27T96abJCCE2d6r3cPZPQEsLKy0vRSGVNG+/zVGtLr86HQduA==", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.6.4.tgz", + "integrity": "sha512-64O87/dPDgfk8/RQqC4gkZoGyyWFIEUTTh80CU6CWuK5vkCGyekIx+oKcEIYtP/RAxSQltCZHCNu/mdd7fqlJw==", "dev": true, "requires": { "jsesc": "~0.5.0" @@ -16588,15 +16588,15 @@ } }, "unicode-match-property-value-ecmascript": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.1.0.tgz", - "integrity": "sha512-hDTHvaBk3RmFzvSl0UVrUmC3PuW9wKVnpoUDYH0JDkSIovzw+J5viQmeYHxVSBptubnr7PbH2e0fnpDRQnQl5g==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.2.0.tgz", + "integrity": "sha512-wjuQHGQVofmSJv1uVISKLE5zO2rNGzM/KCYZch/QQvez7C1hUhBIuZ701fYXExuufJFMPhv2SyL8CyoIfMLbIQ==", "dev": true }, "unicode-property-aliases-ecmascript": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.5.tgz", - "integrity": "sha512-L5RAqCfXqAwR3RriF8pM0lU0w4Ryf/GgzONwi6KnL1taJQa7x1TCxdJnILX59WIGOwR57IVxn7Nej0fz1Ny6fw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.1.0.tgz", + "integrity": "sha512-PqSoPh/pWetQ2phoj5RLiaqIk4kCNwoV3CI+LfGmWLKI3rE3kl1h59XpX2BjgDrmbxD9ARtQobPGU1SguCYuQg==", "dev": true }, "unified": { diff --git a/package.json b/package.json index 0e38cb5990..1ca0c0524c 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "ws": "~7.1.1" }, "devDependencies": { - "@hackmd/codemirror": "~5.49.5", + "@hackmd/codemirror": "~5.49.8", "@hackmd/emojify.js": "^2.1.0", "@hackmd/idle-js": "~1.0.1", "@hackmd/js-sequence-diagrams": "~0.0.1-alpha.3", From 341591d10baa81d58853c211454bee277becd8e1 Mon Sep 17 00:00:00 2001 From: TAKAHASHI Tamotsu Date: Fri, 28 Aug 2020 13:28:34 +0900 Subject: [PATCH 19/35] Fix ui-edit and ui-both button in night mode Fix #1539 Signed-off-by: Tamotsu Takahashi --- public/css/index.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/css/index.css b/public/css/index.css index eeb1f8b98a..d2e3fe6db0 100644 --- a/public/css/index.css +++ b/public/css/index.css @@ -411,7 +411,7 @@ div[contenteditable]:empty:not(:focus):before{ color: #eee; } -.night .btn.btn-default.ui-view.active{ +.night .btn.btn-default.active{ background: #202020; } From 6bf5e7ee72ed4968aeb46ad5dfa9a541f6b727ff Mon Sep 17 00:00:00 2001 From: Michal Kolodziejski Date: Fri, 2 Oct 2020 15:46:23 +0200 Subject: [PATCH 20/35] Don't run jsonlint on .vscode jsonc files Signed-off-by: Michal Kolodziejski --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4aeef4ae94..74134c1428 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "dev": "webpack --config webpack.dev.js --progress --colors --watch", "doctoc": "doctoc --title='# Table of Contents' README.md", "lint": "standard", - "jsonlint": "find . -type f -not -ipath \"./node_modules/*\" \\( -name \"*.json\" -o -name \"*.json.*\" \\) | xargs -n 1 -I{} -- bash -c 'echo {}; jq . {} > /dev/null;'", + "jsonlint": "find . -type f -not -ipath \"./node_modules/*\" -not -ipath \"./.vscode/*\" \\( -name \"*.json\" -o -name \"*.json.*\" \\) | xargs -n 1 -I{} -- bash -c 'echo {}; jq . {} > /dev/null;'", "start": "sequelize db:migrate && node app.js", "mocha": "mocha --require intelli-espower-loader --exit ./test --recursive", "mocha:ci": "mocha --no-color -R dot --require intelli-espower-loader --exit ./test --recursive", From 26a2c746d320ba9a5b1ba0326a340fcd6f3f970f Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Mon, 21 Dec 2020 14:10:03 +0800 Subject: [PATCH 21/35] Escape attributes in lightbox image Signed-off-by: Yukai Huang --- public/js/lib/renderer/lightbox/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/js/lib/renderer/lightbox/index.js b/public/js/lib/renderer/lightbox/index.js index 3619e0aeec..e46e0a143a 100644 --- a/public/js/lib/renderer/lightbox/index.js +++ b/public/js/lib/renderer/lightbox/index.js @@ -1,4 +1,5 @@ import './lightbox.css' +import escape from 'lodash/escape' let images = [] /** @type {HTMLImageElement} */ @@ -74,7 +75,7 @@ function setImageInner (img, lightBoxContainer) { const src = img.getAttribute('src') const alt = img.getAttribute('alt') - lightBoxContainer.querySelector('.lightbox-inner').innerHTML = `${alt}` + lightBoxContainer.querySelector('.lightbox-inner').innerHTML = `${escape(alt)}` addImageDragListener(lightBoxContainer.querySelector('.lightbox-inner img')) } From 8d9a9ab0b2895b82351650165b10c6ebf8b17285 Mon Sep 17 00:00:00 2001 From: Max Wu Date: Mon, 21 Dec 2020 14:19:47 +0800 Subject: [PATCH 22/35] fix: avoid eval string when putting back parsed string of mermaid where has stored XSS issue Signed-off-by: Max Wu --- public/js/extra.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/js/extra.js b/public/js/extra.js index d1f605c3ec..b36dd931fd 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -397,9 +397,10 @@ export function finishView (view) { var $value = $(value) const $ele = $(value).closest('pre') - window.mermaid.parse($value.text()) + let text = $value.text() + window.mermaid.parse(text) $ele.addClass('mermaid') - $ele.html($value.text()) + $ele.text(text) window.mermaid.init(undefined, $ele) } catch (err) { $value.unwrap() From 5fee551d698ec652df8784a480460e8bb0179521 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Mon, 21 Dec 2020 14:25:47 +0800 Subject: [PATCH 23/35] Fix fretboard title xss issue Signed-off-by: Yukai Huang --- package-lock.json | 2 +- public/js/lib/renderer/fretboard/fretboard.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index c9b2e40973..7ab88ee31c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5404,7 +5404,7 @@ "integrity": "sha512-+eqpz5j8WONSzxmc4avCN4XX/6q5+J6JfWz2AaluZIOVNgXPxUjXBhKS73+nRhM3nE1pGeRMqkyZevTQWgYTTw==", "dev": true }, - "dictionary-en-gb": { + "dictionary-en-gb": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/dictionary-en-gb/-/dictionary-en-gb-2.2.2.tgz", "integrity": "sha512-36Pz/2BGmJfXtAo5+IGOi+U6gwtxFsFXFJMOX0FC1z2YeLd1IXkxsfAhieC06OrdGie3SqCZmUOYeYgct5Hzzw==", diff --git a/public/js/lib/renderer/fretboard/fretboard.js b/public/js/lib/renderer/fretboard/fretboard.js index 48d1cb7854..c7e56fd160 100644 --- a/public/js/lib/renderer/fretboard/fretboard.js +++ b/public/js/lib/renderer/fretboard/fretboard.js @@ -1,4 +1,5 @@ /* global $ */ +import escapeHTML from 'lodash/escape' import './css/i.css' import dotEmpty from './svg/dotEmpty.svg' @@ -41,7 +42,7 @@ export const renderFretBoard = (content, { title: fretTitle = '', type = '' }) = const fretboardHTML = $(`
`) if (fretTitle) { - $(fretboardHTML).append(`
${fretTitle}
`) + $(fretboardHTML).append(`
${escapeHTML(fretTitle)}
`) } // create fretboard background HTML From 064dfb786575cb27e3c63c53f18dcaa8ca7b9128 Mon Sep 17 00:00:00 2001 From: Max Wu Date: Mon, 21 Dec 2020 14:47:13 +0800 Subject: [PATCH 24/35] fix: disable prefer-const lint rule for mermaid block text string Signed-off-by: Max Wu --- public/js/extra.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/js/extra.js b/public/js/extra.js index b36dd931fd..1e672c8129 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -397,10 +397,12 @@ export function finishView (view) { var $value = $(value) const $ele = $(value).closest('pre') + /* eslint-disable prefer-const */ let text = $value.text() window.mermaid.parse(text) $ele.addClass('mermaid') $ele.text(text) + /* eslint-enable prefer-const */ window.mermaid.init(undefined, $ele) } catch (err) { $value.unwrap() From 568355acf51a3677262987f8236979d971239ecd Mon Sep 17 00:00:00 2001 From: Max Wu Date: Mon, 21 Dec 2020 14:56:40 +0800 Subject: [PATCH 25/35] fix: properly validate mermaid syntax and handle parse error Signed-off-by: Max Wu --- public/js/extra.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/public/js/extra.js b/public/js/extra.js index 1e672c8129..b59a84dce1 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -253,7 +253,12 @@ function replaceExtraTags (html) { return html } -if (typeof window.mermaid !== 'undefined' && window.mermaid) window.mermaid.startOnLoad = false +if (typeof window.mermaid !== 'undefined' && window.mermaid) { + window.mermaid.startOnLoad = false + window.mermaid.parseError = function (err, hash) { + console.warn(err) + } +} // dynamic event or object binding here export function finishView (view) { @@ -397,13 +402,14 @@ export function finishView (view) { var $value = $(value) const $ele = $(value).closest('pre') - /* eslint-disable prefer-const */ - let text = $value.text() - window.mermaid.parse(text) - $ele.addClass('mermaid') - $ele.text(text) - /* eslint-enable prefer-const */ - window.mermaid.init(undefined, $ele) + const text = $value.text() + // validate the syntax first + if (window.mermaid.parse(text)) { + $ele.addClass('mermaid') + $ele.text(text) + // render the diagram + window.mermaid.init(undefined, $ele) + } } catch (err) { $value.unwrap() $value.parent().append(`
${escapeHTML(err.str)}
`) From 7a88f9d95ac304c95f12441549425c7b930a4356 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Tue, 22 Dec 2020 16:48:13 +0800 Subject: [PATCH 26/35] Check upload image mime type Signed-off-by: Yukai Huang --- lib/imageRouter/index.js | 14 ++++++++++ package-lock.json | 56 +++++++++++++++++++++++++++++++++++++--- package.json | 2 ++ 3 files changed, 69 insertions(+), 3 deletions(-) diff --git a/lib/imageRouter/index.js b/lib/imageRouter/index.js index 5af005bc15..5a4eb8d816 100644 --- a/lib/imageRouter/index.js +++ b/lib/imageRouter/index.js @@ -4,12 +4,22 @@ const fs = require('fs') const Router = require('express').Router const formidable = require('formidable') +const readChunk = require('read-chunk') +const imageType = require('image-type') + const config = require('../config') const logger = require('../logger') const response = require('../response') const imageRouter = module.exports = Router() +function checkImageValid (filepath) { + const supported = ['png', 'jpg', 'jpeg', 'bmp', 'tif', 'tiff', 'gif'] + const buffer = readChunk.sync(filepath, 0, 12) + const type = imageType(buffer) + return type && supported.some(e => e === type.ext) +} + // upload image imageRouter.post('/uploadimage', function (req, res) { var form = new formidable.IncomingForm() @@ -24,6 +34,10 @@ imageRouter.post('/uploadimage', function (req, res) { logger.info('SERVER received uploadimage: ' + JSON.stringify(files.image)) } + if (!checkImageValid(files.image.path)) { + return response.errorForbidden(req, res) + } + const uploadProvider = require('./' + config.imageUploadType) uploadProvider.uploadImage(files.image.path, function (err, url) { // remove temporary upload file, and ignore any error diff --git a/package-lock.json b/package-lock.json index c9b2e40973..43856670bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5404,7 +5404,7 @@ "integrity": "sha512-+eqpz5j8WONSzxmc4avCN4XX/6q5+J6JfWz2AaluZIOVNgXPxUjXBhKS73+nRhM3nE1pGeRMqkyZevTQWgYTTw==", "dev": true }, - "dictionary-en-gb": { + "dictionary-en-gb": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/dictionary-en-gb/-/dictionary-en-gb-2.2.2.tgz", "integrity": "sha512-36Pz/2BGmJfXtAo5+IGOi+U6gwtxFsFXFJMOX0FC1z2YeLd1IXkxsfAhieC06OrdGie3SqCZmUOYeYgct5Hzzw==", @@ -7149,6 +7149,11 @@ "integrity": "sha512-Wz3c3XQ5xroCxd1G8b7yL0Ehkf0TC9oYC6buPFkNnU9EnaPlifeAFCyCh+iewXTyFRcg0a6j3J7FmJsIhlhBdw==", "dev": true }, + "file-type": { + "version": "10.11.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-10.11.0.tgz", + "integrity": "sha512-uzk64HRpUZyTGZtVuvrjP0FYxzQrBf4rojot6J65YMEbwBLB0CWm0CLojVpwpmFmxcE/lkvYICgfcGozbBq6rw==" + }, "file-uri-to-path": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", @@ -8837,6 +8842,14 @@ "dev": true, "optional": true }, + "image-type": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/image-type/-/image-type-4.1.0.tgz", + "integrity": "sha512-CFJMJ8QK8lJvRlTCEgarL4ro6hfDQKif2HjSvYCdQZESaIPV4v9imrf7BQHK+sQeTeNeMpWciR9hyC/g8ybXEg==", + "requires": { + "file-type": "^10.10.0" + } + }, "import-fresh": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-2.0.0.tgz", @@ -11960,8 +11973,7 @@ "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" }, "p-is-promise": { "version": "2.1.0", @@ -13979,6 +13991,22 @@ "integrity": "sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q==", "dev": true }, + "read-chunk": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/read-chunk/-/read-chunk-3.2.0.tgz", + "integrity": "sha512-CEjy9LCzhmD7nUpJ1oVOE6s/hBkejlcJEgLQHVnQznOSilOPb+kpKktlLfFDK3/WP43+F80xkUTM2VOkYoSYvQ==", + "requires": { + "pify": "^4.0.1", + "with-open-file": "^0.1.6" + }, + "dependencies": { + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + } + } + }, "read-pkg": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", @@ -18046,6 +18074,28 @@ "triple-beam": "^1.2.0" } }, + "with-open-file": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/with-open-file/-/with-open-file-0.1.7.tgz", + "integrity": "sha512-ecJS2/oHtESJ1t3ZfMI3B7KIDKyfN0O16miWxdn30zdh66Yd3LsRFebXZXq6GU4xfxLf6nVxp9kIqElb5fqczA==", + "requires": { + "p-finally": "^1.0.0", + "p-try": "^2.1.0", + "pify": "^4.0.1" + }, + "dependencies": { + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==" + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==" + } + } + }, "wkx": { "version": "0.4.8", "resolved": "https://registry.npmjs.org/wkx/-/wkx-0.4.8.tgz", diff --git a/package.json b/package.json index 74134c1428..22d18181b6 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "helmet": "~3.20.0", "https-proxy-agent": "^3.0.1", "i18n": "~0.8.3", + "image-type": "^4.1.0", "isomorphic-fetch": "~2.2.1", "jsdom-nogyp": "~0.8.3", "lodash": "~4.17.15", @@ -89,6 +90,7 @@ "prom-client": "^12.0.0", "prometheus-api-metrics": "^2.2.5", "randomcolor": "~0.5.4", + "read-chunk": "^3.2.0", "readline-sync": "~1.4.7", "request": "~2.88.0", "scrypt-kdf": "^2.0.1", From 312dffe21d0ecc65fb0a3bb1f8c19b18f9a14246 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Tue, 22 Dec 2020 17:45:53 +0800 Subject: [PATCH 27/35] Bump vega deps Signed-off-by: Yukai Huang --- package-lock.json | 939 +++++++++++++++++++++++++++------------------- package.json | 6 +- 2 files changed, 548 insertions(+), 397 deletions(-) diff --git a/package-lock.json b/package-lock.json index c9b2e40973..ba877be84d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1050,15 +1050,9 @@ } }, "@types/clone": { - "version": "0.1.30", - "resolved": "https://registry.npmjs.org/@types/clone/-/clone-0.1.30.tgz", - "integrity": "sha1-5zZWSMG0ITalnH1QQGN7O1yDthQ=", - "dev": true - }, - "@types/color-name": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", - "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/clone/-/clone-2.1.0.tgz", + "integrity": "sha512-d/aS/lPOnUSruPhgNtT8jW39fHRVTLQy9sodysP1kkG8EdAtdZu1vt8NJaYA8w/6Z9j8izkAsx1A/yJhcYR1CA==", "dev": true }, "@types/connect": { @@ -4881,9 +4875,9 @@ } }, "d3-delaunay": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-5.2.1.tgz", - "integrity": "sha512-ZZdeJl6cKRyqYVFYK+/meXvWIrAvZsZTD7WSxl4OPXCmuXNgDyACAClAJHD63zL25TA+IJGURUNO7rFseNFCYw==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-5.3.0.tgz", + "integrity": "sha512-amALSrOllWVLaHTnDLHwMIiz0d1bBu9gZXd1FiLfXf8sHcX9jrcj81TVZOqD4UX7MgBZZ07c8GxzEgBpJqc74w==", "dev": true, "requires": { "delaunator": "4" @@ -4968,15 +4962,34 @@ } }, "d3-geo-projection": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/d3-geo-projection/-/d3-geo-projection-2.8.1.tgz", - "integrity": "sha512-VObmT3vQQgU7IxkDwyIuOrWK4AS2OHyvucp1vHo98WE7DvAN+VcS3Pf/oKenszPfbMtHusOfQNBLEMyGHguvTg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-geo-projection/-/d3-geo-projection-3.0.0.tgz", + "integrity": "sha512-1JE+filVbkEX2bT25dJdQ05iA4QHvUwev6o0nIQHOSrNlHCAKfVss/U10vEM3pA4j5v7uQoFdQ4KLbx9BlEbWA==", "dev": true, "requires": { "commander": "2", - "d3-array": "1", - "d3-geo": "^1.10.0", + "d3-array": "1 - 2", + "d3-geo": "1.12.0 - 2", "resolve": "^1.1.10" + }, + "dependencies": { + "d3-geo": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-2.0.1.tgz", + "integrity": "sha512-M6yzGbFRfxzNrVhxDJXzJqSLQ90q1cCyb3EWFZ1LF4eWOBYxFypw7I/NFVBNXKNqxv1bqLathhYvdJ6DC+th3A==", + "dev": true, + "requires": { + "d3-array": ">=2.5" + }, + "dependencies": { + "d3-array": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.9.1.tgz", + "integrity": "sha512-Ob7RdOtkqsjx1NWyQHMFLtCSk6/aKTxDdC4ZIolX+O+mDD2RzrsYgAyc0WGAlfYFVELLSilS7w8BtE3PKM8bHg==", + "dev": true + } + } + } } }, "d3-hierarchy": { @@ -5404,7 +5417,7 @@ "integrity": "sha512-+eqpz5j8WONSzxmc4avCN4XX/6q5+J6JfWz2AaluZIOVNgXPxUjXBhKS73+nRhM3nE1pGeRMqkyZevTQWgYTTw==", "dev": true }, - "dictionary-en-gb": { + "dictionary-en-gb": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/dictionary-en-gb/-/dictionary-en-gb-2.2.2.tgz", "integrity": "sha512-36Pz/2BGmJfXtAo5+IGOi+U6gwtxFsFXFJMOX0FC1z2YeLd1IXkxsfAhieC06OrdGie3SqCZmUOYeYgct5Hzzw==", @@ -6071,6 +6084,12 @@ "es6-symbol": "^3.1.1" } }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, "escallmatch": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/escallmatch/-/escallmatch-1.5.0.tgz", @@ -16967,240 +16986,351 @@ } }, "vega": { - "version": "5.9.1", - "resolved": "https://registry.npmjs.org/vega/-/vega-5.9.1.tgz", - "integrity": "sha512-Wd5WAfaXPGuHk5cSFqiFNkkw5DXRSZcl+q4x351VUbmV5/IRipyGZx05EbBP5D9B40Xb/Tt2I+JQBBdxuYYIxQ==", - "dev": true, - "requires": { - "vega-crossfilter": "4.0.1", - "vega-dataflow": "5.5.0", - "vega-encode": "4.5.2", - "vega-event-selector": "2.0.2", - "vega-expression": "2.6.3", - "vega-force": "4.0.3", - "vega-functions": "5.5.1", - "vega-geo": "4.3.0", - "vega-hierarchy": "4.0.3", - "vega-loader": "4.1.3", - "vega-parser": "5.12.0", - "vega-projection": "1.4.0", - "vega-regression": "1.0.4", - "vega-runtime": "5.0.2", - "vega-scale": "6.0.0", - "vega-scenegraph": "4.5.0", - "vega-statistics": "1.7.2", - "vega-time": "1.0.0", - "vega-transforms": "4.6.0", - "vega-typings": "0.12.0", - "vega-util": "1.12.2", - "vega-view": "5.4.0", - "vega-view-transforms": "4.5.0", - "vega-voronoi": "4.1.1", - "vega-wordcloud": "4.0.4" + "version": "5.17.1", + "resolved": "https://registry.npmjs.org/vega/-/vega-5.17.1.tgz", + "integrity": "sha512-ev1S6ohnsyeqps/bUVbhByoAbucap8vXPuiAJcxxft/EpgQGbIX/x42l0ijc3U1QHow2Lr3khtE1RshyU4lW2w==", + "dev": true, + "requires": { + "vega-crossfilter": "~4.0.5", + "vega-dataflow": "~5.7.3", + "vega-encode": "~4.8.3", + "vega-event-selector": "~2.0.6", + "vega-expression": "~3.0.1", + "vega-force": "~4.0.7", + "vega-format": "~1.0.4", + "vega-functions": "~5.8.0", + "vega-geo": "~4.3.8", + "vega-hierarchy": "~4.0.9", + "vega-label": "~1.0.0", + "vega-loader": "~4.4.0", + "vega-parser": "~6.1.0", + "vega-projection": "~1.4.5", + "vega-regression": "~1.0.9", + "vega-runtime": "~6.1.3", + "vega-scale": "~7.1.1", + "vega-scenegraph": "~4.9.2", + "vega-statistics": "~1.7.9", + "vega-time": "~2.0.4", + "vega-transforms": "~4.9.3", + "vega-typings": "~0.19.2", + "vega-util": "~1.16.0", + "vega-view": "~5.9.0", + "vega-view-transforms": "~4.5.8", + "vega-voronoi": "~4.1.5", + "vega-wordcloud": "~4.1.3" } }, "vega-canvas": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/vega-canvas/-/vega-canvas-1.2.1.tgz", - "integrity": "sha512-k/S3EPeJ37D7fYDhv4sEg7fNWVpLheQY7flfLyAmJU7aSwCMgw8cZJi0CKHchJeculssfH+41NCqvRB1QtaJnw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/vega-canvas/-/vega-canvas-1.2.6.tgz", + "integrity": "sha512-rgeYUpslYn/amIfnuv3Sw6n4BGns94OjjZNtUc9IDji6b+K8LGS/kW+Lvay8JX/oFqtulBp8RLcHN6QjqPLA9Q==", "dev": true }, "vega-crossfilter": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/vega-crossfilter/-/vega-crossfilter-4.0.1.tgz", - "integrity": "sha512-wLNS4JzKaOLj8EAzI/v8XBJjUWMRWYSu6EeQF4o9Opq/78u87Ol9Lc5I27UHsww5dNNH/tHubAV4QPIXnGOp5Q==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/vega-crossfilter/-/vega-crossfilter-4.0.5.tgz", + "integrity": "sha512-yF+iyGP+ZxU7Tcj5yBsMfoUHTCebTALTXIkBNA99RKdaIHp1E690UaGVLZe6xde2n5WaYpho6I/I6wdAW3NXcg==", "dev": true, "requires": { - "d3-array": "^2.0.3", - "vega-dataflow": "^5.1.0", - "vega-util": "^1.8.0" + "d3-array": "^2.7.1", + "vega-dataflow": "^5.7.3", + "vega-util": "^1.15.2" }, "dependencies": { "d3-array": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.4.0.tgz", - "integrity": "sha512-KQ41bAF2BMakf/HdKT865ALd4cgND6VcIztVQZUTt0+BH3RWy6ZYnHghVXf6NFjt2ritLr8H1T8LreAAlfiNcw==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.9.1.tgz", + "integrity": "sha512-Ob7RdOtkqsjx1NWyQHMFLtCSk6/aKTxDdC4ZIolX+O+mDD2RzrsYgAyc0WGAlfYFVELLSilS7w8BtE3PKM8bHg==", "dev": true } } }, "vega-dataflow": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/vega-dataflow/-/vega-dataflow-5.5.0.tgz", - "integrity": "sha512-9eRe2qLpwvEegBoSaH3vdziSLMZSszY02wxVmvcFzHe57Rf/eYEr0YRuW4qc+gMmwURPYu9wtmeUTiK4XhDKXw==", + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/vega-dataflow/-/vega-dataflow-5.7.3.tgz", + "integrity": "sha512-2ipzKgQUmbSXcQBH+9XF0BYbXyZrHvjlbJ8ifyRWYQk78w8kMvE6wy/rcdXYK6iVZ6aAbEDDT7jTI+rFt3tGLA==", "dev": true, "requires": { - "vega-loader": "^4.0.0", - "vega-util": "^1.11.0" + "vega-format": "^1.0.4", + "vega-loader": "^4.3.2", + "vega-util": "^1.15.2" } }, "vega-embed": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/vega-embed/-/vega-embed-6.2.2.tgz", - "integrity": "sha512-u9CX9jpIbu2DY2lqs0J7CLA7+VXNlR+qkzxOwaVKfS0ivB54dxQXKvE59VHV02Nwb5XhaDGTEMN0FRCAvgkdLQ==", + "version": "6.14.2", + "resolved": "https://registry.npmjs.org/vega-embed/-/vega-embed-6.14.2.tgz", + "integrity": "sha512-cZsI0+eSB1BubRFkpeZs9mdWQGfO0T7i78dffGULg+1+Up+74aB/cg7refC+KsnEEGOeOtP9RWz9Ttkabs2oYA==", "dev": true, "requires": { "fast-json-patch": "^3.0.0-1", "json-stringify-pretty-compact": "^2.0.0", - "semver": "^6.3.0", - "vega-schema-url-parser": "^1.1.0", - "vega-themes": "^2.6.0", - "vega-tooltip": "^0.20.0" + "semver": "^7.3.4", + "vega-schema-url-parser": "^2.1.0", + "vega-themes": "^2.9.1", + "vega-tooltip": "^0.24.2" }, "dependencies": { + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true } } }, "vega-encode": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/vega-encode/-/vega-encode-4.5.2.tgz", - "integrity": "sha512-iL1njX++VE0SAMJuDqc0k9kmsU8AeyRRHv15MXh2+PXe2JmyiSWn6HcF3RzFUy5xmKlZOU5BiL8KrTgTrxh+WA==", + "version": "4.8.3", + "resolved": "https://registry.npmjs.org/vega-encode/-/vega-encode-4.8.3.tgz", + "integrity": "sha512-JoRYtaV2Hs8spWLzTu/IjR7J9jqRmuIOEicAaWj6T9NSZrNWQzu2zF3IVsX85WnrIDIRUDaehXaFZvy9uv9RQg==", "dev": true, "requires": { - "d3-array": "^2.4.0", - "d3-format": "^1.4.2", - "d3-interpolate": "^1.4.0", - "vega-dataflow": "^5.5.0", - "vega-scale": "^6.0.0", - "vega-time": "^1.0.0", - "vega-util": "^1.12.2" + "d3-array": "^2.7.1", + "d3-interpolate": "^2.0.1", + "vega-dataflow": "^5.7.3", + "vega-scale": "^7.0.3", + "vega-util": "^1.15.2" }, "dependencies": { "d3-array": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.4.0.tgz", - "integrity": "sha512-KQ41bAF2BMakf/HdKT865ALd4cgND6VcIztVQZUTt0+BH3RWy6ZYnHghVXf6NFjt2ritLr8H1T8LreAAlfiNcw==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.9.1.tgz", + "integrity": "sha512-Ob7RdOtkqsjx1NWyQHMFLtCSk6/aKTxDdC4ZIolX+O+mDD2RzrsYgAyc0WGAlfYFVELLSilS7w8BtE3PKM8bHg==", "dev": true + }, + "d3-interpolate": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-2.0.1.tgz", + "integrity": "sha512-c5UhwwTs/yybcmTpAVqwSFl6vrQ8JZJoT5F7xNFK9pymv5C0Ymcc9/LIJHtYIggg/yS9YHw8i8O8tgb9pupjeQ==", + "dev": true, + "requires": { + "d3-color": "1 - 2" + } } } }, "vega-event-selector": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/vega-event-selector/-/vega-event-selector-2.0.2.tgz", - "integrity": "sha512-Uv72vBfM0lrlI2belKHFMZuVnW2uJl2ShqWPwGSXPVe6p+PzgqoPJYC8A/i5N8B54UA4UMDzlbBeo3x7q2W9Yg==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/vega-event-selector/-/vega-event-selector-2.0.6.tgz", + "integrity": "sha512-UwCu50Sqd8kNZ1X/XgiAY+QAyQUmGFAwyDu7y0T5fs6/TPQnDo/Bo346NgSgINBEhEKOAMY1Nd/rPOk4UEm/ew==", "dev": true }, "vega-expression": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/vega-expression/-/vega-expression-2.6.3.tgz", - "integrity": "sha512-sME1+45BToTGsftb1Q6Ubs2iRYEoXkD2NRGnJuKS9YJ2ITzZwPHF/jy2kHW3iLpuNjj54meaO7HMQ/hUKrciUw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/vega-expression/-/vega-expression-3.0.1.tgz", + "integrity": "sha512-+UwOFEkBnAWo8Zud6i8O4Pd2W6QqmPUOaAhjNtj0OxRL+d+Duoy7M4edUDZ+YuoUcMnjjBFfDQu7oRAA1fIMEQ==", "dev": true, "requires": { - "vega-util": "^1.11.0" + "vega-util": "^1.15.2" } }, "vega-force": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/vega-force/-/vega-force-4.0.3.tgz", - "integrity": "sha512-4stItN4jD9H1CENaCz4jXRNS1Bi9cozMOUjX2824FeJENi2RZSiAZAaGbscgerZQ/jbNcOHD8PHpC2pWldEvGA==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/vega-force/-/vega-force-4.0.7.tgz", + "integrity": "sha512-pyLKdwXSZ9C1dVIqdJOobvBY29rLvZjvRRTla9BU/nMwAiAGlGi6WKUFdRGdneyGe3zo2nSZDTZlZM/Z5VaQNA==", "dev": true, "requires": { - "d3-force": "^2.0.1", - "vega-dataflow": "^5.4.0", - "vega-util": "^1.11.0" + "d3-force": "^2.1.1", + "vega-dataflow": "^5.7.3", + "vega-util": "^1.15.2" }, "dependencies": { "d3-force": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-2.0.1.tgz", - "integrity": "sha512-zh73/N6+MElRojiUG7vmn+3vltaKon7iD5vB/7r9nUaBeftXMzRo5IWEG63DLBCto4/8vr9i3m9lwr1OTJNiCg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-2.1.1.tgz", + "integrity": "sha512-nAuHEzBqMvpFVMf9OX75d00OxvOXdxY+xECIXjW6Gv8BRrXu6gAWbv/9XKrvfJ5i5DCokDW7RYE50LRoK092ew==", "dev": true, "requires": { - "d3-dispatch": "1", - "d3-quadtree": "1", - "d3-timer": "1" + "d3-dispatch": "1 - 2", + "d3-quadtree": "1 - 2", + "d3-timer": "1 - 2" } } } }, - "vega-functions": { - "version": "5.5.1", - "resolved": "https://registry.npmjs.org/vega-functions/-/vega-functions-5.5.1.tgz", - "integrity": "sha512-VTfEwf/ChSOGc4d4yUIgu2XoScky6NH06WN4vwVGY5PREhsyVPsQ+p2zqgD/N/a00EyWPHeOSHEhsPU28oIMtQ==", + "vega-format": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/vega-format/-/vega-format-1.0.4.tgz", + "integrity": "sha512-oTAeub3KWm6nKhXoYCx1q9G3K43R6/pDMXvqDlTSUtjoY7b/Gixm8iLcir5S9bPjvH40n4AcbZsPmNfL/Up77A==", "dev": true, "requires": { - "d3-array": "^2.4.0", - "d3-color": "^1.4.0", - "d3-format": "^1.4.2", - "d3-geo": "^1.11.9", - "d3-time-format": "^2.2.2", - "vega-dataflow": "^5.5.0", - "vega-expression": "^2.6.3", - "vega-scale": "^6.0.0", - "vega-scenegraph": "^4.5.0", - "vega-selections": "^5.1.0", - "vega-statistics": "^1.7.1", - "vega-time": "^1.0.0", - "vega-util": "^1.12.1" + "d3-array": "^2.7.1", + "d3-format": "^2.0.0", + "d3-time-format": "^3.0.0", + "vega-time": "^2.0.3", + "vega-util": "^1.15.2" }, "dependencies": { "d3-array": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.4.0.tgz", - "integrity": "sha512-KQ41bAF2BMakf/HdKT865ALd4cgND6VcIztVQZUTt0+BH3RWy6ZYnHghVXf6NFjt2ritLr8H1T8LreAAlfiNcw==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.9.1.tgz", + "integrity": "sha512-Ob7RdOtkqsjx1NWyQHMFLtCSk6/aKTxDdC4ZIolX+O+mDD2RzrsYgAyc0WGAlfYFVELLSilS7w8BtE3PKM8bHg==", + "dev": true + }, + "d3-format": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-2.0.0.tgz", + "integrity": "sha512-Ab3S6XuE/Q+flY96HXT0jOXcM4EAClYFnRGY5zsjRGNy6qCYrQsMffs7cV5Q9xejb35zxW5hf/guKw34kvIKsA==", "dev": true + }, + "d3-time-format": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-3.0.0.tgz", + "integrity": "sha512-UXJh6EKsHBTjopVqZBhFysQcoXSv/5yLONZvkQ5Kk3qbwiUYkdX17Xa1PT6U1ZWXGGfB1ey5L8dKMlFq2DO0Ag==", + "dev": true, + "requires": { + "d3-time": "1 - 2" + } + } + } + }, + "vega-functions": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/vega-functions/-/vega-functions-5.8.0.tgz", + "integrity": "sha512-xaUqWZHEX+EuJuKfN0Biux3rrCHDEHmMbW7LHYyyEqguR0i6+zhtOSUEWmYqDfzB/+BlIwCk5Vif6q6/mzJxbQ==", + "dev": true, + "requires": { + "d3-array": "^2.7.1", + "d3-color": "^2.0.0", + "d3-geo": "^2.0.1", + "vega-dataflow": "^5.7.3", + "vega-expression": "^3.0.0", + "vega-scale": "^7.1.1", + "vega-scenegraph": "^4.9.2", + "vega-selections": "^5.1.4", + "vega-statistics": "^1.7.9", + "vega-time": "^2.0.4", + "vega-util": "^1.15.2" + }, + "dependencies": { + "d3-array": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.9.1.tgz", + "integrity": "sha512-Ob7RdOtkqsjx1NWyQHMFLtCSk6/aKTxDdC4ZIolX+O+mDD2RzrsYgAyc0WGAlfYFVELLSilS7w8BtE3PKM8bHg==", + "dev": true + }, + "d3-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-2.0.0.tgz", + "integrity": "sha512-SPXi0TSKPD4g9tw0NMZFnR95XVgUZiBH+uUTqQuDu1OsE2zomHU7ho0FISciaPvosimixwHFl3WHLGabv6dDgQ==", + "dev": true + }, + "d3-geo": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-2.0.1.tgz", + "integrity": "sha512-M6yzGbFRfxzNrVhxDJXzJqSLQ90q1cCyb3EWFZ1LF4eWOBYxFypw7I/NFVBNXKNqxv1bqLathhYvdJ6DC+th3A==", + "dev": true, + "requires": { + "d3-array": ">=2.5" + } } } }, "vega-geo": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/vega-geo/-/vega-geo-4.3.0.tgz", - "integrity": "sha512-Rcz4z+TR4qy727pjBWSsbMAn8eM9bDZ5MXKqo5AWuFkoj/8ngv13vafHd1tvEMTA8L5BjAW3/eTqN4tyx9KSQg==", - "dev": true, - "requires": { - "d3-array": "^2.4.0", - "d3-color": "^1.4.0", - "d3-geo": "^1.11.9", - "vega-canvas": "^1.2.1", - "vega-dataflow": "^5.1.1", - "vega-projection": "^1.4.0", - "vega-statistics": "^1.7.1", - "vega-util": "^1.12.1" + "version": "4.3.8", + "resolved": "https://registry.npmjs.org/vega-geo/-/vega-geo-4.3.8.tgz", + "integrity": "sha512-fsGxV96Q/QRgPqOPtMBZdI+DneIiROKTG3YDZvGn0EdV16OG5LzFhbNgLT5GPzI+kTwgLpAsucBHklexlB4kfg==", + "dev": true, + "requires": { + "d3-array": "^2.7.1", + "d3-color": "^2.0.0", + "d3-geo": "^2.0.1", + "vega-canvas": "^1.2.5", + "vega-dataflow": "^5.7.3", + "vega-projection": "^1.4.5", + "vega-statistics": "^1.7.9", + "vega-util": "^1.15.2" }, "dependencies": { "d3-array": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.4.0.tgz", - "integrity": "sha512-KQ41bAF2BMakf/HdKT865ALd4cgND6VcIztVQZUTt0+BH3RWy6ZYnHghVXf6NFjt2ritLr8H1T8LreAAlfiNcw==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.9.1.tgz", + "integrity": "sha512-Ob7RdOtkqsjx1NWyQHMFLtCSk6/aKTxDdC4ZIolX+O+mDD2RzrsYgAyc0WGAlfYFVELLSilS7w8BtE3PKM8bHg==", + "dev": true + }, + "d3-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-2.0.0.tgz", + "integrity": "sha512-SPXi0TSKPD4g9tw0NMZFnR95XVgUZiBH+uUTqQuDu1OsE2zomHU7ho0FISciaPvosimixwHFl3WHLGabv6dDgQ==", "dev": true + }, + "d3-geo": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-2.0.1.tgz", + "integrity": "sha512-M6yzGbFRfxzNrVhxDJXzJqSLQ90q1cCyb3EWFZ1LF4eWOBYxFypw7I/NFVBNXKNqxv1bqLathhYvdJ6DC+th3A==", + "dev": true, + "requires": { + "d3-array": ">=2.5" + } } } }, "vega-hierarchy": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/vega-hierarchy/-/vega-hierarchy-4.0.3.tgz", - "integrity": "sha512-9wNe+KyKqZW1S4++jCC38HuAhZbqNhfY7gOvwiMLjsp65tMtRETrtvYfHkULClm3UokUIX54etAXREAGW7znbw==", + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/vega-hierarchy/-/vega-hierarchy-4.0.9.tgz", + "integrity": "sha512-4XaWK6V38/QOZ+vllKKTafiwL25m8Kd+ebHmDV+Q236ONHmqc/gv82wwn9nBeXPEfPv4FyJw2SRoqa2Jol6fug==", + "dev": true, + "requires": { + "d3-hierarchy": "^2.0.0", + "vega-dataflow": "^5.7.3", + "vega-util": "^1.15.2" + }, + "dependencies": { + "d3-hierarchy": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-2.0.0.tgz", + "integrity": "sha512-SwIdqM3HxQX2214EG9GTjgmCc/mbSx4mQBn+DuEETubhOw6/U3fmnji4uCVrmzOydMHSO1nZle5gh6HB/wdOzw==", + "dev": true + } + } + }, + "vega-label": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/vega-label/-/vega-label-1.0.0.tgz", + "integrity": "sha512-hCdm2pcHgkKgxnzW9GvX5JmYNiUMlOXOibtMmBzvFBQHX3NiV9giQ5nsPiQiFbV08VxEPtM+VYXr2HyrIcq5zQ==", "dev": true, "requires": { - "d3-hierarchy": "^1.1.8", - "vega-dataflow": "^5.4.0", - "vega-util": "^1.11.0" + "vega-canvas": "^1.2.5", + "vega-dataflow": "^5.7.3", + "vega-scenegraph": "^4.9.2", + "vega-util": "^1.15.2" } }, "vega-lite": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/vega-lite/-/vega-lite-4.4.0.tgz", - "integrity": "sha512-Np48CMrCJRDkYQOYdcQ1s6Fuwc4/m/mj3JgVve73J7AvX5nxDsliTk9z/A4krSyTh1O4sHgOhW/N/BtIz5DpIg==", + "version": "4.17.0", + "resolved": "https://registry.npmjs.org/vega-lite/-/vega-lite-4.17.0.tgz", + "integrity": "sha512-MO2XsaVZqx6iWWmVA5vwYFamvhRUsKfVp7n0pNlkZ2/21cuxelSl92EePZ2YGmzL6z4/3K7r/45zaG8p+qNHeg==", "dev": true, "requires": { - "@types/clone": "~0.1.30", + "@types/clone": "~2.1.0", "@types/fast-json-stable-stringify": "^2.0.0", "array-flat-polyfill": "^1.0.1", "clone": "~2.1.2", - "fast-deep-equal": "~3.1.1", + "fast-deep-equal": "~3.1.3", "fast-json-stable-stringify": "~2.1.0", "json-stringify-pretty-compact": "~2.0.0", - "tslib": "~1.10.0", - "vega-event-selector": "~2.0.2", - "vega-expression": "~2.6.3", - "vega-scale": "^6.0.0", - "vega-util": "~1.12.2", - "yargs": "~15.1.0" + "tslib": "~2.0.3", + "vega-event-selector": "~2.0.6", + "vega-expression": "~3.0.0", + "vega-util": "~1.16.0", + "yargs": "~16.0.3" }, "dependencies": { "ansi-regex": { @@ -17210,24 +17340,23 @@ "dev": true }, "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { - "@types/color-name": "^1.1.1", "color-convert": "^2.0.1" } }, "cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, "requires": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" + "wrap-ansi": "^7.0.0" } }, "color-convert": { @@ -17252,21 +17381,11 @@ "dev": true }, "fast-deep-equal": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", - "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "requires": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - } - }, "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -17279,45 +17398,6 @@ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "requires": { - "p-locate": "^4.1.0" - } - }, - "p-limit": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz", - "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==", - "dev": true, - "requires": { - "p-try": "^2.0.0" - } - }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "requires": { - "p-limit": "^2.2.0" - } - }, - "p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, "string-width": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz", @@ -17338,10 +17418,16 @@ "ansi-regex": "^5.0.0" } }, + "tslib": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.3.tgz", + "integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ==", + "dev": true + }, "wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, "requires": { "ansi-styles": "^4.0.0", @@ -17349,318 +17435,383 @@ "strip-ansi": "^6.0.0" } }, + "y18n": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", + "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", + "dev": true + }, "yargs": { - "version": "15.1.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.1.0.tgz", - "integrity": "sha512-T39FNN1b6hCW4SOIk1XyTOWxtXdcen0t+XYrysQmChzSipvhBO8Bj0nK1ozAasdk24dNWuMZvr4k24nz+8HHLg==", + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.0.3.tgz", + "integrity": "sha512-6+nLw8xa9uK1BOEOykaiYAJVh6/CjxWXK/q9b5FpRgNslt8s22F2xMBqVIKgCRjNgGvGPBy8Vog7WN7yh4amtA==", "dev": true, "requires": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", + "cliui": "^7.0.0", + "escalade": "^3.0.2", + "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^16.1.0" + "y18n": "^5.0.1", + "yargs-parser": "^20.0.0" } }, "yargs-parser": { - "version": "16.1.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-16.1.0.tgz", - "integrity": "sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true } } }, "vega-loader": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/vega-loader/-/vega-loader-4.1.3.tgz", - "integrity": "sha512-50aetjuct4WqU7LctwnZqF/NCyya9aZ1HDQZ9unFi++62vOQgRfbXLNL/dZavqwnWX3S9i0ltCznLyFMG4ck8g==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/vega-loader/-/vega-loader-4.4.0.tgz", + "integrity": "sha512-e5enQECdau7rJob0NFB5pGumh3RaaSWWm90+boxMy3ay2b4Ki/3XIvo+C4F1Lx04qSxvQF7tO2LJcklRm6nqRA==", "dev": true, "requires": { - "d3-dsv": "^1.1.1", - "d3-time-format": "^2.2.1", - "node-fetch": "^2.6.0", - "topojson-client": "^3.0.1", - "vega-util": "^1.11.0" + "d3-dsv": "^2.0.0", + "node-fetch": "^2.6.1", + "topojson-client": "^3.1.0", + "vega-format": "^1.0.4", + "vega-util": "^1.16.0" }, "dependencies": { + "d3-dsv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-2.0.0.tgz", + "integrity": "sha512-E+Pn8UJYx9mViuIUkoc93gJGGYut6mSDKy2+XaPwccwkRGlR+LO97L2VCCRjQivTwLHkSnAJG7yo00BWY6QM+w==", + "dev": true, + "requires": { + "commander": "2", + "iconv-lite": "0.4", + "rw": "1" + } + }, "node-fetch": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", - "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", "dev": true } } }, "vega-parser": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/vega-parser/-/vega-parser-5.12.0.tgz", - "integrity": "sha512-sIQcWp7aqafpfELEJr+gQDsz7TlLYaHkowKhp3O/pcOdIuvqeI3IYpP2+oNpXVGi8ikcq8cJLcCUMi9oP2Xtrw==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/vega-parser/-/vega-parser-6.1.0.tgz", + "integrity": "sha512-u14bHXV8vtcuMIJkMNoDAJ4Xu3lwKIkep+YEkPumWvlwl3fClWy26EAcwTneeM3rXu2F6ZJI6W3ddu/If8u13w==", "dev": true, "requires": { - "vega-dataflow": "^5.5.0", - "vega-event-selector": "^2.0.2", - "vega-expression": "^2.6.3", - "vega-functions": "^5.5.0", - "vega-scale": "^6.0.0", - "vega-util": "^1.12.1" + "vega-dataflow": "^5.7.3", + "vega-event-selector": "^2.0.6", + "vega-functions": "^5.8.0", + "vega-scale": "^7.1.1", + "vega-util": "^1.15.2" } }, "vega-projection": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/vega-projection/-/vega-projection-1.4.0.tgz", - "integrity": "sha512-Prb/E41PqZT5b+46rHv6BZLDsXMe+NFClHxJ9NbwW7mntz8aMGAHiYolVa/M2KuTLbsXVgDAPxk/aA9tbQ0SSg==", + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/vega-projection/-/vega-projection-1.4.5.tgz", + "integrity": "sha512-85kWcPv0zrrNfxescqHtSYpRknilrS0K3CVRZc7IYQxnLtL1oma9WEbrSr1LCmDoCP5hl2Z1kKbomPXkrQX5Ag==", "dev": true, "requires": { - "d3-geo": "^1.11.9", - "d3-geo-projection": "^2.7.1" + "d3-geo": "^2.0.1", + "d3-geo-projection": "^3.0.0" + }, + "dependencies": { + "d3-array": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.9.1.tgz", + "integrity": "sha512-Ob7RdOtkqsjx1NWyQHMFLtCSk6/aKTxDdC4ZIolX+O+mDD2RzrsYgAyc0WGAlfYFVELLSilS7w8BtE3PKM8bHg==", + "dev": true + }, + "d3-geo": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-2.0.1.tgz", + "integrity": "sha512-M6yzGbFRfxzNrVhxDJXzJqSLQ90q1cCyb3EWFZ1LF4eWOBYxFypw7I/NFVBNXKNqxv1bqLathhYvdJ6DC+th3A==", + "dev": true, + "requires": { + "d3-array": ">=2.5" + } + } } }, "vega-regression": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/vega-regression/-/vega-regression-1.0.4.tgz", - "integrity": "sha512-fHWJ0t1VEZOzpfBrI66Wo6RxMnqvJXYnXcIUZlOrZ9RLLbb1I6cdEASZp0cQ8M2oYAqu0YVgC0UEjnLs9mJaxQ==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/vega-regression/-/vega-regression-1.0.9.tgz", + "integrity": "sha512-KSr3QbCF0vJEAWFVY2MA9X786oiJncTTr3gqRMPoaLr/Yo3f7OPKXRoUcw36RiWa0WCOEMgTYtM28iK6ZuSgaA==", "dev": true, "requires": { - "d3-array": "^2.4.0", - "vega-dataflow": "^5.4.1", - "vega-statistics": "^1.7.2", - "vega-util": "^1.12.2" + "d3-array": "^2.7.1", + "vega-dataflow": "^5.7.3", + "vega-statistics": "^1.7.9", + "vega-util": "^1.15.2" }, "dependencies": { "d3-array": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.4.0.tgz", - "integrity": "sha512-KQ41bAF2BMakf/HdKT865ALd4cgND6VcIztVQZUTt0+BH3RWy6ZYnHghVXf6NFjt2ritLr8H1T8LreAAlfiNcw==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.9.1.tgz", + "integrity": "sha512-Ob7RdOtkqsjx1NWyQHMFLtCSk6/aKTxDdC4ZIolX+O+mDD2RzrsYgAyc0WGAlfYFVELLSilS7w8BtE3PKM8bHg==", "dev": true } } }, "vega-runtime": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/vega-runtime/-/vega-runtime-5.0.2.tgz", - "integrity": "sha512-Cuv+RY6kprH+vtNERg6xP4dgcdYGD2ZnxPxJNEtGi7dmtQQTBa1s7jQ0VDXTolsO6lKJ3B7np2GzKJYwevgj1A==", + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/vega-runtime/-/vega-runtime-6.1.3.tgz", + "integrity": "sha512-gE+sO2IfxMUpV0RkFeQVnHdmPy3K7LjHakISZgUGsDI/ZFs9y+HhBf8KTGSL5pcZPtQsZh3GBQ0UonqL1mp9PA==", "dev": true, "requires": { - "vega-dataflow": "^5.1.1", - "vega-util": "^1.11.0" + "vega-dataflow": "^5.7.3", + "vega-util": "^1.15.2" } }, "vega-scale": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/vega-scale/-/vega-scale-6.0.0.tgz", - "integrity": "sha512-uNJ5LC+s+XLxdO2iXC36/TLen3mMNv0wzhMZMNXa8h+Ih10geJ57sHbYYA8Z8403JC9AYTaWUe7m0H9CHgV9NA==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/vega-scale/-/vega-scale-7.1.1.tgz", + "integrity": "sha512-yE0to0prA9E5PBJ/XP77TO0BMkzyUVyt7TH5PAwj+CZT7PMsMO6ozihelRhoIiVcP0Ae/ByCEQBUQkzN5zJ0ZA==", "dev": true, "requires": { - "d3-array": "^2.4.0", - "d3-interpolate": "^1.4.0", - "d3-scale": "^3.2.1", - "vega-util": "^1.12.1" + "d3-array": "^2.7.1", + "d3-interpolate": "^2.0.1", + "d3-scale": "^3.2.2", + "vega-time": "^2.0.4", + "vega-util": "^1.15.2" }, "dependencies": { "d3-array": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.4.0.tgz", - "integrity": "sha512-KQ41bAF2BMakf/HdKT865ALd4cgND6VcIztVQZUTt0+BH3RWy6ZYnHghVXf6NFjt2ritLr8H1T8LreAAlfiNcw==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.9.1.tgz", + "integrity": "sha512-Ob7RdOtkqsjx1NWyQHMFLtCSk6/aKTxDdC4ZIolX+O+mDD2RzrsYgAyc0WGAlfYFVELLSilS7w8BtE3PKM8bHg==", "dev": true }, + "d3-interpolate": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-2.0.1.tgz", + "integrity": "sha512-c5UhwwTs/yybcmTpAVqwSFl6vrQ8JZJoT5F7xNFK9pymv5C0Ymcc9/LIJHtYIggg/yS9YHw8i8O8tgb9pupjeQ==", + "dev": true, + "requires": { + "d3-color": "1 - 2" + } + }, "d3-scale": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-3.2.1.tgz", - "integrity": "sha512-huz5byJO/6MPpz6Q8d4lg7GgSpTjIZW/l+1MQkzKfu2u8P6hjaXaStOpmyrD6ymKoW87d2QVFCKvSjLwjzx/rA==", + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-3.2.3.tgz", + "integrity": "sha512-8E37oWEmEzj57bHcnjPVOBS3n4jqakOeuv1EDdQSiSrYnMCBdMd3nc4HtKk7uia8DUHcY/CGuJ42xxgtEYrX0g==", "dev": true, "requires": { - "d3-array": "1.2.0 - 2", - "d3-format": "1", - "d3-interpolate": "^1.2.0", - "d3-time": "1", - "d3-time-format": "2" + "d3-array": "^2.3.0", + "d3-format": "1 - 2", + "d3-interpolate": "1.2.0 - 2", + "d3-time": "1 - 2", + "d3-time-format": "2 - 3" } } } }, "vega-scenegraph": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/vega-scenegraph/-/vega-scenegraph-4.5.0.tgz", - "integrity": "sha512-nO1bTFwhLdkOPzJ++f8dmlMX6OLZya9c94/HZNwFRfGNfri1vXyCIudFwCJD9/h0dJ0kSWfG8ybH9wDQMcZZDw==", + "version": "4.9.2", + "resolved": "https://registry.npmjs.org/vega-scenegraph/-/vega-scenegraph-4.9.2.tgz", + "integrity": "sha512-epm1CxcB8AucXQlSDeFnmzy0FCj+HV2k9R6ch2lfLRln5lPLEfgJWgFcFhVf5jyheY0FSeHH52Q5zQn1vYI1Ow==", "dev": true, "requires": { - "d3-path": "^1.0.9", - "d3-shape": "^1.3.7", - "vega-canvas": "^1.2.1", - "vega-loader": "^4.1.3", - "vega-util": "^1.12.1" + "d3-path": "^2.0.0", + "d3-shape": "^2.0.0", + "vega-canvas": "^1.2.5", + "vega-loader": "^4.3.3", + "vega-scale": "^7.1.1", + "vega-util": "^1.15.2" + }, + "dependencies": { + "d3-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-2.0.0.tgz", + "integrity": "sha512-ZwZQxKhBnv9yHaiWd6ZU4x5BtCQ7pXszEV9CU6kRgwIQVQGLMv1oiL4M+MK/n79sYzsj+gcgpPQSctJUsLN7fA==", + "dev": true + }, + "d3-shape": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-2.0.0.tgz", + "integrity": "sha512-djpGlA779ua+rImicYyyjnOjeubyhql1Jyn1HK0bTyawuH76UQRWXd+pftr67H6Fa8hSwetkgb/0id3agKWykw==", + "dev": true, + "requires": { + "d3-path": "1 - 2" + } + } } }, "vega-schema-url-parser": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/vega-schema-url-parser/-/vega-schema-url-parser-1.1.0.tgz", - "integrity": "sha512-Tc85J2ofMZZOsxiqDM9sbvfsa+Vdo3GwNLjEEsPOsCDeYqsUHKAlc1IpbbhPLZ6jusyM9Lk0e1izF64GGklFDg==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/vega-schema-url-parser/-/vega-schema-url-parser-2.1.0.tgz", + "integrity": "sha512-JHT1PfOyVzOohj89uNunLPirs05Nf59isPT5gnwIkJph96rRgTIBJE7l7yLqndd7fLjr3P8JXHGAryRp74sCaQ==", "dev": true }, "vega-selections": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/vega-selections/-/vega-selections-5.1.0.tgz", - "integrity": "sha512-Gm+16RaCMkWbimqKh9kuIGMK91vutJsTbIDKBXxmq0c3pTvf+Djy6KfBoFsipEJ9wkwhXHSqpLqS1tExV93E9g==", + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/vega-selections/-/vega-selections-5.1.4.tgz", + "integrity": "sha512-L7CHwcIjVf90GoW2tS2x5O496O5Joaerp5A1KM6VJ1uo4z6KfqxY6M/328a/uaAs0LC5qbQgXT3htFbtUrPW/A==", "dev": true, "requires": { - "vega-expression": "^2.6.1", - "vega-util": "^1.11.0" + "vega-expression": "^3.0.0", + "vega-util": "^1.15.2" } }, "vega-statistics": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/vega-statistics/-/vega-statistics-1.7.2.tgz", - "integrity": "sha512-G6rvZ50MqnmiN1fGqDnFoCLWFwBCYt3nCucXu3zWov7A1/lsatvbDKYeSlVlnvT9OHtv4L+3pRpepFh5IhXKFg==", + "version": "1.7.9", + "resolved": "https://registry.npmjs.org/vega-statistics/-/vega-statistics-1.7.9.tgz", + "integrity": "sha512-T0sd2Z08k/mHxr1Vb4ajLWytPluLFYnsYqyk4SIS5czzUs4errpP2gUu63QJ0B7CKNu33vnS9WdOMOo/Eprr/Q==", "dev": true, "requires": { - "d3-array": "^2.4.0" + "d3-array": "^2.7.1" }, "dependencies": { "d3-array": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.4.0.tgz", - "integrity": "sha512-KQ41bAF2BMakf/HdKT865ALd4cgND6VcIztVQZUTt0+BH3RWy6ZYnHghVXf6NFjt2ritLr8H1T8LreAAlfiNcw==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.9.1.tgz", + "integrity": "sha512-Ob7RdOtkqsjx1NWyQHMFLtCSk6/aKTxDdC4ZIolX+O+mDD2RzrsYgAyc0WGAlfYFVELLSilS7w8BtE3PKM8bHg==", "dev": true } } }, "vega-themes": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/vega-themes/-/vega-themes-2.7.1.tgz", - "integrity": "sha512-EHCmMpHfEdLMxIH6JYE2+i6Ni8s0pDpaPr6YMDd0Oj7bRL5Z40KRNlHZikiCSdv45y1d6iCggjdGjazPX0RHJQ==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/vega-themes/-/vega-themes-2.9.1.tgz", + "integrity": "sha512-N6GU8u1EpfqxswXpBKLYouD3gYGfvrKWTC07JSrnlvGUzKzXMPDm4fN8FP8+cBpTwBL6JDZBd86A1Haea/nTfQ==", "dev": true }, "vega-time": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/vega-time/-/vega-time-1.0.0.tgz", - "integrity": "sha512-r0yOFr/VklJwD3ew1+fEcB7E0LBCLChYlwh0KoO6cTIWMdlC4KhIIUN3/FuBfUZ4qx4V/xp71xH2YYYZTH6izg==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/vega-time/-/vega-time-2.0.4.tgz", + "integrity": "sha512-U314UDR9+ZlWrD3KBaeH+j/c2WSMdvcZq5yJfFT0yTg1jsBKAQBYFGvl+orackD8Zx3FveHOxx3XAObaQeDX+Q==", "dev": true, "requires": { - "d3-array": "^2.3.3", - "d3-time": "^1.1.0", - "d3-time-format": "^2.2.1", - "vega-util": "^1.12.0" + "d3-array": "^2.7.1", + "d3-time": "^2.0.0", + "vega-util": "^1.15.2" }, "dependencies": { "d3-array": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.4.0.tgz", - "integrity": "sha512-KQ41bAF2BMakf/HdKT865ALd4cgND6VcIztVQZUTt0+BH3RWy6ZYnHghVXf6NFjt2ritLr8H1T8LreAAlfiNcw==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.9.1.tgz", + "integrity": "sha512-Ob7RdOtkqsjx1NWyQHMFLtCSk6/aKTxDdC4ZIolX+O+mDD2RzrsYgAyc0WGAlfYFVELLSilS7w8BtE3PKM8bHg==", + "dev": true + }, + "d3-time": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-2.0.0.tgz", + "integrity": "sha512-2mvhstTFcMvwStWd9Tj3e6CEqtOivtD8AUiHT8ido/xmzrI9ijrUUihZ6nHuf/vsScRBonagOdj0Vv+SEL5G3Q==", "dev": true } } }, "vega-tooltip": { - "version": "0.20.1", - "resolved": "https://registry.npmjs.org/vega-tooltip/-/vega-tooltip-0.20.1.tgz", - "integrity": "sha512-kk1p2VRDAZRdoi9C6UdItOO8GCFbtVfUNT1g3XPpHCYuQ4Lrjffa0SNcT/i69luC3n6qd9VyrceFoPBGM4YvTw==", + "version": "0.24.2", + "resolved": "https://registry.npmjs.org/vega-tooltip/-/vega-tooltip-0.24.2.tgz", + "integrity": "sha512-b7IeYQl/piNVsMmTliOgTnwSOhBs67KqoZ9UzP1I3XpH7TKbSuc3YHA7b1CSxkRR0hHKdradby4UI8c9rdH74w==", "dev": true, "requires": { - "vega-util": "^1.12.2" + "vega-util": "^1.15.2" } }, "vega-transforms": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/vega-transforms/-/vega-transforms-4.6.0.tgz", - "integrity": "sha512-5nsMMnyOME/Xe1xLNGCcQ+BS94cix9gSItHiXqU7wR50ukp5U9JoUxnfeYJkuv37FAbnFpkuYlPcBCWp55zXhQ==", + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/vega-transforms/-/vega-transforms-4.9.3.tgz", + "integrity": "sha512-PdqQd5oPlRyD405M2w+Sz9Bo+i7Rwi8o03SVK7RaeQsJC2FffKGJ6acIaSEgOq+yD1Q2k/1SePmCXcmLUlIiEA==", "dev": true, "requires": { - "d3-array": "^2.4.0", - "vega-dataflow": "^5.5.0", - "vega-statistics": "^1.7.1", - "vega-time": "^1.0.0", - "vega-util": "^1.12.1" + "d3-array": "^2.7.1", + "vega-dataflow": "^5.7.3", + "vega-statistics": "^1.7.9", + "vega-time": "^2.0.4", + "vega-util": "^1.15.2" }, "dependencies": { "d3-array": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.4.0.tgz", - "integrity": "sha512-KQ41bAF2BMakf/HdKT865ALd4cgND6VcIztVQZUTt0+BH3RWy6ZYnHghVXf6NFjt2ritLr8H1T8LreAAlfiNcw==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.9.1.tgz", + "integrity": "sha512-Ob7RdOtkqsjx1NWyQHMFLtCSk6/aKTxDdC4ZIolX+O+mDD2RzrsYgAyc0WGAlfYFVELLSilS7w8BtE3PKM8bHg==", "dev": true } } }, "vega-typings": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/vega-typings/-/vega-typings-0.12.0.tgz", - "integrity": "sha512-K+IoUTTtXW3E1Qhr/y+JgLRxy476viAm6DeM8IiVrA8vvuLA3FTzHaeI7TCnaWEwk9xxLJBtdVKKC5FGbp0Nyw==", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/vega-typings/-/vega-typings-0.19.2.tgz", + "integrity": "sha512-YU/S9rDk4d+t4+4eTa9fzuw87PMNteeVtpcL51kUO8H7HvGaoW7ll8RHKLkR0NYBEGPRoFDKUxnoyMvhgjsdYw==", "dev": true, "requires": { - "vega-util": "^1.12.1" + "vega-util": "^1.15.2" } }, "vega-util": { - "version": "1.12.2", - "resolved": "https://registry.npmjs.org/vega-util/-/vega-util-1.12.2.tgz", - "integrity": "sha512-p02+oQ/XU/gzY9S/CTZinym2NKWEMIneLc+FYdUeJZZnDGa3DvcNgUDlVR90JlwLcYZNs5dBdfYLfdRHsKZKiw==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/vega-util/-/vega-util-1.16.0.tgz", + "integrity": "sha512-6mmz6mI+oU4zDMeKjgvE2Fjz0Oh6zo6WGATcvCfxH2gXBzhBHmy5d25uW5Zjnkc6QBXSWPLV9Xa6SiqMsrsKog==", "dev": true }, "vega-view": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/vega-view/-/vega-view-5.4.0.tgz", - "integrity": "sha512-Q8nH93NceWJRB4/KTehOvsrpbCGGDnkjOCcNQpTsGgu6QRmgMTHtRQTHkE+LhLXMO/55zZrVR22thvMEH9r36w==", - "dev": true, - "requires": { - "d3-array": "^2.4.0", - "d3-timer": "^1.0.10", - "vega-dataflow": "^5.5.0", - "vega-functions": "^5.5.1", - "vega-runtime": "^5.0.2", - "vega-scenegraph": "^4.5.0", - "vega-util": "^1.12.1" + "version": "5.9.0", + "resolved": "https://registry.npmjs.org/vega-view/-/vega-view-5.9.0.tgz", + "integrity": "sha512-HqRFuqO2OwoPHHK+CVt8vB8fu2L8GjQerLpmEpglWtCPDns5+gn5B6F7M8Ah8v24WlfqW7cLrY81t9OloPZOyw==", + "dev": true, + "requires": { + "d3-array": "^2.7.1", + "d3-timer": "^2.0.0", + "vega-dataflow": "^5.7.3", + "vega-format": "^1.0.4", + "vega-functions": "^5.8.0", + "vega-runtime": "^6.1.3", + "vega-scenegraph": "^4.9.2", + "vega-util": "^1.15.2" }, "dependencies": { "d3-array": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.4.0.tgz", - "integrity": "sha512-KQ41bAF2BMakf/HdKT865ALd4cgND6VcIztVQZUTt0+BH3RWy6ZYnHghVXf6NFjt2ritLr8H1T8LreAAlfiNcw==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.9.1.tgz", + "integrity": "sha512-Ob7RdOtkqsjx1NWyQHMFLtCSk6/aKTxDdC4ZIolX+O+mDD2RzrsYgAyc0WGAlfYFVELLSilS7w8BtE3PKM8bHg==", + "dev": true + }, + "d3-timer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-2.0.0.tgz", + "integrity": "sha512-TO4VLh0/420Y/9dO3+f9abDEFYeCUr2WZRlxJvbp4HPTQcSylXNiL6yZa9FIUvV1yRiFufl1bszTCLDqv9PWNA==", "dev": true } } }, "vega-view-transforms": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/vega-view-transforms/-/vega-view-transforms-4.5.0.tgz", - "integrity": "sha512-8n52147HxNSjQ23NeHN//AWt99zZP+Ukiy4kSbkCJGPZ3dW3NYdunEYNvZWyMmOKSrHIMtgdcHUM9FmPTQpE9w==", + "version": "4.5.8", + "resolved": "https://registry.npmjs.org/vega-view-transforms/-/vega-view-transforms-4.5.8.tgz", + "integrity": "sha512-966m7zbzvItBL8rwmF2nKG14rBp7q+3sLCKWeMSUrxoG+M15Smg5gWEGgwTG3A/RwzrZ7rDX5M1sRaAngRH25g==", "dev": true, "requires": { - "vega-dataflow": "^5.4.1", - "vega-scenegraph": "^4.4.0", - "vega-util": "^1.12.0" + "vega-dataflow": "^5.7.3", + "vega-scenegraph": "^4.9.2", + "vega-util": "^1.15.2" } }, "vega-voronoi": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/vega-voronoi/-/vega-voronoi-4.1.1.tgz", - "integrity": "sha512-agLmr+UGxJs5KB9D8GeZqxgeWWGoER/eVHPcFFPgVuoNBsrqf2bdoltmIkRnpiRsQnGCibGixhFEDCc9GGNAww==", + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/vega-voronoi/-/vega-voronoi-4.1.5.tgz", + "integrity": "sha512-950IkgCFLj0zG33EWLAm1hZcp+FMqWcNQliMYt+MJzOD5S4MSpZpZ7K4wp2M1Jktjw/CLKFL9n38JCI0i3UonA==", "dev": true, "requires": { - "d3-delaunay": "^5.1.3", - "vega-dataflow": "^5.1.1", - "vega-util": "^1.11.0" + "d3-delaunay": "^5.3.0", + "vega-dataflow": "^5.7.3", + "vega-util": "^1.15.2" } }, "vega-wordcloud": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/vega-wordcloud/-/vega-wordcloud-4.0.4.tgz", - "integrity": "sha512-+FwgCKTj8JBMbBjNiVciLvjQnk+rC59uyecmlTsmtUGVZz5wyANooYcXt4xtiRu+G8ohdlJ6L/59+UFTaUR8og==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/vega-wordcloud/-/vega-wordcloud-4.1.3.tgz", + "integrity": "sha512-is4zYn9FMAyp9T4SAcz2P/U/wqc0Lx3P5YtpWKCbOH02a05vHjUQrQ2TTPOuvmMfAEDCSKvbMSQIJMOE018lJA==", "dev": true, "requires": { - "vega-canvas": "^1.2.1", - "vega-dataflow": "^5.4.1", - "vega-scale": "^6.0.0", - "vega-statistics": "^1.7.1", - "vega-util": "^1.12.1" + "vega-canvas": "^1.2.5", + "vega-dataflow": "^5.7.3", + "vega-scale": "^7.1.1", + "vega-statistics": "^1.7.9", + "vega-util": "^1.15.2" } }, "velocity-animate": { diff --git a/package.json b/package.json index 74134c1428..5601521912 100644 --- a/package.json +++ b/package.json @@ -191,9 +191,9 @@ "typo-js": "^1.0.3", "uglifyjs-webpack-plugin": "~1.2.7", "url-loader": "~1.0.1", - "vega": "~5.9.1", - "vega-embed": "~6.2.2", - "vega-lite": "~4.4.0", + "vega": "~5.17.1", + "vega-embed": "~6.14.2", + "vega-lite": "~4.17.0", "velocity-animate": "~1.5.2", "visibilityjs": "~2.0.2", "viz.js": "~2.1.2", From 59fd7e71ad185f22b0de6cf326edbe0428f4d704 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 23 Dec 2020 12:18:27 +0800 Subject: [PATCH 28/35] Update vega cdnjs assets Signed-off-by: Yukai Huang --- public/views/codimd/foot.ejs | 6 +++--- public/views/pretty.ejs | 6 +++--- public/views/slide.ejs | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/public/views/codimd/foot.ejs b/public/views/codimd/foot.ejs index 243fa40ad6..d3bfa1f079 100644 --- a/public/views/codimd/foot.ejs +++ b/public/views/codimd/foot.ejs @@ -21,9 +21,9 @@ - - - + + + <%- include ../build/index-scripts %> <% } else { %> diff --git a/public/views/pretty.ejs b/public/views/pretty.ejs index 30248a7010..f07d9059db 100644 --- a/public/views/pretty.ejs +++ b/public/views/pretty.ejs @@ -96,9 +96,9 @@ - - - + + + <%- include build/pretty-scripts %> <% } else { %> diff --git a/public/views/slide.ejs b/public/views/slide.ejs index 83d1539a31..d5f848f8f4 100644 --- a/public/views/slide.ejs +++ b/public/views/slide.ejs @@ -108,9 +108,9 @@ - - - + + + <%- include build/slide-scripts %> <% } else { %> From c1a22a53185dad2bb7f63fbec20f24048ae0659b Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 23 Dec 2020 15:43:14 +0800 Subject: [PATCH 29/35] Replace hard coded impl in getImageMimeType Signed-off-by: Yukai Huang --- lib/utils.js | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index 4180e20267..b0c71fc6d1 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -2,29 +2,14 @@ const fs = require('fs') const path = require('path') const bodyParser = require('body-parser') +const mime = require('mime-types') exports.isSQLite = function isSQLite (sequelize) { return sequelize.options.dialect === 'sqlite' } exports.getImageMimeType = function getImageMimeType (imagePath) { - const fileExtension = /[^.]+$/.exec(imagePath) - - switch (fileExtension[0]) { - case 'bmp': - return 'image/bmp' - case 'gif': - return 'image/gif' - case 'jpg': - case 'jpeg': - return 'image/jpeg' - case 'png': - return 'image/png' - case 'tiff': - return 'image/tiff' - default: - return undefined - } + return mime.contentType(path.extname(imagePath)) } exports.isRevealTheme = function isRevealTheme (theme) { From e19e6642fbaecc9fabac93fcbd8232d52fe1ac36 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 23 Dec 2020 15:45:49 +0800 Subject: [PATCH 30/35] Allow bmp/tiff image to be uploaded Signed-off-by: Yukai Huang --- lib/config/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/config/index.js b/lib/config/index.js index 150116f628..467ab123eb 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -189,7 +189,9 @@ switch (config.imageUploadType) { 'image/png', 'image/jpg', 'image/gif', - 'image/svg+xml' + 'image/svg+xml', + 'image/bmp', + 'image/tiff' ] } From c9e23985d346ffda7ce433c388d318b962a8aa8d Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 23 Dec 2020 15:46:19 +0800 Subject: [PATCH 31/35] Check image type from file extension Signed-off-by: Yukai Huang --- lib/imageRouter/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/imageRouter/index.js b/lib/imageRouter/index.js index 5a4eb8d816..5e2d3dfbb3 100644 --- a/lib/imageRouter/index.js +++ b/lib/imageRouter/index.js @@ -1,11 +1,13 @@ 'use strict' const fs = require('fs') +const path = require('path') const Router = require('express').Router const formidable = require('formidable') const readChunk = require('read-chunk') const imageType = require('image-type') +const mime = require('mime-types') const config = require('../config') const logger = require('../logger') @@ -14,10 +16,13 @@ const response = require('../response') const imageRouter = module.exports = Router() function checkImageValid (filepath) { - const supported = ['png', 'jpg', 'jpeg', 'bmp', 'tif', 'tiff', 'gif'] const buffer = readChunk.sync(filepath, 0, 12) - const type = imageType(buffer) - return type && supported.some(e => e === type.ext) + /** @type {{ ext: string, mime: string } | null} */ + const mimetypeFromBuf = imageType(buffer) + const mimeTypeFromExt = mime.lookup(path.extname(filepath)) + + return mimetypeFromBuf && config.allowedUploadMimeTypes.includes(mimetypeFromBuf.mime) && + mimeTypeFromExt && config.allowedUploadMimeTypes.includes(mimeTypeFromExt) } // upload image From de0f4588ac6f634e8c471da6a6bb49f94b950133 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 23 Dec 2020 22:16:28 +0800 Subject: [PATCH 32/35] Fix getImageMimeType mime usage Signed-off-by: Yukai Huang --- lib/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils.js b/lib/utils.js index b0c71fc6d1..eb10ca452f 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -9,7 +9,7 @@ exports.isSQLite = function isSQLite (sequelize) { } exports.getImageMimeType = function getImageMimeType (imagePath) { - return mime.contentType(path.extname(imagePath)) + return mime.lookup(path.extname(imagePath)) } exports.isRevealTheme = function isRevealTheme (theme) { From d1b4b26fe454df58449070290b72fde8324b6f8d Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 30 Dec 2020 16:58:58 +0800 Subject: [PATCH 33/35] Update release notes Signed-off-by: Yukai Huang --- public/docs/release-notes.md | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/public/docs/release-notes.md b/public/docs/release-notes.md index 88de6b2fd6..91213e09f7 100644 --- a/public/docs/release-notes.md +++ b/public/docs/release-notes.md @@ -1,6 +1,48 @@ Release Notes === + 2.3.0 Isoetes taiwanensis 2020-12-30 +--- + +
+ + Isoetes taiwanensis +
+ +> Isoetes taiwanensis is a species of plant in the family Isoetaceae. It is endemic to Taiwan, and the only species of quillwort there. As other quillworts, it is relatively small, with erect leaves 7–24 cm (2.8–9.4 in) long. It grows submersed in shallow ponds for most of the year. IUCN considers it critically endangered because of habitat loss. +> \- Wikipedia [Isoetes taiwanensis](https://en.wikipedia.org/wiki/Isoetes_taiwanensis) + +In this release, we focus on polishing existing features, fixing bugs and patching security issues. + +We continue to expand the APIs. CodiMD now supports ["Update note's content" and "delete note"](https://github.com/hackmdio/codimd/pull/1559) RESTful APIs. Thanks for the great works from [@JamesCamel](https://github.com/JamesCamel) :heart_eyes: + +We also fix several XSS security issues, including [mermaid](https://github.com/hackmdio/codimd/pull/1633), [vega](https://github.com/hackmdio/codimd/pull/1637) and [image lightbox](https://github.com/hackmdio/codimd/pull/1632). We appreciate the security report from [@msrkp](https://github.com/@msrkp), [@Alemmi](https://github.com/Alemmi), and [@nename0 +](https://github.com/nename0). + +This is the last release before the end of this year. +Merry Christmas to everyone! Let's look forward and see you in the next year. :tada: + +[Check out the complete release note][v2_3_0]. Thank you CodiMD community and all our contributors. ❤️ + +[v2_3_0]: https://hackmd.io/@codimd/release-notes/%2F%40codimd%2Fv2_3_0 + +### Enhancements + +- Fretboard improvements +- Update and delete note api +- Allow Sequelize CLI to use options set in config.json +- Allow specifying option for graphviz +- Spellcheck: add en_GB dictionary + +### Fixes + +- Fix ui-edit and ui-both buttons in night mode +- Don't run jsonlint on .vscode jsonc files +- Fix image lightbox xss issue +- Fix mermaid xss issue +- Check upload image mime type +- Vega syntax XSS dependencies + 2.2.0 Diploderma swinhonis 2020-07-20 --- From db56ef1d3d0e89082de4a2324de504b3d7ae874e Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Wed, 30 Dec 2020 17:49:28 +0800 Subject: [PATCH 34/35] Update pdf broken pdf link in features.md Signed-off-by: Yukai Huang --- public/docs/features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/docs/features.md b/public/docs/features.md index 870e72c5ea..805ea7cc40 100644 --- a/public/docs/features.md +++ b/public/docs/features.md @@ -248,7 +248,7 @@ We use [Papa Parse](https://www.papaparse.com/) for parsing csv. The parsing opt ### PDF **Caution: this might be blocked by your browser if not using an `https` URL.** -{%pdf https://papers.nips.cc/paper/5346-sequence-to-sequence-learning-with-neural-networks.pdf %} +{%pdf https://www.w3.org/TR/WAI-WEBCONTENT/wai-pageauth.pdf %} ## MathJax From 30e83538e679eaf90a6b13ec34b4c8f508bb234c Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Thu, 31 Dec 2020 11:46:29 +0800 Subject: [PATCH 35/35] Bump version in package.json Signed-off-by: Yukai Huang --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index a14d932bef..16daf25590 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "codimd", - "version": "2.2.0", + "version": "2.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 63c2124f7f..29fb2be4f9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codimd", - "version": "2.2.0", + "version": "2.3.0", "description": "Realtime collaborative markdown notes on all platforms.", "keywords": [ "Collaborative",