Commit graph

4139 commits

Author SHA1 Message Date
Richard Hansen
b164a34e64 lint: Fix ESLint error in helper/methods.js 2021-04-02 15:46:27 +02:00
Richard Hansen
62403159df tests: Invert conditions to improve readability 2021-04-02 15:46:27 +02:00
Richard Hansen
dd9c08d821 tests: Wait for commit rather than sleep 2021-04-01 14:31:56 +02:00
Richard Hansen
2776946627 tests: Use cookie libraries to manipulate cookies 2021-04-01 14:31:56 +02:00
Richard Hansen
202d65d2bb pad_cookie: Re-read prefs cookie on every call to getPref()
This makes it easier to write tests that clear the prefs cookie.
2021-04-01 14:31:56 +02:00
Richard Hansen
0df41a9a78 pad_cookie: Move initial cookie read+save to init()
Benefits of this change:
  * It avoids race conditions with tests that clear cookies.
  * Any attempt to get or set a value before `init()` is called will
    throw an error, ensuring the API is used properly.
  * Improved readability: It's easier to understand what the
    `pad.noCookie` check is doing.
2021-04-01 14:31:56 +02:00
Richard Hansen
aeee5c0b69 tests: Fix cookie name in helper.js tests 2021-04-01 14:31:56 +02:00
Richard Hansen
137fa89d2a tests: Always set cookie path to / (to match non-test behavior) 2021-04-01 14:31:56 +02:00
Richard Hansen
5666c34061 tests: Fix encoding of prefs cookie 2021-04-01 14:31:56 +02:00
Richard Hansen
63e6e163b7 tests: Promisify some of the helper.js tests 2021-04-01 14:31:56 +02:00
Richard Hansen
701a40ac13 tests: Promisify multiple_authors_clear_authorship_colors.js 2021-04-01 14:31:56 +02:00
Richard Hansen
8b43f9eb5f tests: Promisify authorship_of_editions.js 2021-04-01 14:31:56 +02:00
Richard Hansen
056939cd22 tests: Refine helper/multipleUsers.js
* Rename "current"/"other" to "user0"/"user1".
  * Delete unnecessary `_createTokenFor*` functions.
  * Rename helper functions to remove unnecessary leading underscore
    and for brevity.
  * Use jQuery's `.attr()` to build the second iframe.
  * Use js-cookie to manipulate the token cookie.
  * Don't attempt to set the token cookie if the pad isn't loaded.
  * Use the token generated by the pad.
  * Only clear the token cookie at path=/.
2021-04-01 14:31:56 +02:00
Guilherme Goncalves
f2034ad368 tests: Add regression tests for character composition race
See: https://github.com/ether/etherpad-lite/issues/4978
2021-03-30 16:42:53 -04: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
snyk-bot
dd09a3f12b fix: src/package.json & src/package-lock.json to reduce vulnerabilities
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-UNDERSCORE-1080984
2021-03-30 18:26:32 +02:00
Richard Hansen
b9753dcc71 Changeset: Return a new op object by default when iterating
Reusing the same op object for each iteration can result in very weird
behaviors because previously yielded op objects will get a surprise
mutation.

It is unclear why the code was written to reuse the same object. There
was no comment, nor is there a commit message providing rationale (it
has behaved this way since the very first commit). Perhaps the objects
were reused to improve performance (fewer object allocations that need
to be garbage collected). I do expect this change to reduce
performance somewhat, but not enough to warrant reverting this commit.
2021-03-29 18:42:55 -04:00
Richard Hansen
718da6fc1b tests: New helper.aNewPad() (promisified newPad()) 2021-03-29 18:40:05 -04:00
Richard Hansen
ec76a6548f tests: Make the helper.newPad() callback optional 2021-03-29 18:40:05 -04:00
Richard Hansen
27b35699ea tests: Fix helper.newPad() retries
* Pass retry count in options object so that each pad has its own
    retry count.
  * Delete useless `origPadName` variable.
