diff --git a/docs/api/add-endpoint.md b/docs/api/add-endpoint.md index 5dfb4a177..da85d0d48 100644 --- a/docs/api/add-endpoint.md +++ b/docs/api/add-endpoint.md @@ -6,6 +6,9 @@ outline: deep An [endpoint](../concepts.md#endpoint) adds Express routes to an Indiekit server. Routes can add new pages to the web interface, or provide API endpoints that support IndieWeb (or other) protocols or APIs. +> [!NOTE] +> As of `v1.0.0-beta.20`, Indiekit uses [Express v5](https://expressjs.com/en/5x/api.html). Of particular note, this means paths should follow the [revised syntax for matching routes](https://expressjs.com/en/guide/migrating-5.html#path-syntax). + ## Syntax ```js diff --git a/package-lock.json b/package-lock.json index 6a40dfa1e..5bc4c1b22 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,7 +34,7 @@ "@indiekit-test/token": "*", "@micham/sftp-mock-server": "^0.0.6", "@types/cookie-session": "^2.0.44", - "@types/express": "^4.17.17", + "@types/express": "^5.0.0", "@types/express-fileupload": "^1.4.1", "@types/lodash": "^4.14.195", "aws-sdk-client-mock": "^4.0.0", @@ -4500,12 +4500,14 @@ "license": "MIT" }, "node_modules/@types/express": { - "version": "4.17.21", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/express/-/express-5.0.0.tgz", + "integrity": "sha512-DvZriSMehGHL1ZNLzi6MidnsDhUZM/x2pRdDIKdwbUNqqwHxMlRdkxtn6/EPKyqKpHqTl/4nRZsRNLpZxZRpPQ==", "dev": true, "license": "MIT", "dependencies": { "@types/body-parser": "*", - "@types/express-serve-static-core": "^4.17.33", + "@types/express-serve-static-core": "^5.0.0", "@types/qs": "*", "@types/serve-static": "*" } @@ -4520,7 +4522,9 @@ } }, "node_modules/@types/express-serve-static-core": { - "version": "4.19.6", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-5.0.1.tgz", + "integrity": "sha512-CRICJIl0N5cXDONAdlTv5ShATZ4HEwk6kDDIW2/w9qOWKg+NU/5F8wYRWCrONad0/UKkloNSmmyN/wX4rtpbVA==", "dev": true, "license": "MIT", "dependencies": { @@ -4621,11 +4625,15 @@ }, "node_modules/@types/qs": { "version": "6.9.17", + "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.17.tgz", + "integrity": "sha512-rX4/bPcfmvxHDv0XjfJELTTr+iB+tn032nPILqHm5wbthUUUuVtNGGqzhya9XUxjTP8Fpr0qYgSZZKxGY++svQ==", "dev": true, "license": "MIT" }, "node_modules/@types/range-parser": { "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz", + "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==", "dev": true, "license": "MIT" }, @@ -5059,18 +5067,34 @@ } }, "node_modules/accepts": { - "version": "1.3.8", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/accepts/node_modules/mime-types": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.0.tgz", + "integrity": "sha512-XqoSHeCGjVClAmoGFG3lVFqQFRIrTVw2OH3axRqAcfaw+gHWIfnASS92AV+Rl/mk0MupgZTRHQOjxY6YVnzK5w==", "license": "MIT", "dependencies": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" + "mime-db": "^1.53.0" }, "engines": { "node": ">= 0.6" } }, "node_modules/accepts/node_modules/negotiator": { - "version": "0.6.3", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", "license": "MIT", "engines": { "node": ">= 0.6" @@ -5287,7 +5311,9 @@ } }, "node_modules/array-flatten": { - "version": "1.1.1", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-3.0.0.tgz", + "integrity": "sha512-zPMVc3ZYlGLNk4mpK1NzP2wg0ml9t7fUgDsayR5Y5rSzxQilzR9FGu/EH2jQOcKSAeAfWeylyW8juy3OkWRvNA==", "license": "MIT" }, "node_modules/array-ify": { @@ -5677,38 +5703,75 @@ } }, "node_modules/body-parser": { - "version": "1.20.3", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.0.2.tgz", + "integrity": "sha512-SNMk0OONlQ01uk8EPeiBvTW7W4ovpL5b1O3t1sjpPgfxOQ6BqQJ6XjxinDPR79Z6HdcD5zBBwr5ssiTlgdNztQ==", "license": "MIT", "dependencies": { "bytes": "3.1.2", "content-type": "~1.0.5", - "debug": "2.6.9", - "depd": "2.0.0", + "debug": "3.1.0", "destroy": "1.2.0", "http-errors": "2.0.0", - "iconv-lite": "0.4.24", + "iconv-lite": "0.5.2", "on-finished": "2.4.1", "qs": "6.13.0", - "raw-body": "2.5.2", - "type-is": "~1.6.18", - "unpipe": "1.0.0" + "raw-body": "^3.0.0", + "type-is": "~1.6.18" }, "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" + "node": ">=18" } }, "node_modules/body-parser/node_modules/debug": { - "version": "2.6.9", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "license": "MIT", "dependencies": { "ms": "2.0.0" } }, + "node_modules/body-parser/node_modules/iconv-lite": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.2.tgz", + "integrity": "sha512-kERHXvpSaB4aU3eANwidg79K8FlrN77m8G9V+0vOR3HYaRifrlwMEpT7ZBJqLSEIHnEgJTHcWK82wwLwwKwtag==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/body-parser/node_modules/media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/body-parser/node_modules/ms": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "license": "MIT" }, + "node_modules/body-parser/node_modules/type-is": { + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", + "license": "MIT", + "dependencies": { + "media-typer": "0.3.0", + "mime-types": "~2.1.24" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/boolbase": { "version": "1.0.0", "license": "ISC" @@ -6622,7 +6685,9 @@ } }, "node_modules/content-disposition": { - "version": "0.5.4", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.0.tgz", + "integrity": "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==", "license": "MIT", "dependencies": { "safe-buffer": "5.2.1" @@ -6633,6 +6698,8 @@ }, "node_modules/content-type": { "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", "license": "MIT", "engines": { "node": ">= 0.6" @@ -7417,8 +7484,13 @@ } }, "node_modules/cookie-signature": { - "version": "1.0.6", - "license": "MIT" + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } }, "node_modules/cookiejar": { "version": "2.1.4", @@ -7880,6 +7952,8 @@ }, "node_modules/destroy": { "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", "license": "MIT", "engines": { "node": ">= 0.8", @@ -8074,6 +8148,8 @@ }, "node_modules/ee-first": { "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", "license": "MIT" }, "node_modules/ejs": { @@ -8105,6 +8181,8 @@ }, "node_modules/encodeurl": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", "license": "MIT", "engines": { "node": ">= 0.8" @@ -8370,6 +8448,8 @@ }, "node_modules/escape-html": { "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", "license": "MIT" }, "node_modules/escape-string-regexp": { @@ -8934,43 +9014,46 @@ "license": "Apache-2.0" }, "node_modules/express": { - "version": "4.21.1", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.0.1.tgz", + "integrity": "sha512-ORF7g6qGnD+YtUG9yx4DFoqCShNMmUKiXuT5oWMHiOvt/4WFbHC6yCwQMTSBMno7AqntNCAzzcnnjowRkTL9eQ==", "license": "MIT", "dependencies": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.3", - "content-disposition": "0.5.4", + "accepts": "^2.0.0", + "body-parser": "^2.0.1", + "content-disposition": "^1.0.0", "content-type": "~1.0.4", "cookie": "0.7.1", - "cookie-signature": "1.0.6", - "debug": "2.6.9", + "cookie-signature": "^1.2.1", + "debug": "4.3.6", "depd": "2.0.0", "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", - "finalhandler": "1.3.1", - "fresh": "0.5.2", + "finalhandler": "^2.0.0", + "fresh": "2.0.0", "http-errors": "2.0.0", - "merge-descriptors": "1.0.3", + "merge-descriptors": "^2.0.0", "methods": "~1.1.2", + "mime-types": "^3.0.0", "on-finished": "2.4.1", + "once": "1.4.0", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.10", "proxy-addr": "~2.0.7", "qs": "6.13.0", "range-parser": "~1.2.1", + "router": "^2.0.0", "safe-buffer": "5.2.1", - "send": "0.19.0", - "serve-static": "1.16.2", + "send": "^1.1.0", + "serve-static": "^2.1.0", "setprototypeof": "1.2.0", "statuses": "2.0.1", - "type-is": "~1.6.18", + "type-is": "^2.0.0", "utils-merge": "1.0.1", "vary": "~1.1.2" }, "engines": { - "node": ">= 0.10.0" + "node": ">= 18" } }, "node_modules/express-fileupload": { @@ -9008,14 +9091,38 @@ } }, "node_modules/express/node_modules/debug": { - "version": "2.6.9", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", + "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", "license": "MIT", "dependencies": { - "ms": "2.0.0" + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/express/node_modules/mime-types": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.0.tgz", + "integrity": "sha512-XqoSHeCGjVClAmoGFG3lVFqQFRIrTVw2OH3axRqAcfaw+gHWIfnASS92AV+Rl/mk0MupgZTRHQOjxY6YVnzK5w==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.53.0" + }, + "engines": { + "node": ">= 0.6" } }, "node_modules/express/node_modules/ms": { - "version": "2.0.0", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "license": "MIT" }, "node_modules/external-editor": { @@ -9221,11 +9328,13 @@ } }, "node_modules/finalhandler": { - "version": "1.3.1", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.0.0.tgz", + "integrity": "sha512-MX6Zo2adDViYh+GcxxB1dpO43eypOGUOL12rLCOTMQv/DfIbpSJUy4oQIIZhVZkH9e+bZWKMon0XHFEju16tkQ==", "license": "MIT", "dependencies": { "debug": "2.6.9", - "encodeurl": "~2.0.0", + "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "on-finished": "2.4.1", "parseurl": "~1.3.3", @@ -9238,13 +9347,26 @@ }, "node_modules/finalhandler/node_modules/debug": { "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "license": "MIT", "dependencies": { "ms": "2.0.0" } }, + "node_modules/finalhandler/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/finalhandler/node_modules/ms": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "license": "MIT" }, "node_modules/find-cache-dir": { @@ -9428,10 +9550,12 @@ } }, "node_modules/fresh": { - "version": "0.5.2", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">= 0.8" } }, "node_modules/front-matter": { @@ -10328,6 +10452,8 @@ }, "node_modules/http-errors": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", "license": "MIT", "dependencies": { "depd": "2.0.0", @@ -11023,6 +11149,12 @@ "dev": true, "license": "MIT" }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, "node_modules/is-regex": { "version": "1.1.4", "dev": true, @@ -12730,10 +12862,12 @@ "license": "MIT" }, "node_modules/media-typer": { - "version": "0.3.0", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", "license": "MIT", "engines": { - "node": ">= 0.6" + "node": ">= 0.8" } }, "node_modules/memory-pager": { @@ -12752,8 +12886,13 @@ } }, "node_modules/merge-descriptors": { - "version": "1.0.3", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", "license": "MIT", + "engines": { + "node": ">=18" + }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } @@ -12881,16 +13020,6 @@ "node": ">=8.6" } }, - "node_modules/mime": { - "version": "1.6.0", - "license": "MIT", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, "node_modules/mime-db": { "version": "1.53.0", "license": "MIT", @@ -13409,14 +13538,6 @@ "path-to-regexp": "^8.1.0" } }, - "node_modules/nise/node_modules/path-to-regexp": { - "version": "8.2.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=16" - } - }, "node_modules/no-case": { "version": "3.0.4", "license": "MIT", @@ -14011,6 +14132,8 @@ }, "node_modules/on-finished": { "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", "license": "MIT", "dependencies": { "ee-first": "1.1.1" @@ -14398,6 +14521,8 @@ }, "node_modules/parseurl": { "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", "license": "MIT", "engines": { "node": ">= 0.8" @@ -14460,8 +14585,13 @@ } }, "node_modules/path-to-regexp": { - "version": "0.1.10", - "license": "MIT" + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.2.0.tgz", + "integrity": "sha512-TdrF7fW9Rphjq4RjrW0Kp2AW0Ahwu9sRGTkS6bvDi0SCwZlEZYmcfDbEsTz8RVk0EHIS/Vd1bv3JhG+1xZuAyQ==", + "license": "MIT", + "engines": { + "node": ">=16" + } }, "node_modules/path-type": { "version": "4.0.0", @@ -14954,6 +15084,8 @@ }, "node_modules/range-parser": { "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", "license": "MIT", "engines": { "node": ">= 0.6" @@ -14964,18 +15096,32 @@ "license": "ISC" }, "node_modules/raw-body": { - "version": "2.5.2", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.0.tgz", + "integrity": "sha512-RmkhL8CAyCRPXCE28MMH0z2PNWQBNk2Q09ZdxM9IOOXwxwZbN+qbWaatPkdkWIKL2ZVDImrN/pK5HTRz2PcS4g==", "license": "MIT", "dependencies": { "bytes": "3.1.2", "http-errors": "2.0.0", - "iconv-lite": "0.4.24", + "iconv-lite": "0.6.3", "unpipe": "1.0.0" }, "engines": { "node": ">= 0.8" } }, + "node_modules/raw-body/node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/react-is": { "version": "18.3.1", "license": "MIT" @@ -15484,6 +15630,24 @@ "fsevents": "~2.3.2" } }, + "node_modules/router": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.0.0.tgz", + "integrity": "sha512-dIM5zVoG8xhC6rnSN8uoAgFARwTE7BQs8YwHEvK0VCmfxQXMaOuA1uiR1IPwsW7JyK5iTt7Od/TC9StasS2NPQ==", + "license": "MIT", + "dependencies": { + "array-flatten": "3.0.0", + "is-promise": "4.0.0", + "methods": "~1.1.2", + "parseurl": "~1.3.3", + "path-to-regexp": "^8.0.0", + "setprototypeof": "1.2.0", + "utils-merge": "1.0.1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/rrweb-cssom": { "version": "0.7.1", "dev": true, @@ -15621,43 +15785,52 @@ } }, "node_modules/send": { - "version": "0.19.0", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/send/-/send-1.1.0.tgz", + "integrity": "sha512-v67WcEouB5GxbTWL/4NeToqcZiAWEq90N888fczVArY8A79J0L4FD7vj5hm3eUMua5EpoQ59wa/oovY6TLvRUA==", "license": "MIT", "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" + "debug": "^4.3.5", + "destroy": "^1.2.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^0.5.2", + "http-errors": "^2.0.0", + "mime-types": "^2.1.35", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.1" }, "engines": { - "node": ">= 0.8.0" + "node": ">= 18" } }, "node_modules/send/node_modules/debug": { - "version": "2.6.9", + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "license": "MIT", "dependencies": { - "ms": "2.0.0" + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "node_modules/send/node_modules/debug/node_modules/ms": { - "version": "2.0.0", - "license": "MIT" - }, - "node_modules/send/node_modules/encodeurl": { - "version": "1.0.2", + "node_modules/send/node_modules/fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", "license": "MIT", "engines": { - "node": ">= 0.8" + "node": ">= 0.6" } }, "node_modules/sentence-case": { @@ -15670,16 +15843,18 @@ } }, "node_modules/serve-static": { - "version": "1.16.2", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.1.0.tgz", + "integrity": "sha512-A3We5UfEjG8Z7VkDv6uItWw6HY2bBSBJT1KtVESn6EOoOr2jAxNhxWCLY3jDE2WcuHXByWju74ck3ZgLwL8xmA==", "license": "MIT", "dependencies": { - "encodeurl": "~2.0.0", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.19.0" + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.0.0" }, "engines": { - "node": ">= 0.8.0" + "node": ">= 18" } }, "node_modules/set-blocking": { @@ -15717,6 +15892,8 @@ }, "node_modules/setprototypeof": { "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", "license": "ISC" }, "node_modules/shallow-clone": { @@ -16127,6 +16304,8 @@ }, "node_modules/statuses": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", "license": "MIT", "engines": { "node": ">= 0.8" @@ -16924,6 +17103,8 @@ }, "node_modules/toidentifier": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", "license": "MIT", "engines": { "node": ">=0.6" @@ -17094,11 +17275,26 @@ } }, "node_modules/type-is": { - "version": "1.6.18", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.0.tgz", + "integrity": "sha512-gd0sGezQYCbWSbkZr75mln4YBidWUN60+devscpLF5mtRDUpiaTvKpBNrdaCvel1NdR2k6vclXybU5fBd2i+nw==", "license": "MIT", "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/type-is/node_modules/mime-types": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.0.tgz", + "integrity": "sha512-XqoSHeCGjVClAmoGFG3lVFqQFRIrTVw2OH3axRqAcfaw+gHWIfnASS92AV+Rl/mk0MupgZTRHQOjxY6YVnzK5w==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.53.0" }, "engines": { "node": ">= 0.6" @@ -17380,6 +17576,8 @@ }, "node_modules/unpipe": { "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", "license": "MIT", "engines": { "node": ">= 0.8" @@ -18203,7 +18401,7 @@ "@indiekit/error": "^1.0.0-beta.15", "@indiekit/util": "^1.0.0-beta.19", "bcrypt": "^5.1.0", - "express": "^4.17.1", + "express": "^5.0.0", "express-validator": "^7.0.0", "jsonwebtoken": "^9.0.0", "microformats-parser": "^2.0.0" @@ -18218,7 +18416,7 @@ "license": "MIT", "dependencies": { "@indiekit/error": "^1.0.0-beta.15", - "express": "^4.17.1", + "express": "^5.0.0", "express-validator": "^7.0.0" }, "engines": { @@ -18230,7 +18428,7 @@ "version": "1.0.0-beta.10", "license": "MIT", "dependencies": { - "express": "^4.17.1", + "express": "^5.0.0", "ipx": "^3.0.0" }, "engines": { @@ -18242,7 +18440,7 @@ "version": "1.0.0-beta.10", "license": "MIT", "dependencies": { - "express": "^4.17.1", + "express": "^5.0.0", "mime-types": "^2.1.35" }, "engines": { @@ -18258,7 +18456,7 @@ "@indiekit/util": "^1.0.0-beta.19", "debug": "^4.3.2", "deepmerge": "^4.3.1", - "express": "^4.17.1", + "express": "^5.0.0", "file-type": "^19.0.0", "newbase60": "^1.3.1", "sharp": "^0.33.2" @@ -18291,7 +18489,7 @@ "@indiekit/util": "^1.0.0-beta.19", "@paulrobertlloyd/mf2tojf2": "^2.1.0", "debug": "^4.3.2", - "express": "^4.17.1", + "express": "^5.0.0", "lodash": "^4.17.21", "markdown-it": "^14.0.0", "newbase60": "^1.3.1", @@ -18326,7 +18524,7 @@ "@indiekit/frontend": "^1.0.0-beta.19", "@indiekit/util": "^1.0.0-beta.19", "@paulrobertlloyd/mf2tojf2": "^2.1.0", - "express": "^4.17.1", + "express": "^5.0.0", "express-validator": "^7.0.0", "formatcoords": "^1.1.3" }, @@ -18340,7 +18538,7 @@ "license": "MIT", "dependencies": { "@indiekit/error": "^1.0.0-beta.15", - "express": "^4.17.1", + "express": "^5.0.0", "express-validator": "^7.0.0" }, "engines": { @@ -18353,7 +18551,7 @@ "license": "MIT", "dependencies": { "@indiekit/error": "^1.0.0-beta.15", - "express": "^4.17.1", + "express": "^5.0.0", "jsonwebtoken": "^9.0.0" }, "engines": { @@ -18476,7 +18674,7 @@ "cosmiconfig": "^9.0.0", "debug": "^4.3.2", "deepmerge": "^4.2.2", - "express": "^4.17.1", + "express": "^5.0.0", "express-fileupload": "^1.4.0", "express-rate-limit": "^7.0.0", "i18n": "^0.15.0", diff --git a/package.json b/package.json index 80af329dc..46b1c5f51 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "@indiekit-test/token": "*", "@micham/sftp-mock-server": "^0.0.6", "@types/cookie-session": "^2.0.44", - "@types/express": "^4.17.17", + "@types/express": "^5.0.0", "@types/express-fileupload": "^1.4.1", "@types/lodash": "^4.14.195", "aws-sdk-client-mock": "^4.0.0", diff --git a/packages/endpoint-auth/package.json b/packages/endpoint-auth/package.json index 37d2611a5..369581edb 100644 --- a/packages/endpoint-auth/package.json +++ b/packages/endpoint-auth/package.json @@ -38,7 +38,7 @@ "@indiekit/error": "^1.0.0-beta.15", "@indiekit/util": "^1.0.0-beta.19", "bcrypt": "^5.1.0", - "express": "^4.17.1", + "express": "^5.0.0", "express-validator": "^7.0.0", "jsonwebtoken": "^9.0.0", "microformats-parser": "^2.0.0" diff --git a/packages/endpoint-files/index.js b/packages/endpoint-files/index.js index e77813e07..1af2f7f9d 100644 --- a/packages/endpoint-files/index.js +++ b/packages/endpoint-files/index.js @@ -40,7 +40,7 @@ export default class FilesEndpoint { router.get("/upload", fileData.upload, formController.get); router.post("/upload", fileData.upload, validate, formController.post); - router.use("/:uid/:action?", fileData.read); + router.use("/:uid{/:action}", fileData.read); router.get("/:uid", fileController); router.get("/:uid/delete", deleteController.get); diff --git a/packages/endpoint-files/package.json b/packages/endpoint-files/package.json index 52f194a4d..98a65d765 100644 --- a/packages/endpoint-files/package.json +++ b/packages/endpoint-files/package.json @@ -36,7 +36,7 @@ }, "dependencies": { "@indiekit/error": "^1.0.0-beta.15", - "express": "^4.17.1", + "express": "^5.0.0", "express-validator": "^7.0.0" }, "publishConfig": { diff --git a/packages/endpoint-image/package.json b/packages/endpoint-image/package.json index 13665d228..d8dd55066 100644 --- a/packages/endpoint-image/package.json +++ b/packages/endpoint-image/package.json @@ -35,7 +35,7 @@ "directory": "packages/endpoint-image" }, "dependencies": { - "express": "^4.17.1", + "express": "^5.0.0", "ipx": "^3.0.0" }, "publishConfig": { diff --git a/packages/endpoint-json-feed/package.json b/packages/endpoint-json-feed/package.json index 72e535b5a..db761fb51 100644 --- a/packages/endpoint-json-feed/package.json +++ b/packages/endpoint-json-feed/package.json @@ -34,7 +34,7 @@ "directory": "packages/endpoint-json-feed" }, "dependencies": { - "express": "^4.17.1", + "express": "^5.0.0", "mime-types": "^2.1.35" }, "publishConfig": { diff --git a/packages/endpoint-media/lib/controllers/action.js b/packages/endpoint-media/lib/controllers/action.js index 8682cd321..bcdd1b5ec 100644 --- a/packages/endpoint-media/lib/controllers/action.js +++ b/packages/endpoint-media/lib/controllers/action.js @@ -12,8 +12,8 @@ import { checkScope } from "../scope.js"; export const actionController = (imageProcessing) => async function (request, response, next) { const { app, body, files, query, session } = request; - const action = query.action || body.action || "media"; - const url = query.url || body.url; + const action = query.action || body?.action || "media"; + const url = query.url || body?.url; const { application, publication } = app.locals; try { diff --git a/packages/endpoint-media/package.json b/packages/endpoint-media/package.json index 7e0306996..15394a2fc 100644 --- a/packages/endpoint-media/package.json +++ b/packages/endpoint-media/package.json @@ -37,7 +37,7 @@ "@indiekit/util": "^1.0.0-beta.19", "debug": "^4.3.2", "deepmerge": "^4.3.1", - "express": "^4.17.1", + "express": "^5.0.0", "file-type": "^19.0.0", "newbase60": "^1.3.1", "sharp": "^0.33.2" diff --git a/packages/endpoint-micropub/lib/controllers/action.js b/packages/endpoint-micropub/lib/controllers/action.js index 7db5e5c4c..79820443b 100644 --- a/packages/endpoint-micropub/lib/controllers/action.js +++ b/packages/endpoint-micropub/lib/controllers/action.js @@ -11,8 +11,8 @@ import { uploadMedia } from "../media.js"; */ export const actionController = async (request, response, next) => { const { app, body, files, query, session } = request; - const action = query.action || body.action || "create"; - const url = query.url || body.url; + const action = query.action || body?.action || "create"; + const url = query.url || body?.url; const { application, publication } = app.locals; try { diff --git a/packages/endpoint-micropub/package.json b/packages/endpoint-micropub/package.json index 81799f0e9..a3cbe8b8f 100644 --- a/packages/endpoint-micropub/package.json +++ b/packages/endpoint-micropub/package.json @@ -37,7 +37,7 @@ "@indiekit/util": "^1.0.0-beta.19", "@paulrobertlloyd/mf2tojf2": "^2.1.0", "debug": "^4.3.2", - "express": "^4.17.1", + "express": "^5.0.0", "lodash": "^4.17.21", "markdown-it": "^14.0.0", "newbase60": "^1.3.1", diff --git a/packages/endpoint-micropub/test/unit/config.js b/packages/endpoint-micropub/test/unit/config.js index 67856b665..c18213570 100644 --- a/packages/endpoint-micropub/test/unit/config.js +++ b/packages/endpoint-micropub/test/unit/config.js @@ -19,6 +19,7 @@ describe("endpoint-micropub/lib/config", () => { }); const publication = { categories: ["foo", "bar"], + channels: {}, postTypes: config.publication.postTypes, syndicationTargets: [mastodon], }; diff --git a/packages/endpoint-posts/index.js b/packages/endpoint-posts/index.js index c52c65a2c..b72172e78 100644 --- a/packages/endpoint-posts/index.js +++ b/packages/endpoint-posts/index.js @@ -46,14 +46,14 @@ export default class PostsEndpoint { router.get("/create", postData.create, formController.get); router.post("/create", postData.create, validate.form, formController.post); - router.use("/:uid/:action?", postData.read); + router.use("/:uid{/:action}", postData.read); router.get("/:uid", postController); router.get("/:uid/update", formController.get); router.post("/:uid/update", validate.form, formController.post); - router.get("/:uid/:action(delete|undelete)", deleteController.get); - router.post("/:uid/:action(delete|undelete)", deleteController.post); + router.get(["/:uid/delete", "/:uid/undelete"], deleteController.get); + router.post(["/:uid/delete", "/:uid/undelete"], deleteController.post); return router; } diff --git a/packages/endpoint-posts/lib/middleware/post-data.js b/packages/endpoint-posts/lib/middleware/post-data.js index ff76dd776..8e1911195 100644 --- a/packages/endpoint-posts/lib/middleware/post-data.js +++ b/packages/endpoint-posts/lib/middleware/post-data.js @@ -16,13 +16,13 @@ export const postData = { // Create new post object with default values const postType = request.query.type || "note"; - const properties = request.body; + const properties = request?.body || {}; // Get post type config const { name, fields, h } = publication.postTypes[postType]; // Only select ‘checked’ syndication targets on first view - const checkTargets = Object.entries(request.body).length === 0; + const checkTargets = Object.entries(properties).length === 0; response.locals = { accessToken: access_token, diff --git a/packages/endpoint-posts/package.json b/packages/endpoint-posts/package.json index 19a7300f8..0e74a5f3a 100644 --- a/packages/endpoint-posts/package.json +++ b/packages/endpoint-posts/package.json @@ -40,7 +40,7 @@ "@indiekit/frontend": "^1.0.0-beta.19", "@indiekit/util": "^1.0.0-beta.19", "@paulrobertlloyd/mf2tojf2": "^2.1.0", - "express": "^4.17.1", + "express": "^5.0.0", "express-validator": "^7.0.0", "formatcoords": "^1.1.3" }, diff --git a/packages/endpoint-share/index.js b/packages/endpoint-share/index.js index 50f585364..0400b8e79 100644 --- a/packages/endpoint-share/index.js +++ b/packages/endpoint-share/index.js @@ -13,8 +13,8 @@ export default class ShareEndpoint { } get routes() { - router.get("/:path?", shareController.get); - router.post("/:path?", validate, shareController.post); + router.get("/{:path}", shareController.get); + router.post("/{:path}", validate, shareController.post); return router; } diff --git a/packages/endpoint-share/lib/controllers/share.js b/packages/endpoint-share/lib/controllers/share.js index 311aa0e65..7428700c2 100644 --- a/packages/endpoint-share/lib/controllers/share.js +++ b/packages/endpoint-share/lib/controllers/share.js @@ -23,8 +23,8 @@ export const shareController = { */ async post(request, response) { const { application } = request.app.locals; - const data = request.body; - data["bookmark-of"] = data.url || request.body["bookmark-of"]; + const data = request.body || {}; + data["bookmark-of"] = data.url || data["bookmark-of"]; const errors = validationResult(request); if (!errors.isEmpty()) { @@ -43,7 +43,7 @@ export const shareController = { accept: "application/json", "content-type": "application/x-www-form-urlencoded", }, - body: new URLSearchParams(request.body).toString(), + body: new URLSearchParams(data).toString(), }); if (!micropubResponse.ok) { diff --git a/packages/endpoint-share/package.json b/packages/endpoint-share/package.json index 6e6e4e910..d6689af3e 100644 --- a/packages/endpoint-share/package.json +++ b/packages/endpoint-share/package.json @@ -37,7 +37,7 @@ }, "dependencies": { "@indiekit/error": "^1.0.0-beta.15", - "express": "^4.17.1", + "express": "^5.0.0", "express-validator": "^7.0.0" }, "publishConfig": { diff --git a/packages/endpoint-syndicate/lib/token.js b/packages/endpoint-syndicate/lib/token.js index b33245cc1..671653eca 100644 --- a/packages/endpoint-syndicate/lib/token.js +++ b/packages/endpoint-syndicate/lib/token.js @@ -3,14 +3,14 @@ import { IndiekitError } from "@indiekit/error"; import jwt from "jsonwebtoken"; export const findBearerToken = (request) => { - if (request.headers?.["x-webhook-signature"]) { + if (request.headers?.["x-webhook-signature"] && request?.body?.url) { const signature = request.headers["x-webhook-signature"]; const verifiedToken = verifyToken(signature); const bearerToken = signToken(verifiedToken, request.body.url); return bearerToken; } - if (request.body?.access_token) { + if (request?.body?.access_token) { const bearerToken = request.body.access_token; delete request.body.access_token; return bearerToken; diff --git a/packages/endpoint-syndicate/package.json b/packages/endpoint-syndicate/package.json index e759c5604..ecee291c2 100644 --- a/packages/endpoint-syndicate/package.json +++ b/packages/endpoint-syndicate/package.json @@ -34,7 +34,7 @@ }, "dependencies": { "@indiekit/error": "^1.0.0-beta.15", - "express": "^4.17.1", + "express": "^5.0.0", "jsonwebtoken": "^9.0.0" }, "publishConfig": { diff --git a/packages/indiekit/package.json b/packages/indiekit/package.json index 76083e754..4273f83c7 100644 --- a/packages/indiekit/package.json +++ b/packages/indiekit/package.json @@ -63,7 +63,7 @@ "cosmiconfig": "^9.0.0", "debug": "^4.3.2", "deepmerge": "^4.2.2", - "express": "^4.17.1", + "express": "^5.0.0", "express-fileupload": "^1.4.0", "express-rate-limit": "^7.0.0", "i18n": "^0.15.0",