Commit graph

308 commits

Author SHA1 Message Date
Richard Hansen
daee90d2af lint: Close function args on same line as final arg 2022-02-21 14:53:48 -05:00
Richard Hansen
c8211f2898 lint: Run eslint --fix 2022-02-21 14:36:58 -05:00
Richard Hansen
aa286b7dbd API: Add optional authorId param to mutation functions 2022-02-19 14:55:42 -05:00
Richard Hansen
50fafe608b tests: Basic test for restoreRevision API 2022-02-19 14:55:42 -05:00
Richard Hansen
945e6848e2 SessionStore: Delete DB record when session expires
This only deletes records known to the current Etherpad instance --
old records from previous runs are not automatically cleaned up.
2022-01-17 21:45:56 -05:00
Richard Hansen
72cd983f0f SessionStore: Option to update DB record on touch() 2022-01-17 21:45:52 -05:00
Richard Hansen
b991948e21 SessionStore: Don't write DB record if already expired 2022-01-17 21:33:58 -05:00
Richard Hansen
4d498725c7 SessionStore: Improve cookie expiration check
* Don't mutate `sess.cookie.expires`.
  * Allow `sess.cookie` to be nullish.
  * Always compare `Date` objects.
2022-01-17 18:17:40 -05:00
Richard Hansen
928c598ecf tests: Add SessionStore backend tests 2022-01-17 17:51:08 -05:00
Richard Hansen
d3984aa621 express: Move preAuthorize hook after express-session
The `ep_openid_connect` plugin needs access to session state before
authorization checks are made (to securely redirect the user back to
the start page when authentication completes). Now that the
`expressPreSession` hook exists, the rationale for moving
`preAuthorize` before the `express-session` middleware is gone.

This change undoes the following commits:
  * bf35dcfc50
  * 0b1ec20c5c
  * 30544b564e
