Commit Graph

553 Commits

Author SHA1 Message Date
Richard Braakman f1b4206cad Fix crash when client submits changeset based on too-old revision
We had a problem with the server running out of stack space if a client
submitted a changeset based on a revision more than about 1000 revs old.
(944 was our cutoff but yours may vary). This happened in the wild with
about 30 people editing via flaky wifi. A disconnected client would try
to submit a fairly old changeset when reconnecting, and a few minutes
was enough for 30 people to generate that many revs.

The stack kept growing because pad.getRevisionChangeset was being answered
from the cache, so no I/O interrupted the callback chain. (This was seen with
mysql, I don't know about other backends.)

This patch forces a nextTick every 200 revisions to solve this problem.
2012-09-26 03:01:59 +03:00
Richard Braakman e16008b371 Fix sessioninfos race that can cause crash during USER_CHANGES handling
When stress testing etherpad-lite we occasionally got this error:

TypeError: Cannot read property 'author' of undefined
    at /home/etherpad/etherpad-lite/src/node/handler/PadMessageHandler.js:556:47

handleUserChanges was accessing sessioninfos[client.id].author in a callback,
after spending some time in the loop that updates the changeset to the
latest revision. It's possible for a disconnect request to be processed
during that loop so the session might no longer be there.

This patch fixes it by looking up the author at the start of the function.
2012-09-26 03:01:59 +03:00
Marcel Klehr 0c9c1f514f Fix socket.io auth: Use connect to parse signed cookies (migrate to express v3) 2012-09-22 16:03:40 +02:00
Marcel Klehr 0f436d5916 Migrate error handling middleware to express v3 2012-09-22 15:22:15 +02:00
Marcel Klehr 794c3d1afe Set secret on cookieParser (migrate to express v3) 2012-09-22 14:05:41 +02:00
Marcel Klehr 71579d1478 Fix res.send (migrate to express v3) 2012-09-22 13:51:39 +02:00
Chad Weider 622819ba93 Make intialization of Ace2Inner analogous to other page controllers. 2012-09-21 22:09:55 -07:00
Chad Weider 9f5946c942 Reformat Ace2Editor frame boot scripts. 2012-09-21 22:09:55 -07:00
Chad Weider fa65f889ec Consolidate Ace2Editor frame's boot script. 2012-09-21 22:09:55 -07:00
Chad Weider 49915dfeb8 Upgrade to Yajsml with another Windows backslash fix. 2012-09-21 22:09:44 -07:00
Marcel Klehr ff7cf991c9 Upgrade log4js to v0.5 2012-09-21 21:39:08 +02:00
Marcel Klehr 4416210471 Differentiate between http server and express app 2012-09-21 17:12:22 +02:00
Marcel Klehr a72ade4494 Fix async.forEach in MultiSession code 2012-09-19 17:48:26 +02:00
Marcel Klehr b9da0e187e Revert "Fixed foreach loop on session IDs, was breaking EP on single session in cookie."
This reverts commit 443a71bc9c.

	modified:   src/node/db/SecurityManager.js
2012-09-19 17:42:36 +02:00
John McLear 0883043eb9 Merge pull request #1014 from marcelklehr/feature/list-all-groups
Add listAllGroups API endpoint
2012-09-18 15:36:19 -07:00
johnyma22 443a71bc9c Fixed foreach loop on session IDs, was breaking EP on single session in cookie. 2012-09-18 16:30:26 +01:00
John McLear 923b51033b List 12 plugins instead of 4
4 was a bit stingy :)  12 is a bit more friendly from a UX persepctive.
2012-09-18 15:54:08 +02:00
Marcel Klehr f8f002adc0 Add listAllGroups API endpoint
Adds a database key that lists all groups
2012-09-17 23:03:56 +02:00
Charlie DeTar 53113644a0 Require userColor to be valid css hex
The utility functions colorutils.js assume that background colors are in
CSS hex format, so require userColor to do the same, rather than
allowing inputs like "red" and "rgba(...)", to insure that inversion
checks will succeed.
2012-09-17 10:59:12 -04:00
Marcel Klehr bbc8848af3 Still support API endpoints of v1 in v1.1 2012-09-17 16:29:39 +02:00
Charlie DeTar bc6e495e8c Use 'transparent' as reference to validate css
Use 'transparent' instead of 'white' as a reference color for validating
CSS color values.  Presumably, a user setting a userColor wants some
color other than 'transparent' if they are setting it (they could always
duplicate the background's color if not).
2012-09-17 00:19:57 -04:00
Chad Weider a0177e5d3c Remember, the `class` symbol is reserved in some environments.
Fixes issue introduced in 9be69ef258.
2012-09-16 18:07:55 -07: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
John McLear 6f37de2fae Update src/package.json
Bump to v 1.1.2
2012-09-14 17:33:45 +02:00
John McLear e9e3ea305b Merge pull request #992 from gedion/develop
Added hooks and made some ace functions available to editorInfo Object
2012-09-14 04:51:17 -07:00
John McLear ba8177fc6f Merge pull request #999 from lepidum/develop
Fixed international composition issues (e.g., Japanese Input method)
2012-09-14 04:50:08 -07: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
Marcel Klehr ad16c0d0d4 Bump API version to v1.1 2012-09-13 16:13:54 +02:00
johnyma22 c8b6d3b4f3 attempt to put correct init in right place but could be wrong 2012-09-12 19:38:53 +01:00
johnyma22 603f251824 error handling and close is removed in express 3 2012-09-12 19:34:33 +01:00
John McLear d44c7f0bb5 Merge pull request #994 from cweider/parent-plugins
Parent plugins
2012-09-12 04:52:38 -07:00
John McLear 389e0d09b0 Merge pull request #740 from cweider/plugin-cleanup
Plugin cleanup
2012-09-12 04:52:23 -07:00
Chad Weider feeab5c1b2 Fix cache headers for missing files. 2012-09-11 22:27:14 -07:00
Chad Weider b691606c4e Replace ParentRequire hack.
Instead of hacking with the internals of require, make client_plugins aware
and capable of sharing behavior.
2012-09-11 21:16:47 -07:00
Chad Weider 1258ed3a0d Split client and server plugin functionality.
There is virtually no shared code for the client, extract it into its own
module and do away with the switches.
2012-09-11 21:16:47 -07:00
Chad Weider 9394495364 Inject plugins into hooks. 2012-09-11 21:16:47 -07:00
Chad Weider 3631f0ece3 Inject special normalization behavior. 2012-09-11 21:16:47 -07:00
Chad Weider e375b6212a Static functions are static. 2012-09-11 21:16:47 -07:00
Chad Weider b0d71df604 Fix worthless indentation. 2012-09-11 21:16:47 -07:00
Gedion a25feed1c2 fixed indentation 2012-09-11 17:49:58 -05:00
Gedion 3364eb131e fixed comments 2012-09-11 17:02:53 -05:00
Gedion 9be69ef258 fixed plugins 2012-09-11 16:21:14 -05:00
Marcel Klehr d05d587f21 Don't break if there is no session cookie. 2012-09-11 20:59:19 +02:00
John McLear a4bd92c184 Merge pull request #983 from Pita/feature/multiple-api-versions
Add support for multiple api versions
2012-09-11 11:29:24 -07:00
Chad Weider 03bcd07741 Use packaged version of Tinycon. 2012-09-09 18:18:59 -07:00
Chad Weider 1541237654 Use packaged version of UNorm. 2012-09-09 18:18:59 -07:00
Chad Weider 19a7208c97 Clean up requires. 2012-09-09 18:18:59 -07:00
Chad Weider 0da4acfdb5 Use packaged edition of async. 2012-09-09 18:18:59 -07:00
Chad Weider 8e735b0841 Use packaged edition of underscore. 2012-09-09 18:18:59 -07:00
Chad Weider b47f6ae905 Use packaged edition of security module. 2012-09-09 18:18:59 -07:00
Chad Weider c4fa2ecddb Don't prefix libraries that are prefixed by '$'. #hack 2012-09-09 18:18:58 -07:00
Chad Weider 3b40850195 Add index paths in tar processing. 2012-09-09 18:18:58 -07:00
Chad Weider a5653c7192 Clean up tar file processing. 2012-09-09 18:18:58 -07:00
Chad Weider b8faf1f78b Serve libraries from node_modules. 2012-09-09 18:18:58 -07:00
Chad Weider 766c301a44 Only files should be treated as being existant. 2012-09-09 18:13:37 -07:00
John McLear 32b4729305 Merge pull request #987 from cweider/loopback-avoidance
Windows server fixes
2012-09-09 15:50:42 -07:00
Chad Weider a97b83babc Another workaround for Windows paths. 2012-09-09 14:42:32 -07:00
Chad Weider 3b5ea88bf5 If the file was not found this should be nothing. 2012-09-09 14:42:32 -07:00
Chad Weider 3312387b08 Drop embedding of modules.
With loopback removed, embedding concatenated resources doesn't happen. It
was a marginal feature to begin with so it will not be missed.
2012-09-09 14:40:20 -07:00
Marcel Klehr ea0f7cb2e9 Add support for multiple api versions 2012-09-09 18:20:16 +02:00
Gedion c37c48cd12 added hooks and made some functions available to editor info object in ace 2012-09-08 13:45:33 -05:00
Gedion 6d1cba2259 added hooks to contentcollector.js 2012-09-08 12:11:04 -05:00
Gedion a2c8d21240 added hooks to contentcollector.js 2012-09-08 12:03:13 -05:00
John McLear 453b6473a0 Merge pull request #984 from lepidum/develop
Fixed ESC key handling issue of Firefox 15
2012-09-07 06:23:57 -07:00
John McLear 3cbd59c769 Update src/node/db/AuthorManager.js 2012-09-04 22:47:56 +02:00
John McLear 7e79bf3462 Update src/node/handler/APIHandler.js 2012-09-04 17:26:08 +02:00
John McLear 21dcce2296 Update src/node/db/AuthorManager.js 2012-09-04 17:25:19 +02:00
John McLear 40a7b43799 Update src/node/db/API.js 2012-09-04 17:23:33 +02:00
John McLear c5be2eb418 Merge pull request #977 from cweider/loopback-avoidance
Loopback avoidance
2012-09-03 14:56:55 -07:00
Chad Weider 6e796eb5fb Make exception case for require kernel obvious. 2012-09-03 14:41:26 -07:00
Chad Weider 02c22d7b89 Remove loopback from Minify. 2012-09-03 14:38:28 -07:00
Chad Weider 024a26f272 Minify publishes its own mock request thing. 2012-09-03 14:37:26 -07:00
Chad Weider 4413d498d8 Minify is a named function. 2012-09-03 14:35:36 -07:00
John McLear de7934d9fb Merge pull request #958 from Wikinaut/fix-ie8-native-xmlhttp-support-disabled-issues
Fix ie8 native xmlhttp support disabled issues
2012-09-03 06:35:52 -07:00
Marcel Klehr dad83d9b77 Document multi-session cookie feature 2012-09-02 19:51:40 +02:00
NAGOYA, Yoshihiko 55cf1cabb5 fix prevent ESC key patch 2012-08-30 13:24:35 +09:00
NAGOYA, Yoshihiko 521e76ae44 prevent ESC key 2012-08-30 12:00:27 +09:00
Wikinaut 67088e5b7f upd version resolve 2012-08-18 01:03:18 +02:00
Wikinaut e82588c332 use socket.io with jsonp-polling. several browsers tested. fixes IE8 issues 2012-08-18 00:47:13 +02:00
Mark Holmquist f9469ef256 Add in padUsers HTTP API call
I needed the list of users this time, so I got it. There are docs
and everything.
2012-08-17 13:39:16 -07:00
Wikinaut da30c8983a fix issue #955: upd resolve library to 0.2.3 2012-08-17 00:45:02 +02:00
Wikinaut 85f5eb38e4 fix for all IE8 issues when IE8 setting NATIVE XMLHHTP SUPPORT is disabled 2012-08-16 01:00:36 +02:00
Daniel Perez Alvarez 699aa299f8 Normalize inserted text using UNorm
For some reason, the client was sending the server a Unicode-normalized
version of inserted strings. So if for example we inserted the string
'ä' (i.e. \x61\xCC\x88) into the document, what would be sent to the
server would be 'ä' (i.e. \xC3\xA4).

This wouldn't be a problem on its own. BUT JavaScript reports that the
length of the first string is 2, while the length of the second one is
1.

So the command that was being sent to the server was 'Z:1>2*0+1$ä', when
it should really be 'Z:1>1*0+1$ä'. When the `checkRep` method checks the
length of the inserted string, it finds an inconsistency, and
disconnects the client.

We now normalize the inserted string before the command is generated, so
the length is always correct.
2012-08-13 17:09:02 +01:00
Daniel Perez Alvarez 48f1545777 Add Unicode normalization library 2012-08-13 17:06:25 +01:00
John McLear 71d6d520e8 Merge pull request #939 from marcelklehr/fix/group2sessions-bug
Create group2sessions.sessionIDs if it doesn't exist yet.
2012-08-12 09:10:29 -07:00
John McLear a5f6815e65 Merge pull request #899 from marcelklehr/fix/show-onload-errors
Display errors occuring on page load to the user.
2012-08-12 08:55:24 -07:00
John McLear 14c874b80e Merge pull request #903 from marcelklehr/feature/hook-loadSettings2
[API hook] loadSettings
2012-08-12 08:54:31 -07:00
John McLear 85191ca798 Merge pull request #905 from marcelklehr/feature/hook-documentReady
Add a documentReady client hook
2012-08-12 08:54:03 -07:00
John McLear 132278a9d6 Merge pull request #928 from marcelklehr/fix/update-socket-io
Update socket.io
2012-08-12 08:53:18 -07:00
John McLear ba6acd822e Merge pull request #929 from MarkTraceur/hook/http/send-clients-message
Add in an HTTP API call to send a custom message type.
2012-08-12 08:53:07 -07:00
John McLear 1eb63535ca Merge pull request #931 from MarkTraceur/hook/plugin/handleClientMessage
Add in a plugin hook "handleClientMessage_<MSG_NAME>"
2012-08-12 08:52:53 -07:00
John McLear a42b2440ba Merge pull request #943 from gedion/develop
Add a hook for utils/ExportHtml.js
2012-08-12 08:48:10 -07:00
Gedion e9b22e8ac3 fix indentation 2012-08-11 15:44:42 -05:00
gedion 4d11e49878 Update src/node/utils/ExportHtml.js
Added a hook for utils/ExportHtml.js
2012-08-11 13:08:28 -05:00
Gedion df7d7769c8 Added a hook for util/ExportHtml.js 2012-08-11 13:02:01 -05:00
Mark Holmquist 44878bc0a3 Add in a plugin hook "handleClientMessage_<MSG_NAME>"
The new hook will accept only the message named in the hook call.
It will be used primarily for adding new message handlers, but it
can alse be used to handle existing message types.
2012-08-10 09:51:18 -07:00
Marcel Klehr d9d28369b2 Create author2sessions.sessionIDs if it doesn't exist yet. 2012-08-10 16:20:07 +02:00
Marcel Klehr d6a0cfc398 Create group2sessions.sessionIDs if it doesn't exist yet. 2012-08-09 11:15:26 +02:00
Mark Holmquist 3d4fb81796 Add in an HTTP API call to send a custom message type.
You cannot currently send any data with your custom message, but
this patch is just begging for a second one that will allow that.
2012-08-08 10:12:11 -07:00
Marcel Klehr cb0066f7b4 Update socket.io 2012-08-07 19:40:45 +02:00