Commit Graph

7253 Commits (dbfe5cadf4ca1f987942fbc888e9607c79ce3a59)

Author SHA1 Message Date
Richard Hansen e01059dce5 ImportHandler: Switch to `fs/promises` API 2021-02-14 08:35:38 +00:00
Richard Hansen 5b1b030906 ImportHandler: Use asynchronous rename instead of `fs.renameSync()` 2021-02-14 08:35:38 +00:00
Richard Hansen c7b1abebe4 ImportHandler: Avoid deprecated `fs.exists()` function 2021-02-14 08:35:38 +00:00
Richard Hansen 008209b0e0 ImportHandler: Delete redundant variable 2021-02-14 08:35:38 +00:00
Richard Hansen cc52811cd0 pad_impexp: Use jQuery to build the import failure popup
This reduces the chances of accidentally introducing an XSS
vulnerability.
2021-02-14 08:35:38 +00:00
Richard Hansen d869d96a2b pad_impexp: Simplify creation of import failure message 2021-02-14 08:35:38 +00:00
Richard Hansen 890e16f6fc pad_impexp: Style fixes to improve readability 2021-02-14 08:35:38 +00:00
Richard Hansen efe07cd027 pad_impexp: Invert logic to improve readability 2021-02-14 08:35:38 +00:00
Richard Hansen ce4ce8ce95 pad_impexp: Delete unnecessary `importFailed` wrapper 2021-02-14 08:35:38 +00:00
Richard Hansen 8a221ca773 pad: Delete dead code 2021-02-14 08:35:38 +00:00
Richard Hansen 48205c1ddb import/export: Make sure Express sees async errors
Express v4.x does not check to see if a Promise returned from a
middleware function will be rejected, so explicitly pass the Promise
rejection reason to `next()`.

We can revert this change after we upgrade to Express v5.0.

See https://expressjs.com/en/guide/error-handling.html for details.
2021-02-14 08:35:38 +00:00
John McLear f59e0993a6
tests: test runner output HTML and CSS improvements to show duration (#4775) 2021-02-14 08:04:50 +00:00
Richard Hansen e674d9789e
express: Change `httpUptime` to `httpStartTime` (#4777)
It's better to provide a primitive value and let the consumer of the
metric do math if desired.

Co-authored-by: John McLear <john@mclear.co.uk>
2021-02-14 07:50:10 +00:00
John McLear 13a0b0688f
docs: changelog update (#4776)
Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2021-02-14 01:16:41 -05:00
John McLear e585d321f9
tests: timeouts for tests (#4773) 2021-02-13 19:00:06 +00:00
Richard Hansen f9ec49d7ac tests: Improve `/admin/settings` restart test 2021-02-13 10:02:28 +00:00
Richard Hansen ac52fb8a9d express: New `httpUptime` metric 2021-02-13 10:02:28 +00:00
John McLear e22d8dffc0 deps: use ci --no-optional flags, this might break some things as it requires npm 6.31.4 2021-02-13 10:01:36 +00:00
John McLear 483f4344c2
performance: maxAge for favicon and plugin definitions (#4761) 2021-02-13 08:13:48 +00:00
Richard Hansen 09e9c36098 tests: Accept async condition functions for `helper.waitFor()` 2021-02-13 08:12:53 +00:00
Richard Hansen 8dca4cb16f tests: Give `helper.waitFor()` timeout errors a useful stack trace 2021-02-13 08:12:53 +00:00
Richard Hansen 71c1899164 tests: Asyncify tests in `api.js` 2021-02-13 08:12:53 +00:00
Richard Hansen e0f499cf5a tests: Use the supertest agent from `common.js` for `api.js` 2021-02-13 08:12:53 +00:00
Richard Hansen 08124ba733 tests: Delete unnecessary `describe()` calls in `api.js` 2021-02-13 08:12:53 +00:00
Richard Hansen fc9b22475a tests: Always call backend `common.init()` at startup
This provides a place to set the timeout for `common.init()` so that
individual tests don't have to.
2021-02-13 08:12:53 +00:00
Richard Hansen 6953e40c75 tests: Wait for `common.init()` to complete before returning 2021-02-13 08:12:53 +00:00
Richard Hansen 1c8a913411 lint: Delete unnecessary `eslint-disable-line` comment 2021-02-13 08:12:53 +00:00
Richard Hansen d56a02c85a express: Forcibly terminate HTTP connections when restarting
This should make restarts via `/admin` actions (e.g., plugin
installation) more reliable.
2021-02-13 07:37:22 +00:00
John McLear 4c4c7b526d
performance: i18n maxage (#4759) 2021-02-13 02:35:25 -05:00
Richard Hansen 01c83917d1 socket.io: Manually track client connections/disconnections
This change is required for socket.io 3.x because in 3.x
`io.sockets.clients()` no longer returns all client Socket objects.
2021-02-13 07:13:37 +00:00
Richard Hansen 66544be354 lint: `src/tests/backend/specs/api/api.js` 2021-02-13 00:46:30 -05:00
Richard Hansen eb9d5bb470 lint: `src/tests/frontend/helper.js` and friends 2021-02-13 00:46:30 -05:00
Richard Hansen 8f2f6593be lint: Re-run `eslint --fix` 2021-02-13 00:31:36 -05:00
Richard Hansen db8ca2818f lint: Treat `helper.js` and friends as normal browser files
This enables the prefer-arrow/prefer-arrow-functions rule.
2021-02-13 00:29:30 -05:00
John McLear bcd5e36688 tests: backend and frontend tests for image upload 2021-02-12 18:00:47 -05:00
John McLear 55c96e5577 socketio: increase socketio limit to 1MiB 2021-02-12 17:56:50 -05:00
John McLear fcd9adf20d
tests: admin test timeout increase, bugfix and removal of buggy test (#4762) 2021-02-12 20:04:42 +00:00
Richard Hansen 73d31b12a8 Minify: Replace deprecated `url.parse()` with `new URL()` 2021-02-12 07:08:51 +00:00
Richard Hansen 7efca7dc7d Minify: Don't ignore request headers in `requestURI()` 2021-02-12 07:08:51 +00:00
Richard Hansen 7a003cb9e2 Minify: Let Express render the 500 error page 2021-02-12 07:08:51 +00:00
Richard Hansen 44e420b6c5 Minify: Return `Date` objects from `statFile()` 2021-02-12 07:08:51 +00:00
Richard Hansen aa11667ff7 Minify: Use `fs.promises` 2021-02-12 07:08:51 +00:00
Richard Hansen 073052ac66 Minify: Asyncify `minify()` 2021-02-12 07:08:51 +00:00
Richard Hansen 3eefe71834 Minify: Don't set cache headers if `statFile()` causes 500 2021-02-12 07:08:51 +00:00
Richard Hansen 84190793dc Minify: Asyncify `getFileCompressed()` 2021-02-12 07:08:51 +00:00
Richard Hansen dd7ea1a8f9 Minify: Asyncify `statFile()` 2021-02-12 07:08:51 +00:00
Richard Hansen 947dc8eeed Minify: Asyncify `getFile()` 2021-02-12 07:08:51 +00:00
Richard Hansen 5d7c07e81c Minify: Asyncify `lastModifiedDateOfEverything()` 2021-02-12 07:08:51 +00:00
Richard Hansen e573276755 Minify: Asyncify `getAceFile()` 2021-02-12 07:08:51 +00:00
Richard Hansen 5cc191f185 Minify: Replace `async.forEach()` with `Promise.all()` 2021-02-12 07:08:51 +00:00