Commit Graph

57 Commits

Author SHA1 Message Date
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 56cb08f4c5 pad: Pass color and display name in `CLIENT_READY` 2021-11-05 18:14:27 -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 7cbb3f565d tests: Speed up `helper.edit()` and `helper.clearPad()` 2021-04-02 15:46:27 +02:00
Richard Hansen 1fdaf95c3b collab_client: Delete unused `NO_COMMIT_PENDING` handling 2021-03-30 16:42:53 -04:00
Richard Hansen 63a1f078f4 collab_client: Redo server message queueing
Move server message queue processing out of `handleUserChanges()` for
the following reasons:
  * Fix a race condition: Before this change the client would stop
    processing incoming messages and stop sending changes to the
    server if a `NEW_CHANGES` message arrived while the user was
    composing a character and waiting for an `ACCEPT_COMMIT` message.
  * Improve readability: The `handleUserChanges()` function is for
    handling changes from the local user, not for handling changes
    from other users.
  * Simplify the code.
2021-03-30 16:42:53 -04:00
Richard Hansen e99fe88537 collab_client: Use `Date.now()` instead of casting a Date object
Also rename the `t` variable to `now` to improve readability.
2021-03-30 16:42:53 -04:00
Richard Hansen 5c445eac21 collab_client: Convert `state` var to `committing` bool 2021-03-30 16:42:53 -04:00
Richard Hansen 3ee6b5eb2b collab_client: Delete unused `caughtErrors` 2021-03-30 16:42:53 -04:00
Richard Hansen 81b9a2544d collab_client: Factor out duplicate `ACCEPT_COMMIT` code 2021-03-30 16:42:53 -04:00
John McLear 1b8cd0747d
Move vendor libraries to /vendors folder and exclude from LGTM 2021-02-21 15:07:39 +00:00
John McLear cf37f52093 lint: collab_client.js 2021-02-21 11:05:25 +00:00
John McLear 4aef15cb11
lint: collab-client (#4574)
* lint: collab-client

* Undo incorrect lint fixes

These will be re-fixed in a future commit.

* Properly fix guard-for-in error

* Properly fix prefer-rest-params errors

* Move some code back to where it was

Moving the code makes it hard to review the diff.

* Delete DISCONNECT_REASON case

Someone reading the code won't understand what "used to handle
appLevelDisconnectReason" means until they dig through the Git
history. Given the server never sends messages of type
DISCONNECT_REASON anyway, just delete the case.

* Refine lint fixes

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2020-12-21 20:19:00 +00:00
Richard Hansen 7e50fc2ab5 Delete dead SERVER_MESSAGE and guest handling code
None of this code seems to be reachable. Hopefully no plugins expect
it to exist.
2020-12-18 09:29:28 +00:00
Richard Hansen 8e5fd19db2 lint: Run `eslint --fix` on `src/` 2020-11-24 20:06:12 +00:00
Richard Hansen 7df3ded66f lint: Put opening brace on same line as `function`
Normally I would let `eslint --fix` do this for me, but there's a bug
that causes:

    const x = function ()
    {
      // ...
    };

to become:

    const x = ()
    => {
      // ...
    };

which ESLint thinks is a syntax error. (It probably is; I don't know
enough about the automatic semicolon insertion rules to be confident.)
2020-11-24 20:06:12 +00:00
Richard Hansen a8cf434d1d import: Replace the `allowAnyoneToImport` check with `userCanModify`
This reduces the number of hoops a user or tool must jump through to
import.
2020-10-05 18:48:16 +01:00
Florian Rittmeier c7581ba6f3
fixes jQuery.Deferred exception as reported in #4132 (#4158) 2020-07-10 15:28:32 +01:00
webzwo0i b7dff552f0
cruft: Remove unecessary consolelogs (#4141) 2020-06-27 20:12:06 +01:00
John McLear 045ac70db8
pluginfw: Make the NEW_CHANGES payload include the message in handleClientMessage 2020-06-12 12:26:33 +01:00
John McLear 208c7a849c pad.html: UI telling the user that a contribution is required before importing
This commit is an integration to 24ee37a38f.
2020-04-22 21:12:49 +02:00
anugu-chegg b4068144c3 Refactor code 2018-04-19 23:23:16 +02:00
anugu-chegg 461ed413b7 Fix few mistakes 2018-04-19 23:23:16 +02:00
anugu-chegg d41e184a3c Send commits missed during the reconnect 2018-04-19 23:23:16 +02:00
anugu-chegg bf05e9ae89 Handle client reconnect properly 2018-04-19 23:23:16 +02:00
anugu-chegg 4265f4175e Handle socketio errors properly 2018-04-19 23:23:16 +02:00
anugu-chegg fb20c26c5f Don't send COMMIT-MESSAGE when socketio connection is not active 2018-04-19 23:23:16 +02:00
Mikk Andresen aab7186486 Fix handleClientMessage_USER_* payloads not containing user info 2015-12-31 14:19:23 +02:00
John McLear 361807e578 console msg should go to window 2015-05-06 00:36:42 +01:00
John McLear 990e14c904 working with a big hack 2015-01-21 14:25:24 +00:00
John McLear 34d6b31c98 some sanity 2015-01-21 13:24:21 +00:00
John McLear a2d22a5764 Merge pull request #2377 from webzwo0i/avoid-global-vairables
declare var outside of loop
2014-12-16 16:18:01 +00:00
webzwo0i 0263d30b37 declare var outside of loop 2014-12-16 17:00:35 +01:00
John McLear cfa3f15f94 Merge pull request #2373 from webzwo0i/avoid-global-vairables
dont make local variables global
2014-12-16 00:41:41 +00:00
webzwo0i 5d15f655f0 dont make local variables global 2014-12-14 22:01:28 +01:00
John McLear 9b66c93d6b swap out jquery browser for bower but expose browser object to all pages also enable minification.. Seems to work well 2014-11-22 19:11:35 +00:00
webzwo0i 1fa8c2a7e6 [collab_client] remove unused function getStats 2013-12-08 17:30:48 +01:00
webzwo0i 6aaf4c4065 [collab_client] remove keys function, which was not used and variable reconnectTimes which was used for some long gone disconnect tracking code 2013-12-08 17:30:25 +01:00
webzwo0i aadcfbb3d1 do not send globalPadId in clientvars - its not used anywhere 2013-12-08 17:29:41 +01:00
webzwo0i 8175af3017 [collab_client] remove socketid because its not used 2013-12-08 17:20:53 +01:00
mluto dfc49df52d use `parent.parent` instead of `top` in `collab_client.js`, since `top` breaks embedding when a pad is embedded (same origin policy) 2013-04-08 22:58:34 +02:00
John McLear 13ad46aa67 a safer approach I think but still be careful 2013-03-16 13:19:12 +00:00
John McLear 994c4ebeed stop the client disconnecting of the server sends out a bad revision #, this is very dangerous, the server really shouldn't be sending the same rev #, we could really do with some strong tests case that cover this. Either way this commit 'resolves' #1510 2013-02-27 19:29:59 +00:00
mluto bc05f9eb0a converted load-more-link to button, added loading-gif, fixed typo 2013-01-07 19:15:55 +01:00
mluto 5f81daed0a Added link to load more chat-messages using new GET_CHAT_MESSAGES 2013-01-07 17:36:03 +01:00
mluto 5592c4b0fe client loads messages using the new client loads messages using new method, getChatMessages restructured and renamed to getLastChatMessages, added GET_CHAT_MESSAGES, getChatMessages restructured and renamed to getLastChatMessages 2013-01-06 16:11:48 +01:00
NAGOYA, Yoshihiko 957a0aa873 fix Pita/etherpad-lite #1032
refact inInternationalComposition
2012-10-12 01:12:15 +09:00
Charlie DeTar afc90604bf Add `userColor` query param to set initial color
Add a URL parameter which sets the initial color for a user, e.g.:

    http://example.com/p/mypad?userColor=%2300ff00

Sanitize the given color value to ensure that it's a valid css value
(could be any supported CSS color format -- #fff, rgba(), "red", etc).

Shortly after rejoining a pad, the server responds with a USER_NEWINFO
message which may contain an old color value; however, this message
arrives after we have set and sent the new color value to the server.
To avoid this race condition, if the query parameter has been set,
ignore the color value in a USER_NEWINFO message which matches our user
ID.
2012-09-15 17:48:04 -04:00
NAGOYA, Yoshihiko 71c9444694 fix for InternationalComposition(e.g., Japanese Input)
moved inInternationalComposition from Ace2Inner to top window
fix bindTheEventHandlers() because ie9 implement CompositionEvent
when inInternationalComposition, NEW_CHANGES msg and ACCEPT_COMMIT msg
are pushed msgQueue.
when handleUserChanges(), apply msgQueue.
2012-09-13 23:37:26 +09:00