This is purely a readability change; behind the scenes there's now more
magic going on, but magic is good for text processing functions, which
are otherwise way too verbose.
Adds some more magic to make Chat.plural more readable when used to
count things.
Overall, it's not _nearly_ as concise as I'd like, but it might be the
best we can get for now.
Process Manager is now lib/process-manager.js
It's been entirely rewritten to reflect what I think a process manager
API should look like.
In particular, there are now two Process Managers, QueryProcessManager
and StreamProcessManager.
Pass QueryProcessManager a pure-ish query function (sync or async) that
takes a JSON value and returns a JSON value, and PM.query() will
execute that function in a subprocess, and return a Promise for its
return value.
StreamProcessManager is the same idea: Pass it a function to create an
ObjectReadWriteStream, and PM.createStream() will create a stream in a
subprocess and return a stream connected to it.
This is an update to match how Streams work: .read() returns a string,
and .readBuffer() returns a Buffer.
Being able to statically predict what type .read() will return is
really useful to TypeScript, in addition to being generally useful for
readability.
As a side benefit, readTextIfExists() is renamed readIfExists().
This makes it so staff-only HTML rooms can defer rendering until the
user has logged in.
This also introduces a new constant `Rooms.RETRY_AFTER_LOGIN` which
makes it clearer what returning `null` means in context.
* Don't show "More..." button if the amount of results is already less than the max
* Properly pass on whether an exact search was performed to the prettifying function
* Improve phrasing in reaction to whether an exact search was performed
* Allow "More..." button to do a literal modlog query instead of always doing a username search
* Reorder some lines pertaining to the line count so they're not needlessly scattered all over the place
Before, if you wanted to specify how many results you wanted from a modlog search:
1. You could not search for any text
2. It was capped at 100 results
Now, we drop support for the old means of specifying lines, and instead we have a "More results..." button in modlog's UI.
We also support an undocumented means of specifying lines in the form of: /modlog [roomid], [search] [lines=integer], where integer is the number of lines of results you would like to see.
NOTE: We purposely are not documenting this behavior, as it is mostly made use of in the UI
We also update the help command here to reflect these changes.
- spawning and setting up child processes is now handled by
ProcessManager#constructor rather than needing to be done manually for
each module that uses ProcessManager
- direct references to ProcessManager in ProcessWrapper were removed to
prevent dead ProcessWrapper instances from being leaked when hotpatching
- process-manager.js and verifier.js now use Typescript