2022-01-14 00:44:54 -05:00
Richard Hansen
6495b1e6f4 tests: Disable deprecation warnings when testing deprecated functions 2021-12-31 22:15:03 -05:00
Richard Hansen
c0471dd238 tests: Avoid deprecated Changeset.opIterator 2021-12-31 22:14:07 -05:00
webzwo0i
0af728ffee textLinesMutator: coverage for changed attributes in multiline keeps 2021-12-30 18:44:29 -05:00
webzwo0i
93447b7493 easysync tests: cover more string operation scenarios 2021-12-30 18:44:29 -05:00
webzwo0i
55c47efd4c easysync tests: add some more smartOpAssembler tests 2021-12-30 18:44:29 -05:00
Richard Hansen
02a56dc58c PadMessageHandler: Allow handleMessageSecurity to grant one-time write access 2021-12-21 17:23:56 -05:00
Richard Hansen
696f9c3367 specialpages: New /health endpoint for health checking
This endpoint is intended to conform with:
https://www.ietf.org/archive/id/draft-inadarei-api-health-check-06.html
2021-12-21 17:19:56 -05:00
Richard Hansen
649fbdccf5 express: Move static handlers to expressPreSession
This avoids the need to exempt the paths from authentication checks,
and it eliminates unnecessary express-session state.
2021-12-20 20:08:19 -05:00
Richard Hansen
472eddc821 webaccess: Skip checks if next is called in preAuthenticate 2021-12-20 20:08:18 -05:00
Richard Hansen
fc498f0ae6 tests: Delete test pad before attempting import 2021-12-20 20:08:18 -05:00
Richard Hansen
02d1b90d30 tests: Factor out USER_CHANGES/ACCEPT_COMMIT helpers
This will make it possible for other tests to reuse the code.
2021-12-19 16:53:24 -05:00
Richard Hansen
748d661495 Changeset: Fix off-by-one bug in makeSplice 2021-12-16 00:48:07 -05:00
Richard Hansen
cff089e54e PadMessageHandler: Accept retransmissions of USER_CHANGES 2021-12-14 01:02:00 -05:00
Richard Hansen
a370cfa5c6 Pad: Don't create no-op revisions 2021-12-14 01:02:00 -05:00
Richard Hansen
dbacc73c36 tests: Basic USER_CHANGES backend tests 2021-12-14 01:02:00 -05:00
John McLear
6cca27dea6 API: getText with old revision should only return text, not atext
Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2021-12-05 18:50:39 -05:00
Richard Hansen
6beb5dcaf5 tests: Disable deprecation warnings when testing deprecated functions 2021-11-30 23:17:35 -05:00
Richard Hansen
a02e45499d Use the new AttributeMap and Changeset APIs 2021-11-28 23:47:27 -05:00
Richard Hansen
f00b1ae89b Merge branch 'master' into develop 2021-11-28 23:10:45 -05:00
Richard Hansen
19909eae53 ImportEtherpad: Rigorously check imported data 2021-11-28 22:28:55 -05:00
Richard Hansen
23f8a12922 ImportEtherpad: Don't make any changes if data is bad 2021-11-28 22:28:55 -05:00
Richard Hansen
a2e77a7128 ImportEtherpad: Enforce single-pad records 2021-11-28 22:28:54 -05:00
Richard Hansen
00fc7c8e86 ImportEtherpad: Reject unknown DB records 2021-11-28 22:27:44 -05:00
Richard Hansen
fea7948b05 ImportEtherpad: Fix author info processing 2021-11-28 19:00:44 -05:00
Richard Hansen
777d045246 GroupManager: Clean up any mappings when deleting a group 2021-11-28 14:06:47 +00:00
webzwo0i
0983985dd5 easysync tests: Split into multiple files 2021-11-23 21:07:08 -05:00
webzwo0i
617515bcbb easysync tests: Group related tests 2021-11-23 21:07:08 -05:00
webzwo0i
310444f5d3 easysync tests: Rename tests 2021-11-23 21:07:08 -05:00
webzwo0i
ec3833ab66 easysync tests: Convert IIFE into a describe() 2021-11-23 21:07:08 -05:00
Richard Hansen
6a7b54313f easysync tests: Move shared helper functions to the top
This will make it easier to split `easysync.js` into multiple files.
2021-11-23 21:07:08 -05:00
Richard Hansen
89fe40e080 Changeset: Migrate from OpIter to deserializeOps() 2021-11-23 01:21:49 -05:00
Richard Hansen
657492e191 Changeset: Turn newOp() into a real class 2021-11-23 01:21:12 -05:00
Richard Hansen
fba0bb6dff Changeset: Turn textLinesMutator() into a real class 2021-11-23 01:21:12 -05:00
Richard Hansen
dab881139d Pad: Fix copyPadWithoutHistory apool corruption bug 2021-11-22 18:40:22 -05:00
Richard Hansen
ed78b56079 tests: Refine copyPadWithoutHistory tests 2021-11-22 18:40:22 -05:00
Richard Hansen
d74dd235a4 Changeset: Replace appendATextToAssembler() with a generator 2021-11-22 18:10:37 -05:00
Richard Hansen
f1eb7a25a6 Changeset: Migrate to the new attribute API 2021-11-21 04:11:41 -05:00
Richard Hansen
f40d285109 tests: Refine contentcollector tests 2021-11-21 04:11:41 -05:00
Richard Hansen
6cf2055199 Changeset: New API to simplify attribute processing 2021-11-21 04:11:41 -05:00
Richard Hansen
4a65c2c8ff Changeset: Unexport unnecessarily exported functions
These functions aren't used outside of this file.
2021-11-13 17:44:38 -05:00
Richard Hansen
263105d185 tests: Remove overly aggressive timeouts 2021-11-13 03:05:38 -05:00
Richard Hansen
3c6aef11bd lint: Add 'use strict'; 2021-11-13 03:02:40 -05:00
Richard Hansen
26675c5019 chat: New chatNewMessage server-side hook 2021-11-01 01:54:29 -04:00
Richard Hansen
23a98e5946 tests: Refactor waitForSocketEvent() to improve readability 2021-11-01 01:54:29 -04:00
Richard Hansen
3132235f2c tests: Rename getSocketEvent() to waitForSocketEvent() 2021-11-01 01:54:29 -04:00
Richard Hansen
65bd597053 tests: Move socket.io connection helpers to common.js 2021-11-01 01:54:28 -04:00
Richard Hansen
bea57ff249 tests: Use logger variable for consistency 2021-11-01 01:54:28 -04:00
Richard Hansen
9fbd2e5c3d chat: New chatSendMessage client-side hook 2021-11-01 01:54:28 -04:00
Richard Hansen
0f47ca9046 chat: Plumb message object end to end
This will make it possible for future commits to add hooks that allow
plugins to augment chat messages with arbitrary metadata.
2021-11-01 01:54:28 -04:00
Richard Hansen
f1f4ed7c58 chat: Allow chatNewMessage hook to control rendering 2021-11-01 01:54:28 -04:00
Richard Hansen
2597b940f4 chat: Give chatNewMessage hook access to the raw message object 2021-11-01 01:54:28 -04:00
Richard Hansen
fc5a3f553d chat: Test processing in chatNewMessage hook 2021-11-01 01:54:28 -04:00
Richard Hansen
e471cb12e6 tests: Also spy on initially loaded chat messages 2021-11-01 01:54:28 -04:00
Richard Hansen
66a8c48fac tests: Save the CHAT_MESSAGE payload, not the wrapper 2021-11-01 01:54:28 -04:00
Richard Hansen
c8e0916e1a tests: Spy on socket.io messages as early as possible 2021-11-01 01:54:28 -04:00
Richard Hansen
e28c9ffc97 tests: Support injecting hook functions during pad load 2021-11-01 01:54:28 -04:00
Richard Hansen
c8e544ec8d tests: Fix handling of nullish module definitions 2021-11-01 01:54:28 -04:00
Richard Hansen
d36a37d666 PadMessageHandler: Delete unnecessary protocolVersion
We can assume that the client code is always in sync with what the
server expects.
2021-10-30 03:06:57 -04:00
webzwo0i
63de249236 tests: do not re-add identical text with setText 2021-10-29 02:29:45 -04:00
Richard Hansen
4f283b64cf tests: easysync: Inline some functions that are only used once 2021-10-17 00:49:34 +02:00
Richard Hansen
e535129f3c tests: easysync: Use expect.js for checks 2021-10-17 00:49:34 +02:00
Richard Hansen
ebb7dfabd7 tests: easysync: Use mocha describe() and it() 2021-10-17 00:49:34 +02:00
Richard Hansen
2c7d0604c3 tests: easysync: Remove unnecessary Random class 2021-10-17 00:49:34 +02:00
Richard Hansen
8dd61f847e tests: easysync: Fix some ESLint errors 2021-10-17 00:49:34 +02:00
Richard Hansen
59a6a9f6a0 tests: easysync: Delete commented-out and unused code 2021-10-17 00:49:34 +02:00
Richard Hansen
428736cdc3 tests: easysync: Run with the frontend tests 2021-10-17 00:49:34 +02:00
Richard Hansen
0ea6f1518c tests: Remove overly agressive timeouts 2021-10-07 20:31:54 -04:00
Richard Hansen
2155e216a6 tests: Remove overly agressive timeouts 2021-10-07 19:53:03 -04:00
Richard Hansen
e8514db365 tests: Replace manual checks with assert 2021-10-03 20:23:30 -04:00
Richard Hansen
72b12bc97b tests: Slight backend test reorganization
* Delete some useless uses of `describe()`
  * Combine some dependent tests
  * Rename some tests to avoid duplicate names