2021-03-29 18:40:05 -04:00
translatewiki.net
eac5a52690 Localisation updates from https://translatewiki.net. 2021-03-29 17:55:09 +02:00
John McLear
b80f5bdae8
bugfix/tests/scaling: Socket query test fix (#4974)
fix socketio test where res.req is not available.
2021-03-24 21:03:48 +00:00
John McLear
2b98b930d7
scaling: include padId in socketio query string 2021-03-24 16:07:11 +00:00
webzwo0i
3ae6b01518 bump version 2021-03-22 16:17:18 +01:00
webzwo0i
65b644498f bump require-kernel dependency 2021-03-21 18:30:39 +00:00
John McLear
a8f9c2b6a7
fix: upgrade express-rate-limit from 5.2.5 to 5.2.6 (#4938)
Snyk has created this PR to upgrade express-rate-limit from 5.2.5 to 5.2.6.

See this package in npm:
https://www.npmjs.com/package/express-rate-limit

See this project in Snyk:
https://app.snyk.io/org/johnmclear/project/d9a12bfb-7ccd-443f-9e22-f30d339cc8c5?utm_source=github&utm_medium=upgrade-pr

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
2021-03-20 17:45:00 -04:00
Richard Hansen
eb3cff5b3a LibreOffice: Remove unnecessary callbackification
`async.queue` will do the right thing if passed an `async` function.
2021-03-20 20:29:55 +00:00
Richard Hansen
0233399fdf Abiword: Avoid calling stdoutCallback multiple times 2021-03-20 20:29:55 +00:00
webzwo0i
c208d50c4a add version string to iframe_editor.css 2021-03-20 16:42:08 +00:00
webzwo0i
b250ceaae7 add test for wrong clientHeight 2021-03-20 16:41:15 +00:00
Richard Hansen
3ad1d0a74f cssmanager: Refactor CSS manager creation to avoid race condition
Safari takes a while to initialize `document.styleSheets`, which
results in a race condition when loading the pad. Avoid the race
condition by accessing the CSSStyleSheet objects directly from the
HTMLStyleElement DOM objects.
2021-03-20 01:07:16 +00:00
Richard Hansen
e2bfe2fd10 pad_editor: Promisify init() 2021-03-20 01:07:16 +00:00
Richard Hansen
81e36cf3c7 Ace2Inner: Promisify init() 2021-03-20 01:07:16 +00:00
Richard Hansen
742a7cd430 cssmanager: Throw if no matching style sheet is found
This avoids a later null dereference when the stack trace isn't as
useful.
2021-03-20 01:07:16 +00:00
Richard Hansen
5b05ee79ff cssmanager: Simplify iteration over style sheets 2021-03-20 01:07:16 +00:00
Richard Hansen
cb9f6d6776 ace: Use iframe srcdoc property to refine frame load logic
This seems to fix "null is not an object (evaluating
'browserSheet.insertRule')" errors on Safari.
2021-03-19 17:06:58 +01:00
Richard Hansen
b4e1e935e2 LibreOffice: Log conversion errors 2021-03-18 09:02:28 +00:00
Richard Hansen
b2c0837cf5 import/export: Promisify Abiword and LibreOffice conversion 2021-03-18 09:02:28 +00:00
Richard Hansen
b321267e66 LibreOffice: Use the async-provided callback to signal errors
This avoids having two callbacks, which improves readability.
2021-03-18 09:02:28 +00:00
Richard Hansen
b914a46a87 LibreOffice: Use async.series to properly handle conversion errors 2021-03-18 09:02:28 +00:00
Richard Hansen
a6d5611c80 LibreOffice: Use consistent intermediate filename 2021-03-18 09:02:28 +00:00
Richard Hansen
ad0be9d1d2 LibreOffice: Add missing fileExtension property on intermediate step 2021-03-18 09:02:28 +00:00
Richard Hansen
5eab3a123d Abiword: Use the async-provided callback to signal errors
This avoids having two callbacks, which improves readability.
2021-03-18 09:02:28 +00:00
Richard Hansen
8d32463915 Abiword: Fix logging of conversion failure 2021-03-18 09:02:28 +00:00
Richard Hansen
f015f59cfc Abiword: Reduce log spam 2021-03-18 09:02:28 +00:00
Richard Hansen
259ee4a987 Abiword: Don't call the callback if null 2021-03-18 09:02:28 +00:00
Richard Hansen
83f39289aa import/export: On export error return 500 instead of crashing 2021-03-18 09:02:28 +00:00
Richard Hansen
3a11e97758 import/export: Spelling fix: "convertor" -> "converter" 2021-03-18 09:02:28 +00:00
Richard Hansen
50fdadab7d ExportHandler: Pass the error unmodified 2021-03-18 09:02:28 +00:00
Richard Hansen
216aecd433 import/export: Use Error objects for errors, not strings 2021-03-18 09:02:28 +00:00
Richard Hansen
59c167e31b ExportHandler: Replace unnecessary exception with return 2021-03-18 09:02:28 +00:00
Richard Hansen
785b7d2b44 Abiword: Reset stdout buffer when starting abiword 2021-03-18 09:02:28 +00:00
Richard Hansen
b6c2586920 import/export: Delete unnecessary comments 2021-03-18 09:02:28 +00:00
Richard Hansen
fe1eceb6b5 tests: Use assert to simplify import/export tests 2021-03-18 09:02:28 +00:00
Richard Hansen
98c42d6076 tests: Promisify import/export tests 2021-03-18 09:02:28 +00:00
Richard Hansen
ff50682412 tests: Increase import/export test timeouts 2021-03-18 09:02:28 +00:00
translatewiki.net
5c9514f926 Localisation updates from https://translatewiki.net. 2021-03-15 19:03:09 +01:00
Richard Hansen
c5a37d7a92 deps: Bump ueberdb2 to get MySQL improvements 2021-03-13 19:51:43 +00:00
webzwo0i
6f591b5c77
add class pad to timeslider to fix height issue (#4941) 2021-03-12 21:16:22 -05:00
webzwo0i
8e2a21ec84
arrow functions dont have arguments (#4943) 2021-03-12 14:25:14 -05:00
Richard Hansen
0b9bf4a78e deps: Update ueberdb2 to get updated metrics 2021-03-11 20:21:38 +00:00
Richard Hansen
9b82d1d37d server: Log stats (metrics) on fatal error
This might help users troubleshoot rare crashes.
2021-03-11 07:38:44 +00:00
Richard Hansen
d2610284ad bin/safeRun.sh: Fix try: not found bug
This fixes a copy+paste bug introduced in commit
8b28e00784 (v1.8.8).
2021-03-10 02:54:20 -05:00
Richard Hansen
fcf43a7089 stats: Expose ueberDB metrics 2021-03-08 22:32:39 +00:00
Richard Hansen
71dfa7070d deps: Update ueberdb2 to get metrics 2021-03-08 22:32:39 +00:00
Richard Hansen
926f0fcefb CSS: Increase size of contenteditable area 2021-03-08 14:39:18 +00:00
Richard Hansen
404486069c ace: Build the outer and inner iframes programmatically
This makes the code easier to read and it silences Chrome's
`document.write()` warning:
https://developers.google.com/web/updates/2016/08/removing-document-write

This is a redo of commit a17f9bf3cf,
which was reverted in commit 912f0f195f
due to a CSS bug.
2021-03-05 19:31:59 +00:00
webzwo0i
4ca989a255
sessions: add more endpoints that do not need a session (#4921)
* add more endpoints that do not need a session

* Update src/node/hooks/express/webaccess.js

Co-authored-by: Richard Hansen <rhansen@rhansen.org>

* Update src/node/hooks/express/webaccess.js

Co-authored-by: Richard Hansen <rhansen@rhansen.org>

Co-authored-by: John McLear <john@mclear.co.uk>
Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2021-03-05 07:48:33 +00:00
Richard Hansen
60da2373a6 CSS: Add comment to no-skin/pad.css to silence warning
Firefox prints "Style sheet could not be loaded" if the file is empty.
2021-03-05 07:45:48 +00:00
Richard Hansen
5546cc5e7b CSS: Delete bogus <link> tag
Browsers report an error with this tag. Strangely, this tag has
existed since Etherpad's very first commit.
2021-03-05 07:45:48 +00:00
Richard Hansen
470f40d7db CSS: Use auto for iframe body height
This change makes no visual difference right now, but will matter (for
reasons I don't understand) once we change `ace.js` to build the
iframes by constructing elements in JavaScript (vs. writing HTML).
2021-03-05 07:45:48 +00:00
Richard Hansen
48e1d1c23f CSS: Fix class name for outer iframe <html> tag
* Add the class "pad" to the `<html>` tag in `pad.html` (the outer
    iframe's parent).
  * Change the CSS selector that refers to the `<html>` tag in
    `pad.html` from `html:not(.inner-editor)` to `html.pad`.
  * Change the class name of the outer iframe's `<html>` tag from
    "inner-editor" to "outer-editor".
  * Update CSS rules to use the new class name.
2021-03-05 07:45:48 +00:00
John McLear
de394f72a6
bump version 2021-03-05 07:28:44 +00:00
John McLear
5ac90ab30f tests: Allow time for minification to complete
Minification happens after the initial visit and request to pages.
2021-03-05 07:11:42 +00:00
snyk-bot
d0e257d8df fix: upgrade resolve from 1.19.0 to 1.20.0
Snyk has created this PR to upgrade resolve from 1.19.0 to 1.20.0.

See this package in npm:
https://www.npmjs.com/package/resolve

See this project in Snyk:
https://app.snyk.io/org/johnmclear/project/d9a12bfb-7ccd-443f-9e22-f30d339cc8c5?utm_source=github&utm_medium=upgrade-pr
2021-03-05 06:37:45 +00:00
translatewiki.net
21cdf0edaa Localisation updates from https://translatewiki.net. 2021-03-04 13:58:49 +01:00
Richard Hansen
912f0f195f Revert "ace: Build the outer and inner iframes programmatically"
This reverts commit a17f9bf3cf, which
caused a mysterious bug with the line numbers. Revert to avoid
blocking a new release while I figure out the bug.
2021-03-04 02:05:54 +00:00
Richard Hansen
0aad3b74da pluginfw: Improve rendering of hook list
There are two main benefits:
  * HTML is no longer printed in the startup debug logs.
  * `require()` is no longer called on client-side files. This
    eliminates "Failed to load <file> for <plugin>: ReferenceError:
    window is not defined" errors when users visit
    `/admin/plugins/info`.
2021-03-03 11:19:37 +00:00
Richard Hansen
7e698baa80 pluginfw: Improve hook function load error message 2021-03-03 11:19:37 +00:00
John McLear
f95b09e0b6
Import: Import don't show warnings for supported elements 2021-03-02 17:14:47 +00:00
snyk-bot
2fd06535b7 fix: upgrade express-rate-limit from 5.2.3 to 5.2.5
Snyk has created this PR to upgrade express-rate-limit from 5.2.3 to 5.2.5.

See this package in npm:
https://www.npmjs.com/package/express-rate-limit

See this project in Snyk:
https://app.snyk.io/org/johnmclear/project/d9a12bfb-7ccd-443f-9e22-f30d339cc8c5?utm_source=github&utm_medium=upgrade-pr
2021-03-02 06:52:15 +00:00
Richard Hansen
797ffa5600 Minify: Avoid path.relative()
Constructing a relative pathname on Windows is problematic because the
two absolute pathnames might be on different drives (or UNC paths).
Use `path.resolve()` instead of `path.join()` where appropriate to
avoid the need to construct a relative path.
2021-03-02 06:20:10 +00:00
Richard Hansen
8971166c58 lint: Set up Cypress config and fix issues 2021-03-02 05:49:48 +00:00
Richard Hansen
b0862cd030 ace: Delete all $$INCLUDE_CSS logic
The intention of the deleted code was to reduce the number of fetches,
but it only saved a single fetch due to implementation flaws. The
right way to reduce the number of fetches is to use a bundling
technology such as webpack, and this change makes it easier to do so.
2021-03-01 14:32:33 +00:00
Richard Hansen
66d3ac3783 ace: Debug logging 2021-03-01 14:32:33 +00:00
Richard Hansen
a17f9bf3cf ace: Build the outer and inner iframes programmatically
This makes the code easier to read and it silences Chrome's
`document.write()` warning:
https://developers.google.com/web/updates/2016/08/removing-document-write
2021-03-01 14:32:33 +00:00
Richard Hansen
c696732838 ace: Asyncify Ace2Editor.init() 2021-03-01 14:32:33 +00:00
Richard Hansen
159fd5bdeb ace: Simplify passing of editorInfo 2021-03-01 14:32:33 +00:00
Richard Hansen
e57829183d ace: Pass objects to Ace2Inner via function args 2021-03-01 14:32:33 +00:00
Richard Hansen
6fe0154129 ace: Use absolute URLs when building iframes
This isn't strictly necessary right now, but will become
necessary (due to a Safari quirk) when we change to building the
iframes programmatically (vs. the current `document.write()`
approach).
2021-03-01 14:32:33 +00:00
Richard Hansen
9cfc2fb801 ace: Simplify the aceEditorCSS hook map function 2021-03-01 14:32:33 +00:00
Richard Hansen
94c221586c ace: Factor out duplicated $$INCLUDE_CSS code 2021-03-01 14:32:33 +00:00
Richard Hansen
54df7f3728 ace: Delete unused clientVars.disableCustomScriptsAndStyles 2021-03-01 14:32:33 +00:00
Richard Hansen
d84447290e ace: Delete unnecessary IIFE 2021-03-01 14:32:33 +00:00
Richard Hansen
3a311d2182 ace: Lint and simplify script strings 2021-03-01 14:32:33 +00:00