Commit Graph

451 Commits

Author SHA1 Message Date
Joimer
2c7a9d5ad0 Improve room auth listing command 2013-08-23 15:33:39 +02:00
Joimer
ee7a3588d5 Implement room auth check 2013-08-23 15:30:22 +02:00
Joim
6728fb289e Room bans: Add check for user id being correct but targetUser not existing 2013-08-23 09:05:32 +02:00
Slayer95
18c71d9698 Fix redir
Properly detect if room was joined.
Remove double join.
2013-08-20 15:22:33 -05:00
Joimer
00c2ac53c9 Add help for room ban, room unban, and redirect commands 2013-08-20 09:50:49 +02:00
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
Slayer95
001904cf94 Update commands.js 2013-08-19 01:24:35 -05:00
Guangcong Luo
5ec8a5b353 Allow blank messages to be sent by /me 2013-08-18 22:05:29 -07:00
小太
f2f973fe29 Obliterate trailing whitespace 2013-08-18 21:33:15 +10:00
Joimer
d0d3588226 Use safer userid on roomban 2013-08-17 17:26:04 +02:00
Joimer
5c347ce0a8 Fix join bug: Do nothing on empty target 2013-08-17 12:36:36 +02:00
Joimer
a6ad0f351f Check correctly for users and guests bans in rooms 2013-08-17 11:22:01 +02:00
Joimer
ddcf38bcbc Don't check for guests or for battles for room bans 2013-08-17 11:12:46 +02:00
Joimer
36db1bc9d4 Memory usage control: Add memory usage report command
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.
2013-08-16 21:34:01 +02:00
Joimer
cabd403332 Implement Room Ban
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.
2013-08-16 20:37:51 +02:00
Joim
fd879e7cf6 Fix crash in 'roomowner' command
Using room owner on a room not designed for per-room staff 
crashed the server.
2013-08-14 22:59:39 +02:00
Ethan
6b87cb7083 Return correct command when using /demote
Previously if you used /demote and didn't have permission to it would return /promote - Access denied.
2013-08-12 05:52:51 -05:00
Slayer95
e30e58ed14 Show 'access denied' message for redir 2013-08-11 22:46:34 -05:00
Slayer95
aa6ff5b32b Support using room title for /redir 2013-08-09 01:50:25 -05:00
Joimer
1275006795 Make redir not redir to the same room
It's redundant.
2013-08-08 20:59:32 +02:00
Joimer
762b343977 Crash hotpatch gracefully and inform of the exact error
If a hotpatch fails, it now fails gracefully and informs of the
error stack trace.
2013-08-08 10:12:42 +02:00
The Immortal
d7a4e3666f GP 1/2 2013-08-07 08:44:35 -07:00
Joim
272b2ae691 Fix redir with target with no target room crashing 2013-08-06 22:02:00 +02:00
Joimer
f9951f3471 Fix abusable loophole in redir
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.
2013-08-06 13:15:39 +02:00
Guangcong Luo
4327fd9cd6 Fix crashes in room commands with blank IDs 2013-08-03 10:48:26 -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
Guangcong Luo
64e92e98bf Fix crash in /autojoin 2013-08-02 23:09:27 -07:00
Guangcong Luo
707185303d Overhaul system for deleting chat rooms 2013-08-02 23:05:11 -07:00
Guangcong Luo
7497434755 Support /autojoin 2013-08-02 23:04:41 -07:00
Joimer
57f66b3e9d Add deletechatroom command
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.
2013-08-01 21:41:39 +02:00
Joimer
fede78bd8c Fix obscure bug deroom commands
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.
2013-08-01 15:06:27 +02: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
Joim
28d09cffb0 Fix typo in previous commit
config.groups[nextGroup] was mysteriously changed to config.gorups[nextGroup].
2013-07-31 12:11:46 +02:00
Joim
959e33c2e0 Fix promote/demote command: Jump room owner rank
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.)
2013-07-31 12:09:44 +02:00
Guangcong Luo
ea47a38da0 Only private rooms require login 2013-07-27 10:39:42 -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
Joim
76c6acc093 Don't start timer on ended battles on lockdown
Lockdown is starting the timer on all battles without timer. This is not necessary in finished battles.
2013-07-26 21:24:41 +02:00
Guangcong Luo
d51d65b32b Don't allow /endlockdown outside of lockdown 2013-07-24 21:55:33 -07:00
Guangcong Luo
6e353bbab0 Update loadbanlist permissions 2013-07-14 21:13:49 -07:00
Guangcong Luo
365e3dbbbc A lobby room is no longer required to exist
Without a lobby room, joining your server will default to displaying
the room list.
2013-07-14 17:59:48 -07:00
Guangcong Luo
562d1edbba Refactor: Data is no longer a global
It can still be accessed with Tools.data or Tools.mod(mod).data
2013-07-14 11:37:01 -07:00
Joimer
e2a0bb6336 Merge branch 'master' of http://github.com/Zarel/Pokemon-Showdown 2013-07-14 20:17:27 +02:00
Guangcong Luo
76530e66ec Refactor: lockdown now a property of Rooms.global
(and no longer a global)
2013-07-13 19:15:31 -07:00
Guangcong Luo
7e1c6f2659 Work around an obscure bug with banned users
A user with a banned latestIp but hasn't been forceDisconnected exists.
This is possibly a race condition?
2013-07-12 22:35:39 -07:00
Joimer
9bf3b84a8b Add Room Owner removal command
Add Room Owner removal command for admins, to remove abusive or inactive room owners.
2013-07-12 21:27:33 +02: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
Joim
f263eeb5ff Hide private room names on redir
When redirecting a user to a private room, hide its name.
2013-07-05 12:03:51 +02:00
Guangcong Luo
c21ee6d0e0 Make /join use ID only as fallback
Fixes the bug where it was impossible to join battles
2013-07-04 15:51:45 -07:00
The Immortal
5d203f0792 Make /join use the id 2013-07-04 13:29:12 +04:00
Guangcong Luo
9e6a353a0b Don't crash when using /roommod on official rooms 2013-07-03 20:43:17 -07:00
Guangcong Luo
7e63ce6660 Private room updates
- 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
2013-07-03 20:31:10 -07:00
Joim
cb47b17aa1 Redirect can't redirect to an empty room
Redirect is not intended to act as a kick, so if no room name is given it will fail and communicate it.
2013-07-03 10:43:25 +02:00
Joimer
6bd99a86b4 Add redirect command
Add a new version of redirect of redir command, which will kick the target user from the room and make it join another room.
2013-07-03 10:33:06 +02:00
Guangcong Luo
785113099d Support showing room lists 2013-07-03 00:32:21 -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
f02eb27b18 Unlink locked users' links 2013-06-30 20:39:50 -07:00
Guangcong Luo
bc6d458aa8 Merge pull request #251 from Joimer/patch-22
Add note command
2013-06-27 14:47:34 -07:00
Joim
19f6ebccb0 Revamp note command, now modnote
Make it clear that it's a private user. Mod notes are no longer restricted to an user, all mods can add a note for anything.
2013-06-27 21:54:59 +02:00
Cathy J. Fitzpatrick
e89334576a Remove now-unnecessary link targets
As of Zarel/Pokemon-Showdown-Client@77c6bac6a3, it is no longer
necessary to specify target="_blank" in raw HTML sent to the client.
2013-06-21 15:50:38 -06:00
Cathy J. Fitzpatrick
4e4e10736c Support # comments in ipbans.txt 2013-06-18 15:42:13 -06:00
Cathy J. Fitzpatrick
cdae4b243a Log use of /hotpatch 2013-06-17 04:11:43 -06:00
Cathy J. Fitzpatrick
941da0f043 canTalk now applies more uniformly
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.
2013-06-17 03:53:46 -06:00
Joim
643a8fb6af Add note command
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.
2013-06-14 10:51:03 +02:00
Cathy J. Fitzpatrick
e2fcd07e7b Consistent notation for /fr message
Messages sent only to auth are consistently enclosed in brackets now.
2013-06-13 02:31:34 -06: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
3d27905c6a Eliminate getConnectionFromSocket 2013-06-12 03:37:30 -06:00
Cathy J. Fitzpatrick
65fb12dddc Introduce appealurl config option 2013-06-10 00:38:29 -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
Marty-D
6d31c256b0 Fix a crash in /forcewin. 2013-06-07 15:01:29 -04:00
Cathy J. Fitzpatrick
dad06ad7f3 Send |unlink| message when banning user 2013-06-07 01:39:39 -06:00
Guangcong Luo
4b2f3c8e40 Fix bug in muting? 2013-06-04 15:08:12 -07:00
Cathy J. Fitzpatrick
25a04b0a73 Remove modchat registered 2013-06-04 00:53:56 -06:00
Guangcong Luo
680b61eb19 Bugfixes for room titles 2013-06-02 00:31:13 -07:00
Guangcong Luo
01656c0141 Per-room muting 2013-06-02 00:20:56 -07:00
Guangcong Luo
ed6c007349 Support titles for rooms. 2013-06-02 00:20:33 -07:00
Guangcong Luo
c922d9aad4 Fix /loadbanlist counter 2013-05-31 23:41:15 -07:00
Guangcong Luo
4698dbe635 More feedback for /loadbanlist 2013-05-31 23:31:29 -07:00
Guangcong Luo
fee174e2a8 Multiline eval
">> " 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.
2013-05-31 00:10:24 -07:00
Cathy J. Fitzpatrick
b399f6a3f0 Implement |noinit| and |deinit| 2013-05-30 22:10:53 -07: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
Guangcong Luo
d6ccbc1157 Locked users can't PM 2013-05-29 14:43:41 -07:00
Guangcong Luo
8cfba3955b Moderators can no longer set modchat registered
It's been abused too much. :/
2013-05-29 02:37:46 -07:00
Cathy J. Fitzpatrick
44142a6849 Improve modlog error message 2013-05-27 16:54:18 -06:00
Cathy J. Fitzpatrick
6540cf4e53 Send |roomerror| message when failing to join a room 2013-05-25 04:20:48 -06:00
Guangcong Luo
27be062395 Tons of documentation 2013-05-24 14:59:29 -07:00
Guangcong Luo
04c493818c Fix crash in /loadbanlist 2013-05-24 14:59:29 -07:00
Guangcong Luo
d5871fc948 Tighten /privateroom permissions 2013-05-24 11:52:01 -07:00
Joim
50fb2617f7 Fix bug in modlog, allow to search names that begin with numbers
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.
2013-05-24 17:49:09 +02:00
Guangcong Luo
a964543ffb Commands for making chatrooms
(Currently admin-only and highly experimental)
2013-05-23 22:17:16 -07:00
Guangcong Luo
61a79315c0 Fix crashes in /promote and /lobbychat 2013-05-23 21:44:59 -07:00
Guangcong Luo
1b560bee97 Fix crash in /updateserver 2013-05-23 21:40:09 -07:00
Guangcong Luo
5e55412b62 Fix forfeit button 2013-05-23 21:34:31 -07:00
Guangcong Luo
f4fbb273c7 Fix crash when uploading replay 2013-05-23 21:08:21 -07:00
Guangcong Luo
3deb9d2b5a Fix bugs with challenging other users 2013-05-23 21:07:40 -07:00
Guangcong Luo
0c0019f010 Rename broadcastable to canBroadcast for consistency 2013-05-23 19:32:34 -07:00
Guangcong Luo
0f87f8e59d canTalk now handles all chat filtering 2013-05-23 19:31:21 -07:00
Guangcong Luo
e73e3f14e5 Move access denied message to this.can 2013-05-23 19:18:15 -07:00
Guangcong Luo
3544815e97 Fix a bunch of bugs in chat commands 2013-05-23 05:51:10 -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