Implemented some changes from #306.
The bans are checked now on User.prototype.joinRoom.
Redirect command now does not override room bans.
Commands now control if the room is designed for room bans.
Several small style improvements.
Admin-only, this command will show you the server's memory usage.
Additionally, you can use ResourceMonitor.sizeOfObject in any
scope to find out how many bytes does an object weigh.
Implement a Chat Room wide Room Ban and its counterpart, Unban.
The actions are saved in the modlog. The perpetrator and the punished
must be both in the same run and the .can function assorts the first
can punish the latter.
The names and IPs are saved separatedly to make easier to keep track
of ban evaders. Even if thir nickname changes, their IP will be
banned, if their IP is the one that changes, the nick will be banned.
The alts of the person are also listed as banned, but they won't
be kicked since a person is supposed to be on one account at once.
This avoids schools and homes to be massively kicked from the same
room, but the bad user won't be able to use his other accounts from
that IP.
The bans are not saved and do not persist over server restart to
keep the memory at ease.
Redir used user.can as a way to stop lower auth from rediricting to
higher auth to other rooms.
However, if a user had auth over another user in a private room, this
user could redir the other user even if the latter had higher global auth
and/or was not in the room.
This commit fixes that, checking if a user is inside a room before being
able to use redir on they.
Now, most rooms inherit auth from global auth. In other words, if
you're a global driver but a room leader, you'll be a leader
in that room, but if you're a global driver but have no room
auth, you'll be a room driver.
The exception is private rooms with private auth: These don't
inherit, and in general are not bound by chat rules, so /warn
doesn't work in these rooms at all.
Add a command that deletes a chat room. It will first kick out all the users, try to delete all its data, and then write the result on the rooms json file, deleting it.
Sometimes a userid will be empty and it will crash the server. The first check on the function should be enough to be sure the room exists, this check further ensures that the command won't crash.
The function getNextGroupSymbol now takes an extra parameter to exclude room only ranks, which are defined in config.
The function will try to find the closest non room only rank with a safeguard against maliciously or badly crafted config.js to crash the server.
If no rank is found regardless of room only or not status, the first or last rank are returned accordingly.
This refactor allows getNextGroupSymbol's name to keep true to its functionality, while also providing a way to exclude crafted ranks for rooms or otherwise from the global demote/promote scheme.
Now Leader demotions go straight to Moderator, and Moderator demotions go straight to Leader. The ranks are hardcoded because both the symbol and name are subject to change, so there is no safe way to get the symbols from config.
The command now works as intended, test:
Popsickles was promoted to Leader by Joim.
(Popsickles was demoted to Voice by Joim.)
Popsickles was promoted to Driver by Joim.
Popsickles was promoted to Moderator by Joim.
(Popsickles was demoted to Driver by Joim.)
(Popsickles was demoted to Voice by Joim.)
Popsickles was promoted to Driver by Joim.
Popsickles was promoted to Moderator by Joim.
Popsickles was promoted to Leader by Joim.
(Popsickles was demoted to Moderator by Joim.)
Popsickles was promoted to Leader by Joim.
Popsickles was promoted to Administrator by Joim.
(Popsickles was demoted to Leader by Joim.)
(Popsickles was demoted to Moderator by Joim.)
Per-room auth is now less hardcoded. Promotion/demotion is still
done manually in commands.js, but at least users.js doesn't have
as much hardcoded.
A result of this is that /roomvoice is now possible.
- New command /roomowner, admin only; sets a room owner, marking a
room as unofficial if it wasn't already.
- New command /roomdesc, sets room description
- !roomhelp updated accordingly
- if room.auth exists, the room will have its own authority instead
of global authority
- # is room owner, % is room moderator, admins are still there, and
every other auth becomes voice
- % can mute/unmute/announce
- # can additionally roommod/deroommod/declare/modchat
- modchat is now per-room
- Rooms now stay in existence through restarts
- Room data is stored in config/chatrooms.json
- By default, there's a staff room autojoined by staff and joinable
only by staff
The `canTalk` filter now applies to broadcast commands and private
messages. In particular, this means that the maximum message length
(currently 300 characters) now applies to private messages.
Add a note command that adds silently a note to a user's modlog for other auth to read without giving actual punishment and without having the whole chat knowing.
This commit fixes a bug wherein an admin could forcibly rename herself
to a userid found on the console access list, and therefore gain console
access despite not being on the list themselves.
">> " and ">>> " now accept multiple lines. In addition, ">> "
does not broadcast by default.
Their functionality are also available by !eval (which does
broadcast) and !evalbattle, although those are single-line.
While /eval doesn't broadcast, /evalbattle still does because
it's unnecessarily difficult to make simulator processes send
things privately.
Certain actions are now shown only to online auth, the modlog,
and the room log. These include:
- Demotion
- Muting/locking/banning a user that's already muted/locked/banned,
without a message
If you search a name that begins with a number, like 10asdf, parseInt will return 10 and modlog thinks you are looking for a number of lines. Fix this testing target to see if it has a non-numerical character.
chat-commands.js is no more, it's been split into command-parser.js,
commands.js, and config/commands.js.
There's also a new API for commands which should be much easier to
use.