Commit Graph

135 Commits

Author SHA1 Message Date
Guangcong Luo
a659f6733f Don't require HTTPS for images
Most images are hosted in places that already support HTTPS, so all
we need to do is transparently rewrite them to be protocol-local.

For the rest, I don't care enough to enforce HTTPS on them. At
least wait for browsers to complain more about it...
2015-12-12 20:52:56 -06:00
Ivo Julca
303155bdf3 Require HTTPS for images 2015-12-11 21:55:41 -05:00
Guangcong Luo
c40daad1cf Fix modchat permissions
It's no longer possible to set a modchat level you can't clear.
2015-11-24 10:07:06 -05:00
Guangcong Luo
a64875c2ed Refactor command permissions to use canTalk
Previously, we were manually checking muting and locking to see
whether or not a user was allowed to mute, modnote, etc.
2015-11-23 09:13:12 -05:00
Juanma Serrano
c4ac8d6e2f Use strict mode and let and const instead of var
This commit also fixes some duplicated variable declarations.
2015-11-06 21:56:52 -05:00
Guangcong Luo
378fc2eb25 Ban buttons in private rooms 2015-10-10 02:22:45 -04:00
Guangcong Luo
dd562ce1fd Drop support for passing username to getLastIdOf
This is unreliable and crash-prone and not actually used anywhere.
2015-10-10 02:22:45 -04:00
Guangcong Luo
1c9a971820 Buttons are now banned in personal rooms 2015-10-09 04:46:38 -04:00
Guangcong Luo
87023373a2 Document why image width/height is required 2015-10-07 02:13:23 -04:00
Ivo Julca
c94fe4a4e0 Fix errorReply for broadcast commands 2015-10-03 22:49:29 -05:00
Guangcong Luo
94cfd2b492 Disallow images in personal rooms 2015-10-01 18:10:06 -04:00
Guangcong Luo
810b74b2d1 Unify group chat modlogs
Group chat modlogs now work like battle modlogs, they're unified
instead of being spread out over every file.
2015-09-23 17:53:06 -04:00
Guangcong Luo
d34138f81e /invite will try to roomvoice if necessary
If a room is under modjoin, /invite will try to roomvoice a user who
doesn't already have permission to join the room.

This feature is pretty rudimentary and only works if the modjoin
setting is `+`, but I'm 80% sure it's better than nothing.
2015-09-23 03:36:32 -04:00
Guangcong Luo
f0ce808f4d Drop support for modchat crash
Modchat crash is no longer used for any crashes at all, so we might
as well simplify some code complexity and remove support for it.
2015-09-01 02:45:10 -05:00
Guangcong Luo
d287a4150d Load chat-plugins/info.js first so it can be shadowed 2015-08-09 04:20:29 -04:00
Ivo Julca
cd36fbfde2 Gulpfile: add more JSCS rules
- Disallow spaces between function names and round brackets.
- Disallow spaces inside array/object literal brackets.
- Disallow spaces before semicolons.
- Disallow yoda conditions for equality.
2015-07-28 19:38:53 -05:00
Guangcong Luo
800983f8f7 Fix this.inputUsername with no comma
This fixes the this.inputUsername API for .splitTarget for commands.
Mainly relevant to using /lock and /ban on a user who's renamed
themself.
2015-07-26 04:51:51 -04:00
Guangcong Luo
77dfc68445 Unlink/hide spammer usernames through renames
This also adds a new variable from .splitTarget, .inputUsername,
which represents the username before following the user through
renames.
2015-07-18 14:31:41 -04:00
Guangcong Luo
d206d3cc28 Allow admins to talk in private modchat rooms 2015-07-18 14:31:41 -04:00
Ivo Julca
cea3a13c11 Fix API to parse broadcast commands
Fixes the long-standing issue of bad interaction between `this.parse('!command')` and `this.canBroadcast()`: each time the latter was called, it would announce the command usage.
2015-07-14 04:40:32 -05:00
Guangcong Luo
57de9bacc9 Fix // becoming /// in command parser 2015-07-13 04:03:02 -04:00
Guangcong Luo
c5818939c8 Fix leading space getting around command permissions 2015-07-12 05:03:35 -04:00
Guangcong Luo
cdf0c2573d Use .id instead of .filename in uncacheTree 2015-07-02 03:42:07 -04:00
Guangcong Luo
bed5a46ff3 Improved command identification
! followed by a non-alphanumeric character is no longer recognized
as a command.
2015-06-30 22:35:31 -04:00
Guangcong Luo
c77f1b2ef7 Refactor namespace support 2015-06-30 21:12:12 -04:00
Guangcong Luo
806f003863 Use errorReply for command parser errors 2015-06-30 21:12:12 -04:00
Guangcong Luo
4c852e713f Drop support for returning /text from a command
Previously, this was used as a way to recurse from Config.chatfilter,
but Config.chatfilter is passed a Context now, which makes this
unnecessary.
2015-06-30 21:12:12 -04:00
Guangcong Luo
222bc48aa9 Drop support for Context#originalMessage
The old `.message` is dropped, and the new `.message` is the old
`.originalMessage`.

