Commit Graph

3866 Commits (22a67c5dc6b6408c57ec4d09a7d8853e6d644432)

Author SHA1 Message Date
Richard Hansen e5b45cc984 contentcollector: Delete unnecessary `dom` functions
And move the remaining functions out of the `makeContentCollector()`
function.
2021-01-27 04:59:36 +00:00
Richard Hansen 275f041fbb contentcollector: Simplify child node access 2021-01-27 04:59:36 +00:00
Richard Hansen 1cb5453aeb contentcollector: Skip over non-Text, non-Element Nodes 2021-01-27 04:59:36 +00:00
Richard Hansen 075969aea0 contentcollector: Fix Element tag name fetch
The `name` property is only available on cheerio's Element-like
objects; DOM Element objects do not have a `name` property. Switch to
`dom.tagName()` to fix the logic for browsers.
2021-01-27 04:59:36 +00:00
Richard Hansen e3ec9d9a4c contentcollector: Fix parent node access
The `parent` property is only available on cheerio's Node-like
objects; DOM Node objects do not have a `parent` property. Switch to
the `parentNode` property so that the code works in browsers as well
as cheerio.
2021-01-27 04:59:36 +00:00
Richard Hansen 1d36549152 contentcollector: Delete unnecessary parentheses 2021-01-27 04:59:36 +00:00
Richard Hansen e3a47e48f9 contentcollector: Fix collectContentLineText hook
Before, the hook always ignored the return values provided by the hook
functions. Now the hook functions can change the text by either
returning a string or setting `context.text` to the desired value.