2021-10-03 20:06:33 -04:00
Richard Hansen
dd37251da4 tests: Promisify some backend tests 2021-10-03 19:25:50 -04:00
Richard Hansen
39a971e3b9 tests: Remove overly aggressive timeouts 2021-10-03 19:25:50 -04:00
John McLear
c361df52d2 bugfix: Allow selection to start/end before line marker 2021-10-02 02:41:58 -04:00
webzwo0i
0de41ee087 adminsettings test: Fix save detection race condition
Use MutationObserver to detect if a saveProgress event was received,
which will trigger an animation.

Before this, `helper.admin$('#response').is(':visible')` was true
after the page loaded and before clicking the Save button, so there
was a possibility that after clicking Save, but before sending the
socketio message to the server, the visibility is checked and returns
true, so the page gets reloaded before the changed settings have been
saved.
2021-09-29 23:49:16 -04:00
webzwo0i
bb0ca91dc2 adminupdateplugins test: swap assertions, increase timeout 2021-09-29 23:49:16 -04:00
webzwo0i
91d3974a0d adminsettings test: Be a little stricter for some assertions 2021-09-29 23:46:25 -04:00
webzwo0i
cc6fda6916 adminsettings test: Fix restart detection
We cannot guarantee that the system time on SauceLabs and Github is in
sync. In case the SauceLabs runner's clock is slow the test would have
failed.
2021-09-29 23:42:41 -04:00
Richard Hansen
653dbb3449 tests: Wait for pad init before returning from helper.aNewPad()
This should make it easier to avoid race conditions.
2021-09-28 04:18:24 -04:00
Richard Hansen
15f17b5237 tests: Avoid deprecated Builder.withCapabilities() method 2021-09-15 19:42:11 -04:00
Richard Hansen
70c16bb1b5 tests: Check import of export of read-only pad ID 2021-09-15 18:32:06 -04:00
John McLear
b683dc300d tests: Check for leak of read-write pad ID when exporting 2021-09-15 18:32:06 -04:00
Richard Hansen
0f5a4bd1f8 tests: Restructure read-only pad export tests
This also adds coverage for `.etherpad` exports.
2021-09-15 18:32:06 -04:00
Richard Hansen
bc9cdd6957 SocketIORouter: Add acknowledgement support 2021-09-06 14:45:26 -04:00
Richard Hansen
9f9adb369b SocketIORouter: Don't crash if message handler throws 2021-09-06 14:45:26 -04:00
Richard Hansen
320e5c1109 SocketIORouter: Add unit tests 2021-09-06 14:45:26 -04:00
Richard Hansen
348bc0c269 tests: Delete overly aggressive timeouts
See https://github.com/ether/etherpad-lite/issues/4988 for rationale.
2021-08-30 02:02:37 -04:00
Richard Hansen
7dbd278d1d deps: Bump js-cookie to 3.0.0 2021-08-29 23:36:48 -04:00
Richard Hansen
c816c20bc7 HTML import: Replace cheerio with jsdom to simplify contentcollector
Cheerio provides jQuery-like objects but they wrap DOM Node-like
objects that are not 100% API compatible with the DOM spec. Because of
this, contentcollector, which is used in browsers and in Node.js
during HTML import, has until now needed to support two different
APIs. This commit modifies HTML import to use jsdom instead of cheerio
and simplifies contentcollector.
2021-08-12 13:53:23 -04:00
Richard Hansen
d723270388 tests: Improve readability of multipleUsers.js
* Define utility functions above their use to silence lint warnings.
  * Use `.css()` instead of `.attr('style')` to manipulate style.
  * Pass an object to `.attr()` rather than call once per attribute.
  * Take advantage of chaining.
  * Inline unnecessary `padUrl` variable.
  * Delete some unnecessary comments.
2021-07-25 02:23:50 +02:00
Richard Hansen
ff39eeafca tests: Factor out duplicate getFrameJQuery() 2021-07-25 02:23:50 +02:00