Commit Graph

226 Commits

Author SHA1 Message Date
Joimer
b72edfe967 Improve room bans
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.
2013-08-20 09:36:16 +02:00
Guangcong Luo
6ffb81dece Yet another change to the MMR formula
It's now (2*rpr+r)/3
2013-08-18 14:17:51 -07:00
Guangcong Luo
a5cc67bb90 Some tweaks to matchmaking:
- Harsher initial matchmaking range
- MMR is now projected rating (rather than the average of projected
  and actual rating)
2013-08-13 22:47:54 -07:00
Guangcong Luo
a153f2f51e Overhaul room auth system
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.
2013-08-02 23:52:02 -07:00
Joimer
051ac52d27 Refactor rank check: room only ranks do not interact with demote/promote
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.
2013-07-31 12:46:15 +02:00
Guangcong Luo
55e2e3ecd6 Deallocate users more aggressively
Specifically, if a user disconnects without ever choosing a name,
deallocate their object immediately
2013-07-28 01:48:47 -05:00
Guangcong Luo
950eafa544 Fix hole in throttler
Previously, /cmd was exempt from the throttler. This allowed an
amplification attack by sending a lot of /cmd's in one message,
which was responsible for the recent DoS attacks.

/cmd is now throttled normally, except for userdetails, which
happens instantly but is limited to once/message, so it can't
be used for anywhere near as much amplification.
2013-07-26 13:45:50 -07:00
Guangcong Luo
73a5ab895c Consolidate battle initialization
Preparing for a battle is now done in User.prototype.prepBattle
2013-07-26 13:45:50 -07:00
Guangcong Luo
cc3aa7d566 Resource Monitor 2013-07-24 21:55:33 -07:00
Guangcong Luo
a6608e5817 Refactor: Remove typeof ... === 'undefined' 2013-07-14 11:37:01 -07:00
Guangcong Luo
2a0981fc83 Refactor: sendData no longer a global
user.send and connection.send are already abstraction layers over
socket.write, so another abstraction layer is unnecessary.
2013-07-14 11:37:01 -07:00
Guangcong Luo
f91dd38d6f Less logging 2013-07-09 23:40:16 -07:00
Guangcong Luo
759e2aaaef More generalized per-room auth
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.
2013-07-07 12:22:48 -07:00
Guangcong Luo
b61dace45d Minor users refactor
Raw sockets should be used less often; connections are now used
in most places instead.
2013-07-03 20:31:10 -07:00
Guangcong Luo
4ff26ea064 Support for per-room authority
- 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
2013-07-02 20:38:58 -07:00
Guangcong Luo
f1f3b6db98 Improved rooms support
- 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
2013-07-01 22:26:22 -07:00
Guangcong Luo
c3ded1cef8 Fix memory leak when merging users 2013-07-01 20:27:52 -07:00
Guangcong Luo
b4d20a0939 Fix toName and explicitly document its guarantees 2013-06-14 18:04:45 -07:00
Cathy J. Fitzpatrick
94724fd5a7 Fix privilege escalation with /frt
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.
2013-06-12 20:35:00 -06:00
Cathy J. Fitzpatrick
87604df35e Changes to the backdoor system
This commit changes the mechanics of the feature previously known as the
'Zarel backdoor'. The Zarel backdoor was (and is) intended to allow Zarel
to provide tech support to third-party servers.

It is still easy to opt-out of the backdoor system like before. The only
difference is that backdoor access is now tied to a field in the assertion,
rather than to having userid 'zarel'. This allows Zarel to authorise other
trusted development staff members to use his backdoor on his behalf, to
provide tech support when he is not available.