Also drop the `styl` and `cls` context properties. They were never
documented and they were always null.
2021-01-27 04:59:36 +00:00
Richard Hansen 4e220538a1 contentcollector: Use destructuring to improve readability 2021-01-27 04:59:36 +00:00
Richard Hansen b547ce9a47 contentcollector: Invert logic to improve readability 2021-01-27 04:59:36 +00:00
Richard Hansen b811030846 contentcollector: Delete unnecessary truthiness check 2021-01-27 04:59:36 +00:00
Richard Hansen fc2420c244 contentcollector: Fix iteration over child Nodes
In the DOM, `.children` only includes children that are Element
objects. In cheerio 0.22.0, `.children` includes all child Nodes, not
just Elements. Use `dom.numChildNodes()` and `dom.childNode()` so that
browsers behave the same as cheerio.
2021-01-27 04:59:36 +00:00
Richard Hansen d0bfb54c0a contentcollector: Avoid `for..in` iteration of object properties
`for..in` iterates over inherited properties, which is almost never
desired. In most cases there aren't any inherited enumerable
properties so it's not that big of a deal, but in the case of
HTMLCollection it's very bad because it iterates over every entry
twice (once by numerical index and once by name) plus it includes the
`length` property in the iteration.
2021-01-27 04:59:36 +00:00
Richard Hansen 3cfec58948 contentcollector: Rename `dom` functions for consistency with DOM spec 2021-01-27 04:59:36 +00:00
Richard Hansen 8763c3bb29 contentcollector: Fix Element attribute accesses
The `attribs` property is only available on cheerio's Element-like
objects; DOM Element objects do not have an `attribs` property. Switch
to `dom.nodeAttr()` to fix the logic for browsers.
2021-01-27 04:59:36 +00:00
Richard Hansen 99625950c8 contentcollector: Factor out call to `.toLowerCase()` 2021-01-27 04:59:36 +00:00
Richard Hansen dd7fb1babe contentcollector: Document the `dom` object 2021-01-27 04:59:36 +00:00
Richard Hansen 74bb2f76cc contentcollector: Delete unused `domInterface` parameter 2021-01-27 04:59:36 +00:00
Richard Hansen 42c25b2536 openapi: Fix error logging 2021-01-27 04:59:36 +00:00
Richard Hansen 54a3dbb9a0 lint: Fix some straightforward ESLint errors 2021-01-27 04:59:36 +00:00
Bartlomiej Witczak 4b4b685bba
fix: runtime error if no buttons are present in toolbar (#4680)
Co-authored-by: Bartek Witczak <bartek@dayone.pl>
2021-01-26 11:02:54 +00:00
Richard Hansen b73b0bcb98 farbtastic: Minimize diff to upstream
This should make it easier to upgrade to the latest version.
2021-01-26 04:07:43 -05:00
Richard Hansen a0745d74b9 farbtastic: Document where the code came from 2021-01-26 04:07:43 -05:00
John McLear 3a19254f21 stale code: removed excanvas which was ie support for no canvas 2021-01-26 04:05:54 -05:00
John McLear 7768871f8f security: bumping socketio version due to vulnerability 2021-01-26 00:53:04 -05:00
John McLear 81b860bc35 tests: allow for longer timeout 2021-01-25 22:53:11 -05:00
John McLear 7421730b44 lint: src/node/utils/toolbar.js 2021-01-25 22:53:11 -05:00
John McLear 89aa8cf55e lint: src/node/utils/randomstring.js 2021-01-25 22:53:11 -05:00
John McLear 21ef857d8a lint: src/node/utils/promises.js 2021-01-25 22:53:11 -05:00
John McLear b831feae66 lint: src/node/utils/path_exists.js 2021-01-25 22:53:11 -05:00
John McLear 4f7e322d53 lint: src/node/utils/padDiff.js 2021-01-25 22:53:11 -05:00
John McLear 9759e09387 lint: src/node/utils/customError.js 2021-01-25 22:53:11 -05:00
John McLear f664f84da5 lint: src/node/utils/caching_middleware.js 2021-01-25 22:53:11 -05:00
John McLear 02c1bf7d81 lint: src/node/utils/UpdateCheck.js 2021-01-25 22:53:11 -05:00
John McLear f8323eae89 lint: src/node/utils/TidyHtml.js 2021-01-25 22:53:11 -05:00
John McLear 31f1e39565 lint: src/node/utils/Settings.js 2021-01-25 22:53:11 -05:00
John McLear af8ea6b45f lint: src/node/utils/NodeVersion.js 2021-01-25 22:53:11 -05:00
John McLear b11ba23208 lint: src/node/utils/MinifyWorker.js 2021-01-25 22:53:11 -05:00
John McLear b5e04d867e lint: src/node/utils/LibreOffice.js 2021-01-25 22:53:11 -05:00
John McLear 85d1dc8d71 lint: src/node/utils/ImportHtml.js 2021-01-25 22:53:11 -05:00
John McLear a41b4b8e45 lint: src/node/utils/ImportEtherpad.js 2021-01-25 22:53:11 -05:00
John McLear 9fff82e370 lint: src/node/utils/ExportTxt.js 2021-01-25 22:53:11 -05:00
John McLear bfabe7c297 lint: src/node/utils/ExportHtml.js 2021-01-25 22:53:11 -05:00
John McLear c44c4edc10 lint: src/node/utils/ExportHelper.js 2021-01-25 22:53:11 -05:00
John McLear a4764faded lint: src/node/utils/ExportEtherpad.js 2021-01-25 22:53:11 -05:00
John McLear 52f60ceeaa lint: src/node/utils/Cli.js 2021-01-25 22:53:11 -05:00
John McLear 60bc849be2 lint: src/node/utils/AbsolutePaths.js 2021-01-25 22:53:11 -05:00
John McLear 7afc809073 lint: src/node/utils/Abiword.js 2021-01-25 22:53:11 -05:00
John McLear 666dd7abd1 lint: src/node/padaccess.js 2021-01-25 22:53:11 -05:00
John McLear 6054f6d93f lint: src/node/hooks/i18n.js 2021-01-25 22:53:11 -05:00
John McLear 2dec36bfd7 lint: src/node/hooks/express/tests.js 2021-01-25 22:53:11 -05:00
John McLear 6df3eadecd lint: src/node/hooks/express/static.js 2021-01-25 22:53:11 -05:00
John McLear 09fc7438ea lint: src/node/hooks/express/specialpages.js 2021-01-25 22:53:11 -05:00
John McLear 72ddf35426 lint: src/node/hooks/express/padurlsanitize.js 2021-01-25 22:53:10 -05:00
John McLear 43ce0f839b lint: src/node/hooks/express/padreadonly.js 2021-01-25 22:53:10 -05:00
John McLear 2f9a3ec655 lint: src/node/hooks/express/openapi.js 2021-01-25 22:53:10 -05:00
John McLear 18ebf7b69a lint: src/node/hooks/express/isValidJSONPName.js 2021-01-25 22:53:10 -05:00
John McLear 3571eb7c32 lint: src/node/hooks/express/importexport.js 2021-01-25 22:53:10 -05:00
John McLear 3cf6e1f015 lint: src/node/hooks/express/errorhandling.js 2021-01-25 22:53:10 -05:00
John McLear 4de2844af2 lint: src/node/hooks/express/apicalls.js 2021-01-25 22:53:10 -05:00
John McLear fbc70c1276 lint: src/node/hooks/express/adminplugins.js 2021-01-25 22:53:10 -05:00
John McLear 3a586a7aad lint: src/node/hooks/express/admin.js 2021-01-25 22:53:10 -05:00
John McLear acf889b7de lint: src/node/handler/SocketIORouter.js 2021-01-25 22:53:10 -05:00
John McLear 532bde71f7 lint: src/node/handler/PadMessageHandler.js 2021-01-25 22:53:10 -05:00
John McLear 841d45cbe1 lint: src/node/handler/ImportHandler.js 2021-01-25 22:53:10 -05:00
John McLear 2fe5d1f873 lint: src/node/handler/ExportHandler.js 2021-01-25 22:53:10 -05:00
John McLear a7d9a703cd lint: src/node/handler/APIHandler.js 2021-01-25 22:53:10 -05:00
John McLear ee9bb019b2 lint: src/node/easysync_tests.js 2021-01-25 22:53:10 -05:00
John McLear 8fb6912fc9 lint: src/node/db/SessionStore.js 2021-01-25 22:53:09 -05:00
John McLear 3681f72afd lint: src/node/db/SessionManager.js 2021-01-25 17:56:28 -05:00
John McLear 93bc21b5f3 lint: src/node/db/SecurityManager.js 2021-01-25 17:56:28 -05:00
John McLear 5ce255c789 lint: src/node/db/ReadOnlyManager.js 2021-01-25 17:56:28 -05:00
John McLear e06b9442e0 lint: src/node/db/PadManager.js 2021-01-25 17:56:28 -05:00
John McLear f0c26c9ba2 lint: src/node/db/Pad.js 2021-01-25 17:56:27 -05:00
John McLear 5ecb3f9f37 lint: src/node/db/GroupManager.js 2021-01-25 17:56:27 -05:00
John McLear 8aa729a36f lint: src/node/db/AuthorManager.js 2021-01-25 17:56:27 -05:00
John McLear d9225f326f lint: src/node/db/API.js 2021-01-25 17:56:27 -05:00
translatewiki.net f0cafe88f2 Localisation updates from https://translatewiki.net. 2021-01-25 18:04:09 +01:00
John McLear ee158b0fe5
bugfix: bump ueberdb to 1.2.5 to resolve #4645 which caused a users color not to be persistent 2021-01-23 13:54:50 +00:00
John McLear f0a77cb98c
lint: contentcollector and domline
Various tidy up and linting of contentcollector.js and domline.js.

3 Tests disabled which are not due to be covered.

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2021-01-22 20:41:14 +00:00
Richard Hansen 10a91825fc ace2_inner: Fix argument bug in `execCommand()`
This fixes a bug introduced in commit
c38c34bef4.
2021-01-22 17:02:38 +00:00
Richard Hansen aeedaac04e ace2_inner: Improve readability of object creation 2021-01-22 17:02:38 +00:00
Richard Hansen 2f430e3a5a ace2_inner: Fix some ESLint errors 2021-01-22 17:02:38 +00:00
Richard Hansen 0bfabfef5d ace2_inner: Avoid unnecessary use of underscore.js
This silences a bunch of you-dont-need-underscore-lodash ESLint
warnings.
2021-01-22 17:02:38 +00:00
Richard Hansen 51dc5b1627 ace2_inner: Delete dead code 2021-01-22 17:02:38 +00:00
translatewiki.net e5836150cd Localisation updates from https://translatewiki.net. 2021-01-21 15:09:02 +01:00
Richard Hansen 517fc88c54 eejs: Cache the compiled template, not the template string 2021-01-20 08:15:43 +00:00
Richard Hansen 4d2d439874 eejs: Simplify cache lookup logic 2021-01-20 08:15:43 +00:00
Richard Hansen c8c3929058 eejs: Inline `begin_capture`, `end_capture` 2021-01-20 08:15:43 +00:00
Richard Hansen 7d11d54323 eejs: Delete unused functions 2021-01-20 08:15:43 +00:00
Richard Hansen 351913c08e eejs: Delete broken example 2021-01-20 08:15:43 +00:00
Richard Hansen 5987f75b0d eejs: Unwrap unnecessarily wrapped line 2021-01-20 08:15:43 +00:00
Richard Hansen ebc4956277 eejs: Fix straightforward ESLint errors 2021-01-19 19:59:25 +00:00
translatewiki.net c89da1a9f2 Localisation updates from https://translatewiki.net. 2021-01-18 16:46:17 +01:00
John McLear c0d9881a62
stats: add memoryUsageHeap value 2021-01-16 19:36:00 +00:00
Richard Hansen 4bda5272df Revert "db: Capitalize `Database` constructor"
I thought a PR adding capitalized `Database` landed in ueberdb2, but
apparently not.

This reverts commit 611d416d54.
2021-01-15 18:05:39 -05:00
Richard Hansen 0ba833c632 db: Update ueberdb2 dependency 2021-01-15 22:37:18 +00:00
Richard Hansen 611d416d54 db: Capitalize `Database` constructor 2021-01-15 22:37:18 +00:00
translatewiki.net 52c08794de Localisation updates from https://translatewiki.net. 2021-01-14 15:44:58 +01:00
John McLear 2929ba9894 lint: cssmanager.js 2021-01-14 13:06:34 +00:00
John McLear d9f3bb0e39 lint: colorutils.js 2021-01-14 13:06:34 +00:00
John McLear 1d57d4ee3f lint: caretPosition linting 2021-01-14 13:06:34 +00:00
John McLear aeab9cc0ad lint: attributepool fix incorrect commit 2021-01-14 13:06:34 +00:00
John McLear 76744d9783 lint: AttributePool.js 2021-01-14 13:06:34 +00:00
John McLear efc323cd71 Revert "lint: attributepool.js"
This reverts commit 33baaafbdeb4c0f82ec504738f5851f9ab5261a8.
2021-01-14 13:06:34 +00:00
John McLear 75ffe40c09 lint: attributepool.js 2021-01-14 13:06:34 +00:00
John McLear 46dc943101 lint: linestylefilter and rjquery.js 2021-01-14 13:06:34 +00:00
John McLear c38c34bef4
linting: ace2_inner
* remove IE and add strict headers

* linting: kids are back, need to stop for today

* linting: farbtastic fix

* lint: more lint fixes

* more lint fixes

* linting: sub 100 errors

* comments where I need help

* ready to be helped :)