Having a fake `.message` pretending a namespace command is a
top-level command seems entirely unnecessary, so I still don't
really understand what it's for in the first place.
2015-06-30 21:12:12 -04:00
Guangcong Luo
2c7ad95635 New command API this.errorReply
this.errorReply sends a red error message inline. The main special
thing is that it takes advantage of our new /error support in PMs to
send inline errors in PMs as well.
2015-06-30 03:09:02 -04:00
Guangcong Luo
0aff3445a5 Pass command context to Config.chatfilter 2015-06-30 03:05:29 -04:00
Guangcong Luo
89535e95b9 Fix crash when shadowing commands.js commands
This was done by applying chat plugins to the cloned commands
object rather than the original, which should probably have been
done in the first place.
2015-06-30 03:01:55 -04:00
Guangcong Luo
9529644e0b Fix crash in globalModlog 2015-06-29 01:56:02 -04:00
Guangcong Luo
7419a03626 Modlog refactor
The modlog API is now accessible from outside of CommandParser
through CommandParser.writeModlog.

We now also have a concept of a global modlog, and some new
command APIs for writing to it.
2015-06-27 22:35:31 -04:00
Guangcong Luo
53516692ec Export CommandParser.baseCommands
These are commands from commands.js, before they're possibly
overwritten by other chat commands. It's a shallow copy so memory
impact will probably be minimal.
2015-06-27 22:32:51 -04:00
Guangcong Luo
e6d952b035 Clarify command-not-found message
The previous text implied that it was possible to send !command
without broadcasting. This isn't actually possible.
2015-06-25 17:53:40 -04:00
Ivo Julca
2db4b6bf44 Misc command parser fixes
- Return proper error message for forbidden commands.
- Fix a recursive crash in lobby-less servers.
- Fix a stack overflow in some (very stupidly) modded servers.
2015-06-24 20:49:39 -05:00
Ivo Julca
9b1b078534 Command API: this.run executes a command with current parameters
- Provides a straightforward way to add command aliases with own help entries.
- Encapsulates try-catch blocks.
2015-06-24 18:35:58 -05:00
Ivo Julca
00640a5218 Command API: this.cmdToken is either '/' or '!' depending on input
Also adds feature parity for !commands to be escaped with double !,
and to be returned from `canTalk`.
2015-06-24 18:35:33 -05:00
Ivo Julca
214fd79fdf Refactor command context creation to use a prototype
Also support custom extensions to command API from plugins.
2015-06-24 18:34:16 -05:00
Guangcong Luo
b792fa64e9 Merge pull request #1867 from SolarisFox/patch-7
Mute refactor
2015-06-16 07:40:57 +00:00
SolarisFox
09be77d0b8 Mute refactor 2015-06-14 00:16:44 -07:00
Guangcong Luo
0450e7d9c9 Support writing to other rooms' modlog
Apparently modlog is in CommandParser, which doesn't make it very
straightforward to access outside of the this. functions in
commands. This change at least makes it possible to write to
other rooms' modlogs in commands, but in the long term we might
want to move modlog from CommandParser to Rooms, or at least
expose an API accessible outside of commands.
2015-06-12 03:28:46 -04:00
Guangcong Luo
665ef46145 Improve PM support in Config.chatfilter
The user the PM is being sent to is now passed to .chatfilter
(and canTalk et al).
2015-06-05 13:22:53 -04:00
Guangcong Luo
621328c18d Optimize canTalk a bit 2015-05-27 14:37:17 -04:00
Ivo Julca
4222ffb5df Dependant support: make sure that relative paths are resolved properly 2015-05-11 15:38:18 -05:00
Guangcong Luo
c333cb8aad Add basic tag-matching validator to canHTML
This gives commands like !htmlbox and /roomintro a basic validator,
to warn about typoes related to mismatched HTML tags. This is NOT
intended to be secure (we have a separate sanitizer client-side for
that), but is intended to guard against user error only.
2015-04-29 00:07:25 -04:00
SolarisFox
336cbc462a Move config/commands.js to chat-plugins 2015-04-25 00:44:07 -07:00
Ivo Julca
b9b4196314 Command crash logs now report full message sent
Accounting for namespaces
2015-04-17 00:46:23 -05:00
Guangcong Luo
461303e466 Disallow 'click here' in roomintros
'Click here' as link text is heavily recommended against, but it's
easy to forget, which makes it a good thing to ban programmatically.
2015-04-17 00:36:17 -04:00
Morfent
ce1724e179 Replace all s.substr(x, 1) with s.charAt(x) 2015-04-06 21:20:43 -03:00