Richard Hansen
89fe40e080
Changeset: Migrate from OpIter
to deserializeOps()
2021-11-23 01:21:49 -05:00
Richard Hansen
f1eb7a25a6
Changeset: Migrate to the new attribute API
2021-11-21 04:11:41 -05:00
Richard Hansen
ae1741c25b
PadMessageHandler: Add missing parseNum()
for attribute lookup
2021-11-20 01:24:30 -05:00
Richard Hansen
a052580bd1
PadMessageHandler: Stop the USER_CHANGES timer on exception
2021-11-20 01:24:30 -05:00
Richard Hansen
97e382e5d2
PadMessageHandler: Move USER_CHANGES processing inside try
...
This improves the accuracy of the timing stats, and it simplifies
error handling.
2021-11-20 01:24:30 -05:00
Richard Hansen
b1c1501e1e
PadMessageHandler: Use object destructuring
2021-11-20 01:24:30 -05:00
Richard Hansen
e961718ff2
PadMessageHandler: Improve error logging
...
Use a log4js logger instead of `console`, and clean up some of the log
messages.
2021-11-20 01:24:30 -05:00
Richard Hansen
1447ab8899
PadMessageHandler: Factor out common USER_CHANGES error message formatting
2021-11-20 01:24:30 -05:00
Richard Hansen
35b2aeb3b1
PadMessageHandler: Factor out duplicate bad USER_CHANGES handling
...
This also fixes a double-count bug.
2021-11-20 01:24:30 -05:00
Richard Hansen
85919ff914
PadMessageHandler: Replace channels
package with async-friendly class
2021-11-20 01:24:30 -05:00
Richard Hansen
5c1177a3d9
PadMessageHandler: Switch from nodeify to util.callbackify
2021-11-20 01:24:30 -05:00
Richard Hansen
caefd2184a
PadMessageHandler: Don't fire userLeave
if user hasn't joined yet
2021-11-07 01:30:39 -04:00
Richard Hansen
56cb08f4c5
pad: Pass color and display name in CLIENT_READY
2021-11-05 18:14:27 -04:00
Richard Hansen
26675c5019
chat: New chatNewMessage
server-side hook
2021-11-01 01:54:29 -04:00
Richard Hansen
4c2f7f9a11
chat: Rename userId
to authorId
, userName
to displayName
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
9aaf781548
PadMessageHandler: Modernize userLeave
hook context properties
2021-10-30 03:07:44 -04:00
Richard Hansen
a6d060d67b
PadMessageHandler: Replace clientReady
hook with new userJoin
hook
2021-10-30 03:07:44 -04:00
Richard Hansen
c98910e1c5
PadMessageHandler: Populate session info as early as possible
2021-10-30 03:07:44 -04:00
Richard Hansen
b7de24c85f
PadMessageHandler: Fix readability of duplicate user check
2021-10-30 03:07:44 -04:00
Richard Hansen
00e7b04518
PadMessageHandler: Improve readability of changeset loading
2021-10-30 03:07:44 -04:00
Richard Hansen
50b9e0df1f
PadMessageHandler: Use values from session info object
...
This is more consistent with the rest of the code, and it provides a
single source of truth.
2021-10-30 03:07:40 -04:00
Richard Hansen
10e930408c
PadMessageHandler: Delete unnecessary CLIENT_READY checks
...
The checks are already performed by the security manager.
2021-10-30 03:06:57 -04:00
Richard Hansen
0992f19570
PadMessageHandler: Improve readability of historical author fetch
2021-10-30 03:06:57 -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
Richard Hansen
ce730b0493
PadMessageHandler: Inline createSessionInfoAuth()
...
This function is only used once so it doesn't need to be separate.
2021-10-30 03:06:57 -04:00
Richard Hansen
fa54dc1053
PadMessageHandler: Run the clientReady
hook asynchronously
2021-10-30 03:06:57 -04:00
Richard Hansen
5d30e0b1b2
PadMessageHandler: Run the userLeave
hook asynchronously
2021-10-30 03:06:57 -04:00
Richard Hansen
f2a118b311
PadMessageHandler: Inline unnecessary variables
...
Also delete some unneccessary comments.
2021-10-30 03:06:15 -04:00
Richard Hansen
7522d76c40
PadMessageHandler: Invert condition to improve readability
2021-10-30 03:03:19 -04:00
Richard Hansen
a3b4d985ac
lint: Fix awkward string formatting
2021-10-30 03:03:19 -04:00
Richard Hansen
5cbbcbcee6
pad: Simplify reload after .etherpad
import
...
The old "switch to pad" logic looked buggy, and it complicates pad
initialization. Forcing a refresh after importing an `.etherpad` file
isn't much of a UX downgrade.
2021-10-29 19:27:33 -04:00
Richard Hansen
d8cbd134d3
PadMessageHandler: Improve readability
2021-10-07 19:53:40 -04:00
Richard Hansen
044f6543a5
lint: Fix ESLint errors (mostly camelcase warnings)
2021-10-07 19:53:40 -04:00
Richard Hansen
c83bb058d1
PadMessageHandler: Fix stats null dereference
...
It is possible for the stats to be read before the
`expressCreateServer` hook is called (in particular: when there is an
error during startup), which is when the `socketio` variable is set.
Check for non-null `socketio` before attempting to count the number of
socket.io connections.
2021-07-22 13:07:03 -04:00
Richard Hansen
53cca5a743
PadMessageHandler: Also send USER_NEWINFO
messages on reconnect
...
Now the user list is correct after a reconnect. This also allows
ep_webrtc to automatically recover after a temporary network glitch.
2021-06-16 01:35:25 -04:00
Richard Hansen
b040ebf419
Revert "PadMessageHandler: Use a Map
for sessioninfos
"
...
Switching to a Map broke ep_webrtc and maybe other plugins.
This reverts commit eeead46437
.
2021-05-05 18:09:10 -04:00
Richard Hansen
eeead46437
PadMessageHandler: Use a Map
for sessioninfos
...
Maps are a bit more flexible, have clearer semantics, and have a
convenient `size` property.
2021-05-03 01:35:11 -04:00
Richard Hansen
14d4aadfe4
PadMessageHandler: Parallelize client updates
...
Multiple clients are updated in parallel, but multiple revisions sent
to a particular client are still sent sequentially.
2021-05-03 01:35:11 -04:00
Richard Hansen
770755debf
PadMessageHandler: Assume sessioninfo stays valid during client update
...
...but add a try/catch around the message transmission just in case.
2021-05-03 01:35:11 -04:00
Richard Hansen
c85391862b
PadMessageHandler: Avoid unnecessary property lookups
2021-05-03 01:35:11 -04:00
Richard Hansen
d5c6a44d9c
PadMessageHandler: Improve documentation of sessioninfos
2021-05-03 01:35:11 -04:00
Richard Hansen
4c4415e14a
PadMessageHandler: Register activePads
metric only once
2021-05-03 01:35:11 -04:00
pcworld
3c71e8983b
Fix read only pad access with authentication
...
Before this commit, webaccess.checkAccess saved the authorization in
user.padAuthorizations[padId] with padId being the read-only pad ID,
however later stages, e.g. in PadMessageHandler, use the real pad ID for
access checks. This led to authorization being denied.
This commit fixes it by only storing and comparing the real pad IDs and
not read-only pad IDs.
This fixes test case "authn user readonly pad -> 200, ok" in
src/tests/backend/specs/socketio.js.
2021-04-12 22:51:06 -04:00
Richard Hansen
1ad134a538
PadMessageHandler: Improve logging of pre-CLIENT_READY drops
...
This should make it easier to see what is emitting the the messages so
it can be fixed.
2021-04-09 18:43:02 +02:00
Richard Hansen
392d9dcfde
PadMessageHandler: Fix fetching of socket.io Sockets for a pad
2021-02-27 08:46:49 +00:00
Richard Hansen
9cd67cd990
PadMessageHandler: Delete unnecessary use of Promise.then()
2021-02-27 08:46:49 +00:00
John McLear
5201cb717f
lint: PadMessageHandler.js
2021-02-21 21:06:38 -05:00
Richard Hansen
00d45e3229
Defer rate limiter creation to a hook call
...
This makes it possible to change the rate limiter settings via
`/admin/settings` or by modifying the appropriate settings object and
reinvoking the hook.
2021-02-16 21:13:35 -05:00
Richard Hansen
8f2f6593be
lint: Re-run eslint --fix
2021-02-13 00:31:36 -05:00