Richard Hansen
0284d49522
CachingMiddleware: Switch to ES6 class syntax
2021-02-27 14:03:09 +01:00
Richard Hansen
80af66543a
lint: Move up respond()
in caching_middleware.js
2021-02-27 14:03:09 +01:00
Richard Hansen
7ab3ee2121
lint: src/node/utils/caching_middleware.js
2021-02-27 14:03:09 +01:00
Richard Hansen
392d9dcfde
PadMessageHandler: Fix fetching of socket.io Sockets for a pad
2021-02-27 08:46:49 +00:00
Richard Hansen
9cd67cd990
PadMessageHandler: Delete unnecessary use of Promise.then()
2021-02-27 08:46:49 +00:00
webzwo0i
15dba7d886
move underscore to its old place and remove unnecessary packages ( #4876 )
2021-02-27 00:10:53 -05:00
John McLear
c0ec28f781
reversecompat: underscore
...
Backward compatibility for plugins that were written when underscore lived at src/static/js/underscore.js.
2021-02-26 11:03:19 +00:00
webzwo0i
efd211bbc5
remove useless semicolon
2021-02-25 16:59:06 +00:00
webzwo0i
fa29858a4e
avoid manually including require-kernel in ace.js
2021-02-25 16:59:06 +00:00
Richard Hansen
ba5d8369bf
Minify: Consistently use path.join()
to build pathnames
...
This defends against extraneous or missing slashes, and it might
improve the experience on Windows.
2021-02-25 10:14:48 +00:00
Richard Hansen
2d3469e3ee
Minify: Improve pathname sanitization
...
For context, see:
https://nvd.nist.gov/vuln/detail/CVE-2015-3297
9d4e5f6e35
https://github.com/ether/etherpad-lite/issues/2614
2021-02-25 10:14:48 +00:00
Richard Hansen
0cce4ae536
Minify: Also serve jquery.js
from old path for compatibility
2021-02-25 10:14:48 +00:00
Richard Hansen
dabff9be77
run_cmd: Fix PATH debug log message
2021-02-23 21:41:32 -05:00
John McLear
0f16e518ff
api: drop JSONP ( #4835 )
...
* api: drop JSONP
* docs: drop JSONP
* tests: drop JSONP
* api: remove isValidJSONPName require
2021-02-22 09:10:02 +00:00
John McLear
ce83181ac3
Lgtm bugfixes ( #4838 )
...
* code tidy up: always evaluates
* tidy up: is always true
* tidy up: remove unused code
* always true/false variables
* unused variable
* tidy up: remove unused code in caretPosition.js
* for squash: Revert "tidy up: remove unused code in caretPosition.js"
The `if` condition was previously always true, so the body should be
preserved. If the body is preserved, other logic can be deleted. I
opened PR #4845 to clean it all up.
This reverts commit 75b03e5a7d
.
* for squash: simplify
* for squash: Explain that the getter is used for its side effects
It's very weird to call a getter without using its return value. Add a
comment explaining why this is done so that the reader doesn't get
confused.
* for squash: Revert "tidy up: remove unused code"
The exception test was the purpose of the code.
This reverts commit 85153b1676
.
* for squash: Log the tsort results
Co-authored-by: Richard Hansen <rhansen@rhansen.org>
2021-02-22 08:26:35 +00:00
John McLear
40d7480d5b
lint: padaccess.js
2021-02-21 21:09:02 -05:00
John McLear
029729a386
lint: Settings.js
2021-02-21 21:09:02 -05:00
John McLear
435562299f
lint: NodeVersion.js
2021-02-21 21:09:02 -05:00
John McLear
7352dc7571
lint: ImportEtherpad.js
2021-02-21 21:09:02 -05:00
John McLear
613c7d8545
lint: ExportTxt.js
2021-02-21 21:09:02 -05:00
John McLear
d2359be08b
lint: ExportHtml.js
2021-02-21 21:09:02 -05:00
John McLear
5718c8b360
lint: AbsolutePaths.js
2021-02-21 21:09:02 -05:00
John McLear
b1614f0592
lint: i18n.js
...
Partial, still 3 more to do that are slightly higher hanging that can get done.
2021-02-21 21:09:02 -05:00
John McLear
586af5e16e
lint: padurlsanitize.js
2021-02-21 21:06:38 -05:00
John McLear
86c938cae2
lint: openapi.js
2021-02-21 21:06:38 -05:00
John McLear
25d4faddd9
lint: SocketIORouter.js
2021-02-21 21:06:38 -05:00
John McLear
5201cb717f
lint: PadMessageHandler.js
2021-02-21 21:06:38 -05:00
John McLear
d67f170c46
lint: eejs/index.js
2021-02-21 21:06:38 -05:00
John McLear
3ed4ac649c
lint: PadManager.js
2021-02-21 21:02:59 -05:00
John McLear
1b8cd0747d
Move vendor libraries to /vendors folder and exclude from LGTM
2021-02-21 15:07:39 +00:00
webzwo0i
0bb3e65020
fix for caching plugin-definitions
2021-02-21 14:31:15 +00:00
John McLear
bb14775820
drop apiRoot object from build
2021-02-21 11:08:07 +00:00
John McLear
ee2b32281c
pluginfw: Warn plugins on missing plugin ( #4826 )
...
* pluginfw: Warn plugins on missing plugin
Add functionality to console.warn when a plugin is missing. This will help admins know when people are trying to use plugins that are missing. Resolves https://github.com/ether/etherpad-lite/issues/4730
* pluginfw: importing .etherpad can notify admins of missing plugins
Extending .etherpad imports to notify admins if a missing plugin is present
* Update ImportEtherpad.js
2021-02-21 11:07:13 +00:00
Richard Hansen
b3b5af3c3c
plugins: Use npm
CLI to install/uninstall plugins
...
Using npm as a module has long been discouraged and will stop working
with npm v7.
2021-02-18 19:18:59 +00:00
Richard Hansen
1cfbf88f7c
run_cmd: Enhance with ability to return stdout as string
2021-02-18 19:18:59 +00:00
Richard Hansen
d8bb5aa009
plugins: Eliminate unnecessary run_npm.js
...
I had anticipated more shared logic than we actually need (the
abstraction in `run_npm.js` is YAGNI).
2021-02-18 19:18:59 +00:00
Richard Hansen
426c025127
run_cmd: Log to Etherpad logs by default
2021-02-18 19:18:59 +00:00
Richard Hansen
dcf7891316
plugins: Improve logging of plugin events
...
This will make it easier to troubleshoot plugin and npm issues.
2021-02-18 19:18:59 +00:00
Richard Hansen
a45e85a730
Use settings.root
to anchor pathnames
2021-02-18 19:18:59 +00:00
Richard Hansen
f868788417
Remove unnecessary path.normalize()
calls
...
`path.join()` already normalizes.
2021-02-18 19:18:59 +00:00
Richard Hansen
84c1d74f8b
server: Fix Gate constructor
...
The ECMAScript spec for `.then()` requires Promise subclass
constructors to take an executor.
2021-02-18 19:18:34 +00:00
Richard Hansen
4c6cb53d18
server: Improve log messages when exiting
2021-02-18 19:18:34 +00:00
Richard Hansen
fb745374c3
import: Improve error logging
2021-02-18 03:42:41 -05:00
Richard Hansen
00d45e3229
Defer rate limiter creation to a hook call
...
This makes it possible to change the rate limiter settings via
`/admin/settings` or by modifying the appropriate settings object and
reinvoking the hook.
2021-02-16 21:13:35 -05:00
Richard Hansen
d7ed71eba0
plugins: Fix "Error: spawn npm ENOENT" error on Windows
...
On Windows, npm should be invoked as `npm.cmd`, not `npm`. Use a
drop-in replacement for `child_process.spawn()` that does the right
thing on Windows.
2021-02-16 22:00:20 +00:00
John McLear
b7e88cb904
security: New setting for Socket.IO maxHttpBufferSize
2021-02-15 12:45:31 -05:00
Richard Hansen
ed93ef5636
/admin/settings: Reload plugins, call loadSettings
hook on restart
...
This should match the normal startup procedure a bit more closely.
2021-02-15 08:43:14 +00:00
Egil
9c7dcb1d0a
eejs: Upgrade ejs to the latest version
...
The type of ejs's `__output` variable is now string instead of array
of strings, so the handling of `__output` had to change.
2021-02-14 23:36:53 -05:00
John McLear
615e47114b
Revert "socketio: increase socketio limit to 1MiB"
...
This reverts commit 55c96e5577
.
2021-02-14 16:53:48 +00:00
Richard Hansen
b711ff6acf
import: Ajaxify pad import
...
This eliminates an inline script (good for Content Security Policy)
and improves the user experience.
2021-02-14 08:35:38 +00:00
Richard Hansen
fba55fa6cf
ImportHandler: Refactor doImport()
for readability
2021-02-14 08:35:38 +00:00
Richard Hansen
28b28866a2
ImportHandler: Move the logger up
...
Also change the name to something shorter.
2021-02-14 08:35:38 +00:00
Richard Hansen
26b5a69ccc
ImportHandler: Use JSON.stringify()
to properly escape characters
2021-02-14 08:35:38 +00:00
Richard Hansen
ed80883709
ImportHandler: Lint the response script sent to the browser
2021-02-14 08:35:38 +00:00
Richard Hansen
0ff131bbbb
ImportHandler: Throw Errors, not strings
2021-02-14 08:35:38 +00:00
Richard Hansen
908635a1de
ImportHandler: Use return reject(...)
to avoid double settle
2021-02-14 08:35:38 +00:00
Richard Hansen
e01059dce5
ImportHandler: Switch to fs/promises
API
2021-02-14 08:35:38 +00:00
Richard Hansen
5b1b030906
ImportHandler: Use asynchronous rename instead of fs.renameSync()
2021-02-14 08:35:38 +00:00
Richard Hansen
c7b1abebe4
ImportHandler: Avoid deprecated fs.exists()
function
2021-02-14 08:35:38 +00:00
Richard Hansen
008209b0e0
ImportHandler: Delete redundant variable
2021-02-14 08:35:38 +00:00
Richard Hansen
48205c1ddb
import/export: Make sure Express sees async errors
...
Express v4.x does not check to see if a Promise returned from a
middleware function will be rejected, so explicitly pass the Promise
rejection reason to `next()`.
We can revert this change after we upgrade to Express v5.0.
See https://expressjs.com/en/guide/error-handling.html for details.
2021-02-14 08:35:38 +00:00
Richard Hansen
e674d9789e
express: Change httpUptime
to httpStartTime
( #4777 )
...
It's better to provide a primitive value and let the consumer of the
metric do math if desired.
Co-authored-by: John McLear <john@mclear.co.uk>
2021-02-14 07:50:10 +00:00
Richard Hansen
ac52fb8a9d
express: New httpUptime
metric
2021-02-13 10:02:28 +00:00
John McLear
483f4344c2
performance: maxAge for favicon and plugin definitions ( #4761 )
2021-02-13 08:13:48 +00:00
Richard Hansen
d56a02c85a
express: Forcibly terminate HTTP connections when restarting
...
This should make restarts via `/admin` actions (e.g., plugin
installation) more reliable.
2021-02-13 07:37:22 +00:00
John McLear
4c4c7b526d
performance: i18n maxage ( #4759 )
2021-02-13 02:35:25 -05:00
Richard Hansen
01c83917d1
socket.io: Manually track client connections/disconnections
...
This change is required for socket.io 3.x because in 3.x
`io.sockets.clients()` no longer returns all client Socket objects.
2021-02-13 07:13:37 +00:00
Richard Hansen
8f2f6593be
lint: Re-run eslint --fix
2021-02-13 00:31:36 -05:00
John McLear
55c96e5577
socketio: increase socketio limit to 1MiB
2021-02-12 17:56:50 -05:00
Richard Hansen
73d31b12a8
Minify: Replace deprecated url.parse()
with new URL()
2021-02-12 07:08:51 +00:00
Richard Hansen
7efca7dc7d
Minify: Don't ignore request headers in requestURI()
2021-02-12 07:08:51 +00:00
Richard Hansen
7a003cb9e2
Minify: Let Express render the 500 error page
2021-02-12 07:08:51 +00:00
Richard Hansen
44e420b6c5
Minify: Return Date
objects from statFile()
2021-02-12 07:08:51 +00:00
Richard Hansen
aa11667ff7
Minify: Use fs.promises
2021-02-12 07:08:51 +00:00
Richard Hansen
073052ac66
Minify: Asyncify minify()
2021-02-12 07:08:51 +00:00
Richard Hansen
3eefe71834
Minify: Don't set cache headers if statFile()
causes 500
2021-02-12 07:08:51 +00:00
Richard Hansen
84190793dc
Minify: Asyncify getFileCompressed()
2021-02-12 07:08:51 +00:00
Richard Hansen
dd7ea1a8f9
Minify: Asyncify statFile()
2021-02-12 07:08:51 +00:00
Richard Hansen
947dc8eeed
Minify: Asyncify getFile()
2021-02-12 07:08:51 +00:00
Richard Hansen
5d7c07e81c
Minify: Asyncify lastModifiedDateOfEverything()
2021-02-12 07:08:51 +00:00
Richard Hansen
e573276755
Minify: Asyncify getAceFile()
2021-02-12 07:08:51 +00:00
Richard Hansen
5cc191f185
Minify: Replace async.forEach()
with Promise.all()
2021-02-12 07:08:51 +00:00
Richard Hansen
0c428e068e
Minify: Use Promise.all()
to simplify requestURIs()
2021-02-12 07:08:51 +00:00
Richard Hansen
1ec29e0d45
Minify: Asyncify requestURI()
2021-02-12 07:08:51 +00:00
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