Richard Hansen
a952df2cf5
Minify: Un-export requestURI()
...
Nobody outside this file uses it.
2021-02-12 07:08:51 +00:00
Richard Hansen
d9607f7c66
static: Asyncify
2021-02-12 07:08:51 +00:00
Richard Hansen
7f4a7156e2
Minify: Move getTar()
to static.js
...
`static.js` is the only file that uses it.
2021-02-12 07:08:51 +00:00
Richard Hansen
996dc81825
Minify: Move tar processing into a function
...
This reduces the overhead of `require()`ing the module, and it will
make it easier for a future commit to asyncify everything in
`Minify.js`.
2021-02-12 07:08:51 +00:00
Richard Hansen
50929fe7f7
express: Call expressConfigure, expressCreateServer hooks asynchronously
2021-02-12 07:08:51 +00:00
Richard Hansen
8919f63c98
lint: Replace use of underscore.js with plain ECMAScript
2021-02-12 07:08:51 +00:00
John McLear
ab127289c4
security: limit socketio to 1M chars
2021-02-11 21:01:47 -05:00
Richard Hansen
ce1b69feda
plugins: Helper function to run the npm
CLI
2021-02-09 22:18:35 +00:00
Richard Hansen
83a519941b
/admin/plugins: Fix logging of error messages
2021-02-09 22:18:35 +00:00
Richard Hansen
ebdb2798ff
server: Fix handling of errors during startup and shutdown
...
Before, an unhandled rejection or uncaught exception during startup
would cause `exports.exit()` to wait forever for startup completion.
Similarly, an error during shutdown would cause `exports.exit()` to
wait forever for shutdown to complete. Now any error during startup or
shutdown triggers an immediate exit.
2021-02-09 08:57:24 +00:00
Richard Hansen
5999d8cd44
server: Only pass err
arg to exports.exit()
...
The `uncaughtException` event handlers are passed two arguments: error
and "origin". The `exports.exit()` argument doesn't expect a second
argument.
2021-02-09 08:57:24 +00:00
Richard Hansen
5b327b63ac
server: Simplify gating of state transition waiters
2021-02-09 08:57:24 +00:00
Richard Hansen
105f8b0ccb
server: Use a log4js logger object for logging
2021-02-09 08:57:24 +00:00
Richard Hansen
1e3f352281
openapi: Turn down logging verbosity
2021-02-09 07:24:31 +00:00
John McLear
2b112ac851
tests: Admin Frontend Test Coverage( #4717 )
...
Covers all frontend admin operations, runs separated in CI.
2021-02-07 11:32:57 +00:00
John McLear
e02246641e
ordered lists bugfix: first line item can be 0.*, don't show 0 as undefined ( #4600 )
2021-02-06 20:19:05 +00:00
John McLear
c969ae58c2
stats: activePads & lastDisconnected stats
2021-02-06 19:53:52 +00:00
Richard Hansen
8b28e00784
restructure: Prefix bin/
and tests/
with src/
...
This is a follow-up to commit
2ea8ea1275
.
2021-02-05 21:52:08 +00:00
Richard Hansen
746cc8cc34
pluginfw: In-line formatPluginsWithVersion()
...
There's only one caller of the function, so move the logic to where it
is used.
2021-02-04 08:41:00 +00:00
Richard Hansen
cd1d322af4
/admin/plugins/info: Move logic to .js
file
2021-02-04 08:41:00 +00:00
freddii
ea202e41f6
docs: fixed typos
2021-02-03 00:30:07 +01:00
John McLear
0cc8405e9c
Bump minimum required Node.js version to 10.17.0
...
This makes it possible to use fs.promises.
2021-01-30 17:00:40 -05:00
Richard Hansen
877f0c5883
server: Use wtfnode to log reasons why node isn't exiting
2021-01-30 08:05:08 +00:00
Richard Hansen
ba81ead101
server: Remove all other signal listeners
2021-01-30 08:05:08 +00:00
Richard Hansen
ecdb105bfe
server: Refine process lifetime management
...
Define states and use them to properly handle multiple calls to
`start()`, `stop()`, and `exit()`. (Multiple calls to `exit()` can
happen if there is an uncaught exception or signal during shutdown.)
This should also make it easier to add support for cleanly restarting
the server after a shutdown (for tests or via an `/admin` page).
2021-01-30 08:05:08 +00:00
Richard Hansen
725023fe58
server: Refactor stop()
to avoid no-async-promise-executor lint error
...
Also log when Etherpad has stopped.
2021-01-30 08:05:08 +00:00
Richard Hansen
d339f2a671
server: Perform init after adding uncaught exception handler
...
This avoids an unnecessary `try` block.
2021-01-30 08:05:08 +00:00
Richard Hansen
86ceb2b610
server: Exit on unhandled Promise rejection
2021-01-30 08:05:08 +00:00
Richard Hansen
c1ef12b8da
lint: Re-run eslint --fix
2021-01-29 01:14:03 -05:00
Richard Hansen
53092fa7af
db/Pad: Call padCopy and padRemove hooks asynchronously
2021-01-28 09:36:22 +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
John McLear
3a19254f21
stale code: removed excanvas which was ie support for no canvas
2021-01-26 04:05:54 -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
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
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
611d416d54
db: Capitalize Database
constructor
2021-01-15 22:37:18 +00:00
Richard Hansen
edbe6d5387
Bump ueberDB to get speed improvements
2021-01-11 09:23:08 +00:00
webzwo0i
ca405c1685
send the test files with the correct content-type header
2020-12-27 23:40:35 +00:00
webzwo0i
b760e699c6
remove explicitly setting process.env.DEBUG
2020-12-24 08:46:25 +00:00
Richard Hansen
f31232dd20
socket.io: Disconnect clients when closing HTTP server
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
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
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
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
f54dcbc766
lint: Re-run eslint --fix
2020-12-16 22:09:48 +00: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
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
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
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
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
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
8e5fd19db2
lint: Run eslint --fix
on src/
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
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
webzwo0i
1d8e8d3484
terser was not called because mime type did not match
2020-11-15 19:46:48 +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
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
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
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
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
Andrew Dassonville
bee1ae06d8
utils: Fix commit checking on detached HEAD
2020-10-24 16:22:01 -04: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
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
Richard Hansen
4a25559a2d
tests: Aggressively filter out non-.js files
...
This prevents errors when the directory contains Emacs backup files.
2020-10-14 10:38:52 +01:00
Richard Hansen
048bd0f50d
tests: Simplify API key reading
...
Also delete unused imports.
2020-10-08 22:50:18 +01:00
John McLear
66df0a572f
Security: FEATURE REMOVAL: Remove all plain text password logic and ui ( #4178 )
...
This will be a breaking change for some people.
We removed all internal password control logic. If this affects you, you have two options:
1. Use a plugin for authentication and use session based pad access (recommended).
1. Use a plugin for password setting.
The reasoning for removing this feature is to reduce the overall security footprint of Etherpad. It is unnecessary and cumbersome to keep this feature and with the thousands of available authentication methods available in the world our focus should be on supporting those and allowing more granual access based on their implementations (instead of half assed baking our own).
2020-10-07 13:43:54 +01:00
Richard Hansen
45bee54aa0
HTML export: Await async hook completion before processing results
2020-10-07 10:43:38 +01:00
Richard Hansen
661a89355f
socketio: Mimic what Express does to get client IP address
...
This also makes it easier for plugins to get the client IP address.
2020-10-07 10:40:37 +01: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