* small fixes

* fixes

* linting: all errors resolved

* linting: remove note to self

* fix as per nulli/wezz000li suggestion

* fix as per nulli/wezz000li suggestion

* resolve merge conflicts

* better use if to silence eslint

* Use `for..of` with `Object.keys` instead of `for..in`

* lint: move setSelection to before call

Co-authored-by: webzwo0i <webzwo0i@c3d2.de>
Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2021-01-14 10:00:14 +00:00
Richard Hansen edbe6d5387 Bump ueberDB to get speed improvements 2021-01-11 09:23:08 +00:00
John McLear 04962bfe39
update ueberdb to 1.1.7 (#4633) 2021-01-07 04:16:13 -05:00
translatewiki.net 68ca3fcdbd Localisation updates from https://translatewiki.net. 2021-01-04 14:43:02 +01:00
translatewiki.net 6d626c90d3 Localisation updates from https://translatewiki.net. 2020-12-29 08:50:16 +01:00
webzwo0i ca405c1685 send the test files with the correct content-type header 2020-12-27 23:40:35 +00:00
John McLear 38c9827161
Feature: Scroll to Line number based on Hash IE http://foo.com/p/bar#L10 will scroll to line 10. (#4554)
Includes test coverage
Co-authored-by: webzwo0i <webzwo0i@c3d2.de>
2020-12-26 22:05:08 +01:00
John McLear e051f2f2f7 lint: scroll.js 2020-12-26 20:43:10 +00:00
webzwo0i b760e699c6 remove explicitly setting process.env.DEBUG 2020-12-24 08:46:25 +00:00
Richard Hansen 9a15af78b6 Regenerate `src/package-lock.json` with npm v6.14.9
This reverts the file back to lockfileVersion 1, which is used by the
LTS version of npm.
2020-12-23 16:58:30 -05:00
John McLear d9262fccbd bump version 2020-12-23 16:18:28 -05:00
John McLear 1a845773ee css: loading position box 2020-12-23 16:18:28 -05:00
Richard Hansen f31232dd20 socket.io: Disconnect clients when closing HTTP server 2020-12-23 16:18:28 -05:00
Richard Hansen 9f7d42185d socket.io: Reconnect if the server disconnects
This will make the pages gracefully handle HTTP server restart events,
which happen whenever a plugin is installed or uninstalled via the
`/admin/plugins` page.
2020-12-23 16:18:28 -05:00
Richard Hansen 303964c51e socket.io: Factor out client connection logic 2020-12-23 16:18:28 -05:00
Richard Hansen 7eb0f996c3 socket.io: Delete ignored `resource` option
I couldn't find any reference to a `resource` option in either the
socket.io-client documentation or its source code.
2020-12-23 16:18:28 -05:00
Richard Hansen 7949219179 Reformat `src/ep.json` 2020-12-23 16:18:28 -05:00
Richard Hansen 8c1afc3399 express: New expressCloseServer hook
This will be used by a future commit to close all socket.io
connections during server restart.
2020-12-23 16:18:28 -05:00
Richard Hansen 3e8c3e5789 express: Factor out common server shutdown logic
Also log when the HTTP server is about to be closed and when it is
done closing.
2020-12-23 16:18:28 -05:00
Richard Hansen ff19181cd1 lint: Fix some straightforward ESLint errors 2020-12-23 16:18:28 -05:00
translatewiki.net ac086c7925 Localisation updates from https://translatewiki.net. 2020-12-23 16:18:28 -05:00
webzwo0i 790ba72a9e change scroll-behavior to auto
timeslider follow test: ensure there are so much lines in the pad view
below the changed line, so that the changed line will be the first
visible line
2020-12-23 16:18:28 -05:00
John McLear 996a2d86dd lint: chat (#4573)
Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2020-12-23 16:18:28 -05:00
John McLear 8bf463fb00 lint: broadcast_revisions (#4571)
Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2020-12-23 16:17:59 -05: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
Hossein Marzban 170a230c3a
Lint: timeslider (#4580)
Squashed changes from rhansen@rhansen.org:
  * Move code back to where it was. (It's easier to review changes
    when the code isn't moved. This causes some no-use-before-define
    warnings to reappear, but those are just warnings.)
  * Move eslint-disable comment to same line
  * Use `window.clientvars` to resolve no-global-assign
  * Undo changes that aren't about fixing lint errors
2020-12-20 18:24:17 -05:00
John McLear bca60c8b17 lazydeveloper: remove console log 2020-12-20 10:56:19 +00:00
John McLear e18b9d1844 timeslider/bugfix: timeslider wasn't updating when new pad contents was created - #4595 2020-12-20 10:45:16 +00:00
John McLear 0362d3b05d
lint: pad prefix files (#4577)
* lint: pad_connectionstatus

* lint: pad_utils

* lint: pad_userlist.js -- still WIP

* shift underscore not to be in require but to be used from window

* lint: pad_modals

* pad_impexp.js

* lint: more errors done

* lint: auto reconn

* lint: pad_editor

* lint: finish auto reconn

* lint: imp exp rework

* lint: import

* lint: pad.js nearly done but pizza here...

* lint: clientVars global query

* put clientVars in window

* Revert incorrect lint fixes

* Properly fix guard-for-in lint errors

* Properly fix no-unused-vars error regarding `gritter`

* Refine lint fixes

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2020-12-20 07:15:58 +00:00
Hossein Marzban 34ee77993f
Lint: pluginfw tsort.js (#4576)
* lint: pluginfw tsort.js

* Don't comment out the `console.log()` call

Disabling the log message is out of scope for the pull request.

* Put const and let on separate lines

* Convert `tsort` from function to arrow function

ESLint doesn't complain about this due to a bug in
prefer-arrow/prefer-arrow-functions rule:
https://github.com/TristonJ/eslint-plugin-prefer-arrow/issues/24

Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2020-12-20 06:18:49 +00:00
webzwo0i a637920e55
add list-style:none for ul.indents in exported HTML (#4586)
* add list-style:none for ul.indents in exported HTML

* use list-style-type not list-style
2020-12-20 06:00:18 +00:00
Richard Hansen b82bf5c726 Drop support for Internet Explorer 2020-12-19 19:13:31 +00:00
webzwo0i c5cf7ab144
tests: Ignore head tag on import / improved contentcollector tests
* fix accidental write to global variable
properly show pending tests
log test name in suite
better log output for received/expected strings

* cc tests: enable second nestedOL test

* ignore the head tag on import
2020-12-18 09:37:37 +00:00
Richard Hansen d9b7aa489d pad import/export: Delete dead functions 2020-12-18 09:29:28 +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 794dfb1863 lint: Bump eslint-config-etherpad and install its new deps 2020-12-17 22:18:29 +00:00
translatewiki.net c9db9500e5 Localisation updates from https://translatewiki.net. 2020-12-17 15:13:17 +01:00
Richard Hansen f54dcbc766 lint: Re-run `eslint --fix` 2020-12-16 22:09:48 +00:00
Richard Hansen fc234d0088 lint: Bump `eslint` and `eslint-config-etherpad` versions 2020-12-16 22:09:48 +00:00
Richard Hansen af7cd13787 pad: Add a hook for the permission denied block
This makes it possible for the ep_readonly_guest plugin to add a login
button.
2020-12-16 19:39:52 +00:00
Richard Hansen 92b295193f css: Apply font formatting to the text, not the high-level div
This makes it possible for plugins to add new items without them
rendering centered, at a ridiculous size, or at an awkward location.
2020-12-16 19:39:52 +00:00
Richard Hansen 27dab35827 css: Delete absolute `line-height`
Having an absolute `line-height` causes problems when something sets
`font-size` without also setting `line-height`.
2020-12-16 19:39:52 +00:00
John McLear 92e36b82b5
linting: pad_editbar.js 2020-12-16 12:12:25 +00:00
Hossein Marzban 6f309ac20a
lint: pluginfw/client_plugins (#4572) 2020-12-15 21:40:41 -05:00
Richard Hansen a4e2ea7a8c Add missing dependency on mime-types
mime-types is used by `src/node/utils/Minify.js` since commit
2c944eba34.
2020-12-14 20:31:35 +00:00
Richard Hansen edf647044c Update `package-lock.json` and `src/package-lock.json` 2020-12-14 20:31:35 +00:00
translatewiki.net ef8a581acd Localisation updates from https://translatewiki.net. 2020-12-14 15:05:13 +01:00
Michael Murtaugh 66e3f02ed2
editor/bugfix: missing await in createClearStartAtext (#4561)
Missing await in call to this._pad.getInternalRevisionAText(rev). Function returns a promise. This bug breaks the createDiffHTML API call (how I discovered it).
2020-12-14 07:04:14 +00:00
Richard Hansen a44debdcfe Add `'` and `*` to acceptable URL characters
These characters are in the RFC3986 reserved set.

These characters are added to the set of characters that cannot be the
last character of a URL to avoid mislinkification.
2020-12-14 07:03:17 +00:00
Richard Hansen 7d23278ed0 Exclude `?`, `!`, and `)` from last character of URL
Now the final character in each of these example strings is no longer
considered part of the URL:
  * Have you seen http://example.com?
  * Look at http://example.com!
  * (see http://example.com)
2020-12-14 07:03:17 +00:00
Richard Hansen 7e8de5540f Factor out common URL regular expression code
This also eliminates the differences between the regular expressions.
2020-12-14 07:03:17 +00:00
Richard Hansen ca01856f94 lint: Fix some straightforward ESLint errors 2020-12-14 07:03:17 +00:00
Richard Hansen e66e8a4eb2 pad: Fix wrong variable name in global exception handler
This fixes a bug introduced in commit
c845d985e0.
2020-12-10 22:25:58 +00:00
webzwo0i d25010d5d7
pluginfw: explicitly install the latest version of a plugin, fix for #4536 (#4543) 2020-12-05 14:08:02 +00:00
webzwo0i 0c7df88f8a
add rehype-minify-whitespace to package.json (#4544) 2020-12-05 12:16:25 +00:00
John McLear ef2de59587
editor: use rehype-minify-whitespace
use rehype-minify-whitespace

Co-authored-by: webzwo0i <webzwo0i@c3d2.de>
2020-12-05 08:14:09 +00:00
John McLear de5e071294 path issue 2020-12-05 07:51:17 +00:00
John McLear 159b6a4ba1 database: bump ueberdb to 056 to ensure correct engine is used 2020-12-05 07:51:17 +00:00
zonky2 0f1d5e068a
css: Make color button from elipsoid to circle (#4535)
Make color button from elipsoid to circle by own user
https://easycaptures.com/fs/uploaded/1536/3084360130.png
2020-12-05 07:32:15 +00:00
Richard Hansen aa41b0920c admin/plugins: Don't keep adding more Update buttons 2020-11-27 16:59:24 +00:00
Richard Hansen 6a00d7f8d6 admin/plugins: Use jQuery to build the Update button 2020-11-27 16:59:24 +00:00
Richard Hansen 2ddc45bf07 admin/plugins: Simplify jQuery search for plugin actions 2020-11-27 16:59:24 +00:00
Richard Hansen 973644c7dd lint: Fix ESLint errors in `/admin/plugins` code 2020-11-27 16:59:24 +00:00
Richard Hansen 6a5f905090 admin: Delete unused `search_results`
This silences some ESLint camelcase warnings.
2020-11-27 16:59:24 +00:00
Richard Hansen 2fdac836d0 lint: Bump eslint-config-etherpad to 1.0.13
Also bump eslint to 7.14.0.
2020-11-27 06:25:43 +00:00
Richard Hansen 750c7cb1cf pad: Delete unused `ip` and `userAgent` client vars 2020-11-26 15:00:46 +00:00
Richard Hansen 98066184b2 PadMessageHandler: Don't fill in default name or color
It should be the client's responsibility to handle null name or color.
In the case of author names, passing null to the client allows users
to fill in the names of other users (via a suggestUserName
CLIENT_MESSAGE).
2020-11-26 15:00:46 +00:00
Richard Hansen ef7ae15722 PadMessageHandler: Don't send USER_NEWINFO about unknown authors
When a new client opens a socket.io connection and sends a
CLIENT_READY message, Etherpad sends the new client a bunch of
USER_NEWINFO messages, one per other user already connected to the
pad. When iterating over the other users, filter out those without an
author ID or missing from the global authors database.
2020-11-26 15:00:46 +00:00
Richard Hansen 53bc80e381 pad userlist: Use jQuery to create rows
This makes the code easier to read and maintain, and it reduces the
likelihood of introducing an XSS vulnerability.
2020-11-26 15:00:46 +00:00
Ilmar Türk ba7d80fa57
Update dropdowns on language change (#4519) 2020-11-25 21:39:21 +00:00
Richard Hansen b13004b25a
Minify: Accept single quotes in `ace.js`'s `$$INCLUDE_*(...)` lines (#4513)
This fixes a bug introduced in commit
8e5fd19db2.
2020-11-25 03:40:02 +01:00
Richard Hansen e247c716c2 editor: Add argument to suppress SonarCloud error
This also makes it easier for devs to understand the expected function
signature.
2020-11-24 20:06:12 +00:00
Richard Hansen d24306ea6a editor: Delete unused `isTimeUp` argument
This fixes a SonarCloud error.
2020-11-24 20:06:12 +00:00
Richard Hansen ed7ba64635 editor: Delete unused `optModFunc` argument 2020-11-24 20:06:12 +00:00
Richard Hansen d0114d4ac2 editor: Delete commented-out code 2020-11-24 20:06:12 +00:00
Richard Hansen bb722763d0 editor: Delete dead code
This silences some SonarCloud errors.
2020-11-24 20:06:12 +00:00
Richard Hansen 8e5fd19db2 lint: Run `eslint --fix` on `src/` 2020-11-24 20:06:12 +00:00
Richard Hansen 0625739cb8 lint: Declare variables above their first use
This makes it possible to convert from `var` to `let` without getting
ReferenceErrors.
2020-11-24 20:06:12 +00:00
Richard Hansen 8ea1a1b90a lint: Prevent comments from being interpreted as JSDoc comments 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 cc988bd67b lint: Convert CR+LF line endings to LF 2020-11-24 20:06:12 +00:00
Richard Hansen a78d6605b7 lint: Configure ESLint 2020-11-24 20:06:12 +00:00
Richard Hansen 6665c4693f Clear hang timeout timer when LibreOffice exits
This prevents `npm test` from freezing for two minutes after the tests
complete.

Also switch to an arrow function for the `setTimeout` callback.
2020-11-24 10:04:14 +00:00
webzwo0i f2febcfc7e
minify: Fix gzip not triggered for packages (#4491)
* caching_middleware: fix gzip compression not triggered

* packages: If a client sets `Accept-Encoding: gzip`, the responseCache will
include `Content-Encoding: gzip` in all future responses, even
if a subsequent request does not set `Accept-Encoding` or another client
requests the file without setting `Accept-Encoding`.
Fix that.

* caching_middleware: use `test` instead of `match`

* add tests

* make code easier to understand

* make the regex more clear
2020-11-22 09:23:33 +00:00
John McLear 776eda2d4e
import/export: Kill soffice spawned process after 120 seconds (#4499)
Due to libreoffice being buggy / hanging on certain pdf imports (even in 7.0.3) we should just kill it so it doesn't consume CPU indefinitely.
2020-11-20 18:33:31 -05:00
Richard Hansen 867fdbd3f9 webaccess: Asyncify `checkAccess` 2020-11-19 09:05:38 +00:00
Richard Hansen a803f570e0 webaccess: Don't export `checkAccess`
Nobody uses it outside of this module.
2020-11-19 09:05:38 +00:00
Richard Hansen 5d585a12d6 webaccess: Fix some ESLint errors 2020-11-19 09:05:38 +00:00
Richard Hansen 4587c0fb4d webaccess: Use a non-capturing regex group 2020-11-19 09:05:38 +00:00
Richard Hansen a05e8198c9
bugfix: Fix bad paren placement in `/javascript` handler (#4496)
* Fix bad paren placement in `/javascript` handler

This fixes a bug introduced in commit
ed5a635f4c.

* add regression test for #4495

* Move `/javascript` test to `specialpages.js`

Co-authored-by: webzwo0i <webzwo0i@c3d2.de>
2020-11-19 08:19:13 +00:00
Richard Hansen 07bcbbd404 pad: Include the stack in the data sent to `/jserror` 2020-11-17 08:02:27 +00:00
Richard Hansen c845d985e0 pad: Pop up an error message on unhandled Promise rejection 2020-11-17 08:02:27 +00:00
Richard Hansen 93c335b3b8 pad: Use a relative URL to simplify
Also avoid creating an unnecessary variable.
2020-11-17 08:02:27 +00:00
translatewiki.net 41d02db023 Localisation updates from https://translatewiki.net. 2020-11-16 15:15:14 +01:00
webzwo0i 1d8e8d3484 terser was not called because mime type did not match 2020-11-15 19:46:48 +00:00
Richard Hansen cedd27e4fe plugins: Default the module name to the plugin name 2020-11-13 20:30:27 +00:00
Richard Hansen afb025030c plugins: Use a log4js logger for npm messages 2020-11-13 20:30:27 +00:00
Richard Hansen 8a918fbc46 plugins: `async`ify more functions 2020-11-13 20:30:27 +00:00
Richard Hansen 9f575ebc84 plugins: Delete unused `ensure` function 2020-11-13 20:30:27 +00:00
Richard Hansen ac5614dadd plugins: Don't export `callInit`
It's unused outside of this module.

Also use an arrow function.
2020-11-13 20:30:27 +00:00
Richard Hansen ba4794cf8a plugins: Call `require('./hooks')` at top level 2020-11-13 20:30:27 +00:00
Richard Hansen 14a9479e69 plugins: Use functions from `fs.promises` 2020-11-13 20:30:27 +00:00
Richard Hansen d624aa936e plugins: Fix plugin name in error messages 2020-11-13 20:30:27 +00:00
Richard Hansen 6a8563eeab import/export: Simplify exportEtherpadAdditionalContent processing
Also:
  * Improve parallelization
  * Refine the documentation
2020-11-10 23:02:43 +00:00
Richard Hansen 8c55a38582 HTML export: Add missing `)`
This bug was introduced in 68a91f5e24.
2020-11-10 02:51:55 -05:00
Richard Hansen 68a91f5e24 HTML export: Move `padId` to context object property 2020-11-10 07:13:26 +00:00
John McLear 881d8b8d95
pluginfw: Hook to include additional body in HTML exports (#4469)
* hook, needs docs

* docs
2020-11-06 13:48:59 +00:00
John McLear 3fa58efede
pluginfw: Export .etherpad hooks (#4466)
* export support

* proper prefix

* just a basic example, needs working on still

* docs

* comments shouldnt be hard coded
2020-11-06 13:48:25 +00:00
ilmar d5c5ca224b Fix missing arg handling in html10n.js 2020-11-05 10:38:22 +00:00
Richard Hansen 405e3e3e19 Settings: Don't filter out users based on `password` or `hash`
Some authentication plugins use the users defined in the `users`
object but ignore the `password` and `hash` properties.

This change deletes all of the filtering logic, including the logic
that filters out users that have both `password` and `hash` properties
defined. I could have kept that check, but decided to remove it
because:
  * There's no harm in defining both `hash` and `password`.
  * Allowing both makes it easier to transition from one scheme to
    another.
  * It's fewer lines of code to maintain.
2020-11-04 18:06:08 +00:00
Richard Hansen 6408d2313c webaccess: Be extra paranoid about nullish password
If `settings.json` contains a user without a `password` property then
nobody should be able to log in as that user using the built-in HTTP
basic authentication. This is true both with and without this change,
but before this change it wasn't immediately obvious that a malicious
user couldn't use an empty or null password to log in as such a user.
This commit adds an explicit nullish check and some unit tests to
ensure that an empty or null password will not work if the `password`
property is null or undefined.
2020-11-04 18:06:08 +00:00
Richard Hansen 98de2b0899 Use `contentEditable` for all browsers
This makes it possible to disable `contentEditable` for certain
elements in some circumstances (e.g., on links so that users can click
on them normally).
2020-11-03 19:02:01 +00:00
Richard Hansen 5e2a27a182 Replace `setClassPresence(x, ...)` with `x.classList.toggle(...)` 2020-11-03 19:02:01 +00:00
Richard Hansen 4594608c04 Delete commented-out code 2020-11-03 19:02:01 +00:00
Richard Hansen 91268e14b7 PadMessageHandler: Rename `client` to `socket`
The `client` variable is actually a socket.io Socket object. Rename it
to reduce confusion.
2020-11-02 20:39:08 +00:00
Richard Hansen ed5a635f4c Add `req` to EJS render args when possible
This makes it possible for EJS templates and `eejsBlock_*` hook
functions to access the user's express-session state.
2020-11-02 16:05:01 +00:00
translatewiki.net 127923eb54 Localisation updates from https://translatewiki.net. 2020-11-02 12:40:50 +01:00
Gabriel Medeiros Coelho ce77c48475 remove unnecessary conditional
if animationState evaluates to -1 or 0, it would end up in a conditional that assign its value to itself. Since this is redundant, it is better to remove this conditional, to avoid an extra check
2020-11-01 01:41:09 -05:00
webzwo0i 66a3647579 remove broken async inclusion in tar.json 2020-10-27 20:33:09 +00:00
Richard Hansen 2f65987ba2 webaccess: Remove user's password from session info
This prevents the password from being logged or stored in the
database.
2020-10-27 20:30:01 +00:00
translatewiki.net 50c22f0ae4 Localisation updates from https://translatewiki.net. 2020-10-26 15:56:46 +01:00
Viljami Kuosmanen c502ca3259 Use isHttpError utility provided by http-errors
This new utility method was introduced in http-errors v1.8.0. Let's use
that instead of instanceof. This also upgrades the http-errors dependency
2020-10-25 10:45:58 +00:00
Viljami Kuosmanen aef4cce0c9 Use correct constructor for 404,501 error handlers
Fixes error message mentioned in #4378.
2020-10-25 10:45:58 +00:00
Sebastian Castro 5a1110d0d6 Display outline when toolbar button focused 2020-10-25 10:34:51 +00:00
Richard Hansen 193028702d pad: Don't paste when middle-clicking on a link 2020-10-25 07:06:29 +00:00
Andrew Dassonville bee1ae06d8 utils: Fix commit checking on detached HEAD 2020-10-24 16:22:01 -04:00
John McLear cb5fcbb74e
editor: allow paste into links (#3802) 2020-10-24 16:59:03 +01:00
Richard Hansen 36aceb3aba hooks: Rewrite `callAll` and `aCallAll` for consistency
Rewrite the `callAll` and `aCallAll` functions to support all
reasonable hook behaviors and to report errors for unreasonable
behaviors (e.g., calling the callback twice).

Now a hook function like the following works as expected when invoked
by `aCallAll`:

```
exports.myHookFn = (hookName, context, cb) => {
  cb('some value');
  return;
};
```
2020-10-24 16:08:50 +01:00
Richard Hansen 79119baf58 hooks: Call the callback when done
If a hook function neither calls the callback nor returns a
(non-undefined) value then there's no way for the hook system to know
if/when the hook function has finished.
2020-10-24 16:08:50 +01:00
Richard Hansen 55939a0d7e hooks: Delete unused `flatten` function 2020-10-24 16:08:50 +01:00
Wouter bd2343f131 Added nl translations for adminpage 2020-10-23 16:18:57 -04:00
translatewiki.net 73dd3ffdf4 Localisation updates from https://translatewiki.net. 2020-10-22 12:58:59 +02:00
chandi 94cb000e8f
plugins: include more data within padUpdate hook (#4425)
* Including more data at pad update event

* docs: new context fields in padUpdate

Co-authored-by: Pedro Beschorner Marin <pedrobmarin@gmail.com>
2020-10-21 18:04:03 +01:00
webzwo0i 1e7a9e1791
tests: better timeslider follow contents (#4421) 2020-10-21 10:05:58 +01:00
Richard Hansen 0eb0a07914 Use an ellipsis instead of two periods 2020-10-20 11:02:37 +01:00
Richard Hansen 2379ade7e9 Move out pad.modals.reconnecttimer trailing space 2020-10-20 11:02:37 +01:00
Richard Hansen 734fe9c297 Use jQuery methods to build DOM elements 2020-10-20 11:02:37 +01:00
Richard Hansen a2554fff22 pad: Pop up an error message dialog box upon socket.io error 2020-10-20 10:01:49 +01:00
Richard Hansen 5b887396c3 pad: Check for null collabClient in socket.io event handlers 2020-10-20 10:01:49 +01:00
Richard Hansen b1acf6143a pad: Delete do-nothing `sendClientReady` wrapper 2020-10-20 10:01:49 +01:00
Richard Hansen a712ce457d gritter: Treat strings as text, not HTML
This forces users to use jQuery or DOM objects if they want
formatting, which helps avoid XSS vulnerabilities.
2020-10-20 10:01:49 +01:00
Richard Hansen 8463134125 pad: Improve rendering of uncaught exceptions
* Use jQuery to build the message HTML so that special characters in
    the error message, URL, etc. are properly escaped. This helps
    avoid XSS vulnerabilities.
  * Use bold text for the error message to make it stand out.
  * Add a line break between the error message and "in <url> at line
    <line>" so that the error message stands out more.
  * Use `<p>...</p>` instead of `</br>` to separate the parts of the
    popup.
  * Use CSS for spacing instead of `</br>`.
  * Grammar fixes (add a missing comma, "at" instead of "in").
2020-10-20 10:01:49 +01:00
Richard Hansen d35dbaaacc gritter: Accept jQuery or DOM objects for title and text
Teach Gritter to accept anything that jQuery's `.append()` method
accepts for the title and text of a popup message. This makes it
easier to safely build HTML messages with proper escaping of special
characters (to prevent XSS vulnerabilities).
2020-10-20 10:01:49 +01:00
Richard Hansen d680405f58 pad: Include .js URL in `/jserror` error report 2020-10-20 10:01:49 +01:00