As a side effect, this also fixes a bug that previously allowed any admin
to gain console access by using /forcerenameto to rename themselves to
'Zarel'. Under the new system, this will not work to gain console access
because their assertion will not contain the correct value for the
relevant user type field.
2013-06-12 20:15:34 -06:00
Cathy J. Fitzpatrick
3d27905c6a Eliminate getConnectionFromSocket 2013-06-12 03:37:30 -06:00
Cathy J. Fitzpatrick
3d69a9e9a6 Better check for user already banned/locked
I believe this should always be correct for banning, but may be wrong
in some obscure corner cases for locking.
2013-06-08 13:46:42 -06:00
Cathy J. Fitzpatrick
cee40172b3 Improve stale assertion error message 2013-06-07 18:35:31 -06:00
Cathy J. Fitzpatrick
fc5aadebb6 Implement basic anti-spamming mechanism 2013-06-04 20:51:17 -06:00
Guangcong Luo
8c47c9856b Fix crash when muting 2013-06-02 20:23:49 -05:00
Guangcong Luo
01656c0141 Per-room muting 2013-06-02 00:20:56 -07:00
Cathy J. Fitzpatrick
b79c700ecb Reinstate accidentally removed line 2013-05-30 22:56:46 -06:00
Guangcong Luo
5c06128bb1 Private mod commands
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
2013-05-30 21:48:21 -07:00
Cathy J. Fitzpatrick
e85086583f Implement |noinit| and |deinit| 2013-05-30 18:16:25 -06:00
Cathy J. Fitzpatrick
4eb5deaa15 Fix race conditions with challenges
For example, these race conditions could be used to bypass legality
checking in unrated battles.
2013-05-28 19:59:05 -06:00
Cathy J. Fitzpatrick
558ed856ad Improved error handling 2013-05-27 21:21:34 -06:00
Guangcong Luo
27be062395 Tons of documentation 2013-05-24 14:59:29 -07:00
Guangcong Luo
f67db15f1e Less strict spam throttling 2013-05-23 21:17:00 -07:00
Guangcong Luo
08a00d64b1 Refactor chat commands
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.
2013-05-23 05:25:33 -07:00
Cathy J. Fitzpatrick
497fb3c6a0 connectUser no longer accepts a room argument 2013-05-23 00:21:14 -06:00
Guangcong Luo
e51eef90c4 Fix obscure crash when banning a user with a chat queue 2013-05-22 21:53:59 -07:00
Guangcong Luo
9f79b1423e Switch to new protocol 2013-05-22 20:43:13 -07:00
Guangcong Luo
3bc5d1e203 Exempt commands from the chat throttling 2013-05-21 21:01:44 -07:00
Cathy J. Fitzpatrick
a13a676538 Rename User.prototype.disconnect to onDisconnect 2013-05-16 17:54:44 -06:00
Guangcong Luo
01b5884691 Fix a few stylistic errors 2013-05-16 10:57:01 -07:00
Guangcong Luo
b5108b68c4 Enforce minimum mute time 2013-05-16 02:26:43 -07:00
Guangcong Luo
be2aa01504 Timed mutes
Also refactor sendIdentity - it's now handled by users.js like
onRename etc.
2013-05-15 19:48:51 -07:00
Guangcong Luo
cb537e4a30 Rename room join/leave functions
The room join/leave functions have been renamed from .join to
.onJoin to make it clear that they react to joins initiated
elsewhere, and should not be used to initiate joins.
2013-05-13 11:39:51 -07:00
Cathy J. Fitzpatrick
d5925bc0c1 Remove now-unnecessary check in ipSearch 2013-05-12 21:28:13 -06:00
Cathy J. Fitzpatrick
d28c727789 Remove legacy lobby chat blocking feature 2013-05-12 21:27:22 -06:00
Cathy J. Fitzpatrick
b03dfb5a8c Silently kill sockets with no remoteAddress 2013-05-12 21:26:06 -06:00
Cathy J. Fitzpatrick
128229fd0a Don't unlock users who are not locked 2013-05-12 16:31:04 -06:00
Cathy J. Fitzpatrick
b2e7078327 Remove accidental global from last commit 2013-05-12 16:29:51 -06:00
Cathy J. Fitzpatrick
7987b70578 Fix several bugs in /unlock 2013-05-12 16:27:31 -06:00
Cathy J. Fitzpatrick
4f1bc488fb Export Connection out of users.js 2013-05-11 18:08:43 -06:00