Commit Graph

783 Commits

Author SHA1 Message Date
panpawn
12052dee7c Allow bash to take multiline input (#2791) 2016-09-27 23:53:55 -07:00
Bär Halberkamp
dcfc521b59 Refactor rooms.js to use ES6 classes (#2787) 2016-09-26 15:06:47 -07:00
Guangcong Luo
02deaed256 More reliable /updateserver
The old /updateserver used the equivalent of

    git pull --rebase
    (if that fails)
    git stash && git pull --rebase && git stash pop

The new /updateserver works on

    git fetch && git rebase --autostash FETCH_HEAD

Which is a lot simpler and should in theory be more resilient to merge
conflicts while stashing.
2016-09-26 14:55:49 -07:00
Guangcong Luo
3280e453f6 Show error message for /bl show 2016-09-26 17:25:54 -04:00
Guangcong Luo
b1bfdeadcf Support passing roomid to /blacklists 2016-09-26 17:25:54 -04:00
Guangcong Luo
5a16c884da Fix a variety of bugs in PM commands
Most of these were introduced in the PM refactor, but an honorable
mention goes to the global command regex.
2016-09-25 14:12:43 -04:00
Guangcong Luo
53dd09fba0 Refactor modjoin
This unifies modjoin checks (both Room#modjoin and Room#staffRoom join
restrictions) under one function, Room#checkModjoin.

This makes it easier for commands to check whether a user should know
about a room's existence, which, previously, had been duplicated
unreliably in each command's implementation.

Fixes #2426
2016-09-24 23:14:16 -07:00
Guangcong Luo
1427871a09 Refactor Messages
PMs no longer special-case commands. The implementation of /invite,
/me, etc in commands have been fully moved from messages.js back to
commands.js and the rest. This makes Messages command support a lot
closer to how CommandParser itself handles commands; the two files
should be mergeable soon.

/me has been refactored, and now supports /ME, /me's, etc in PMs and
regular chat exactly the same way.

context.pmTarget is now guaranteed to be `User|undefined`, rather than
its previous specification of `User|string|undefined`. The previous
use-case of putting a string in context.pmTarget was to support
errorReply when PMing a nonexistent user, but special-casing that
case is easier than having to support a possible string pmTarget
everywhere.
2016-09-24 23:14:16 -07:00
Bär Halberkamp
baad5271a4 Add /blacklistname 2016-09-24 22:49:51 +02:00
Ben Davies
a88825e55f CommandParser: register global command aliases, optimize TestPattern registration (#2777)
Aliases like /j used to not work when called from the global room while not in
lobby.

Using rest parameters for TestPattern#register instead of a
single array came out to be faster.

/roomtopic also isn't a command.
2016-09-23 19:50:56 -05:00
panpawn
56da7a8d6d Make Messages submodule of CommandParser (#2754)
I don't think this should have it's own global... Besides, this makes it hotpatchable with /hotpatch chat
2016-09-20 09:42:02 -07:00
panpawn
c0ab0cf22b Add alias of 'globalunban' to unglobalban command (#2760) 2016-09-20 09:02:14 -07:00
XpRienzo
a04385fb1a Fix globalban help (#2755)
Since the help lists /gb as an alias of globalban rather than /gban being the short alias..
2016-09-20 09:00:48 -07:00
The Immortal
c9968866f1 Roomban: Prevent groupchats from triggering CrisisMonitor 2016-09-20 03:43:02 +04:00
panpawn
6534f0965e Fix typo in roomunban message (#2756)
It had the same message as a global unban; there was no way to tell the difference...
2016-09-19 05:24:45 -07:00
Guangcong Luo
e9865056f0 Fix some typoes in ban/blacklist 2016-09-18 13:13:09 -04:00
Ivo Julca
039404d62e Fix commands sent to global room with empty target 2016-09-18 02:42:54 -05:00
Ivo Julca
8713026c8b
Fix several crashes due to missing room properties 2016-09-18 01:05:26 -05:00
Ivo Julca
ce9cdecafd Drop commands sent to rooms from outside 2016-09-17 19:42:15 -05:00
Guangcong Luo
a41493a887 Rephrase roomban message
The roomban message was previously the same as the old globalban
message. This rephrasing makes it clearer.
2016-09-17 08:13:13 -07:00
Guangcong Luo
50d12f6fdf Fix permissions in /help blacklist 2016-09-17 01:57:27 -07:00
Guangcong Luo
54c86bf616 Make !help broadcastable 2016-09-17 01:45:19 -07:00
Guangcong Luo
ca8b6008d2 Fix typo in blacklist help 2016-09-17 01:39:37 -07:00
Guangcong Luo
6b4eaf9422 REALLY support commands in PMs
These changes were supposed to be in de524c1a26 but got lost in my
Git stash...

Once again, this is very experimental code; please don't base any
serious changes on it.
2016-09-17 01:16:56 -07:00
Guangcong Luo
b9e5fda591 Add [reason] to roomban/blacklist documentation 2016-09-16 22:41:43 -07:00
Guangcong Luo
8e478f5a4c Implement /showblacklist
Also fix up some surrounding code.
2016-09-16 22:39:54 -07:00
Guangcong Luo
8367425694 Fix bugs in roomban/blacklist refactor
- /ip would display "undefined" for rooms a user isn't banned/muted in
- CrisisMonitor would report private roombans/blacklists
- Roombans/blacklists would alert for rooms you're not in
- There were crashes in /mute and /hidetext
2016-09-16 20:20:32 -07:00
Guangcong Luo
05ae323fcd Refactor roombans/blacklists
Roombans/blacklists have been mostly rewritten from scratch.

The new code mostly uses the same patterns as global punishments.

In addition:
- /ban has been renamed /globalban
- globalbans and blacklists now require a reason
- bans and blacklists in public rooms now show up in global modlog
- blacklist syntax is different: /blacklist and /unblacklist
- ban/blacklist display in /whoare is now more detailed
2016-09-16 10:27:26 -07:00
Guangcong Luo
7a7b46bc1e High priority blacklists fixes
This isn't all the work that needs to be done on blacklists, but it's
the highest-priority changes.

- blacklists.tsv has been renamed room-punishments.tsv
- The format everywhere has changed to roomid:userid, rather than
  roomid|userid
- roompunishments.tsv's format is now `Room ID:User ID, IPs and alts`
  rather than `User ID, Room ID|IPs and alts`, which is more sane and
  also cuts down on repetition of room IDs

Those are the changes that affect storage format, which are highest
priority because I don't want to support the previous format.

Other changes include:
- Punishments.roombannedIps renamed to Punishments.roomIps
- Punishments.roombannedUserids renamed to Punishments.roomUserids
- Some refactoring for ES6 destructuring
- Various bugfixes
2016-09-15 06:10:54 -07:00
Guangcong Luo
51db68fba5 Move banword to roomsettings 2016-09-15 06:10:54 -07:00
The Immortal
3edb5b5721 Roomban: Don't show list of room staff for battles 2016-09-15 16:40:50 +04:00
Bär Halberkamp
28c0a2a22c Rewrite roombans to be timed as well (#2545)
Also implement blacklists
2016-09-15 04:35:00 -07:00
Guangcong Luo
77b59e7858 Add quick and dirty /adddatacenters command
The /adddatacenters command should probably not be used by most people,
but here is some documentation if you insist.

It takes a list of datacenters in CSV format and adds them to
config/datacenters.csv

The advantage over doing it yourself is that it preserves the sort
order and warns for intersections. For most intersections, the correct
response is to let it pass, but if your range is too wide, you should
remove the too-narrow ones and retry.
2016-09-15 03:36:35 -07:00
Bär Halberkamp
e61e28fb57 Fix typo in roomauth 2016-09-12 20:04:41 +02:00
Guangcong Luo
8a32b8e1a8 Stop highlighting hotpatcher for /hotpatch
This uses our new timestamped log message style.

Fixes #2711
2016-09-10 15:52:25 -04:00
Guangcong Luo
c030c84245 Move "too many battles" messages to monitor.js 2016-09-10 15:52:16 -04:00
Guangcong Luo
505d68923b Refactor/redesign roomsettings
Room setting commands, including /modchat and also /capsfilter, are now
set in chat-plugins/roomsettings.js.

/capitals has been renamed /capsfilter
/stretching has been renamed /stretchfilter

The /roomsettings UI has been redesigned.
2016-09-10 05:54:24 -05:00
Ivo Julca
8efe22a8fe
Add missing error messages in several commands 2016-09-09 06:12:31 -05:00
Ben Davies
1653a1f692 Allow users to use /roomauth in private rooms with modchat with permission (#2727)
Users must either be in the room or have room rank in the private room.
2016-09-07 04:14:02 -05:00
Guangcong Luo
945839144c Change slowchat requirements to mod+ 2016-09-02 03:27:09 -04:00
Taylor Everding
1a1f64fe95 Remove .js extension from requires (#2725) 2016-08-30 00:04:40 -05:00
Guangcong Luo
d15427df73 Fix modlog permissions
Global drivers (that is, anyone with the global modlog permission) now
have access to modlogs in private rooms.

Global drivers and up can use modlog all to get access to private room
modlogs anyway, so this makes it more consistent.
2016-08-29 02:09:07 -05:00
Ben Davies
28049b6540 Fix crash in /modjoin (#2728) 2016-08-29 02:05:36 -05:00
Guangcong Luo
54b672fe4e Start refactoring for template strings
This commit introduces Tools.html and Tools.plural, helper functions
for string construction.

Tools.html is a template tag function that escapes HTML inside the
template string.

Tools.plural is a helper function that takes a passed Number, Array,
Set, or Map and returns a string representing whether or not it's
plural.

It also starts doing some refactors of some files to make it clear how
I expect code style for template strings to look.

Previously, we used ' for IDs, " for English text, and ' for code.

We should now be using ' for IDs, ` for English text, and ` for code.
2016-08-28 04:35:43 -05:00
Bryan AA
4bacb9a549 Fix some unnecessary errorReply usage (#2721) 2016-08-27 14:28:34 -05:00
spekss
276f40e9a6 Bold rank headers in /auth (#2712)
PREVIEW:
<img src="http://image.prntscr.com/image/a270bfdd31b8479d9f0847fe251c576e.png">
2016-08-24 03:16:30 -05:00
Guangcong Luo
51668b85fd Log who deleted a room 2016-08-22 18:25:16 -05:00
Guangcong Luo
bbc198c015 Fix /deleteroom permission 2016-08-22 17:42:55 -04:00
Guangcong Luo
bcc417baf9 Refactor User#games to Map
User#games, previously a null-prototype roomid:game Object,
is now User#games, a roomid:game Map.

It would have been refactored into a roomid Set, but I'm afraid of
inconsistent state, even more so than I am of the corresponding
problem in Connection#inRooms. TODO: that.

This also fixes the handling of the race condition where a ladder
battle starts after a user starts a name change but before the name
change finishes.

Now, the battle is force-forfeited. Perhaps the ladder battle
should be prevented if the user changes name...
2016-08-22 03:58:15 -05:00
Guangcong Luo
1a1530f4ff Refactor Connection#rooms to Set
Connection#rooms, previously a null-prototype roomid:room Object,
is now Connection#inRooms, a roomid Set.

This, incidentally, makes it stop retaining rooms, which may make the
GC's job easier and may also lead to unexpected bugs if we get
inconsistent state (we often do get inconsistent state, so look
forward to that!)

The rename is mostly to put it in line with the new User#inRooms,
and for ease of greppability without running into Rooms.rooms.
2016-08-22 03:57:52 -05:00