Commit Graph

158 Commits

Author SHA1 Message Date
Guangcong Luo
5d23be1ca3 Support multiline errorReply 2016-03-31 19:07:31 -04:00
Bär Halberkamp
a0caee2a07 Fix this.broadcasting not being set in the datasearch commands 2016-04-01 00:52:16 +02:00
Ivo Julca
a7fbc7e96f Fix hotpatch
Properly uncache children modules.
2016-03-23 17:40:17 -05:00
Bär Halberkamp
365462a85c Dexsearch: Correctly broadcast dexsearches 2016-03-20 04:43:42 +01:00
Guangcong Luo
19a3bf307b Export CommandContext from command-parser 2016-03-15 18:19:20 -04:00
Guangcong Luo
447aed29ca Fix style error 2016-03-12 05:32:24 -06:00
Guangcong Luo
97b89cc4ac Refactor CommandContext to ES6 classes
Context in command-parser.js has been renamed CommandContext and
refactored to use ES6 classes. Its also subsumed the canTalk
function. Future iterations will probably put the parse function
inside it as well.
2016-03-12 06:22:59 -05:00
Ivo Julca
66c00d29af Remove usage of String|Number methods implemented by Sugar.js
Implements Tools#toDurationString to replace Number#duration.
2016-03-09 16:55:40 -05:00
Ivo Julca
0281176fd1 Remove usage of Array|Object methods implemented by Sugar.js
Adds a dependency to shim Object.values until it's natively available.
2016-03-09 16:55:34 -05:00
Guangcong Luo
9f3336fc5a Fix /me 2016-02-29 04:10:37 -05:00
Guangcong Luo
0c0b94c01a Support muting offline users 2016-02-29 02:10:49 -05:00
Guangcong Luo
847878038c Autorewrite /me's to /mee 's
You can think of this as now supporting any punctuation after /me, not
just a space.
2016-02-29 02:08:37 -05:00
Guangcong Luo
e54fe99e37 Refactor Context#getLastIdOf to User#getLastId
Also add a User#getLastName

These functions allow punishment commands to show a user's userid
even if they try to avoid that by logging out.
2016-02-28 03:25:35 -06:00
Guangcong Luo
2d7b449a2c Emergency fix for /constructor 2016-02-21 17:35:04 -05:00
Guangcong Luo
b665660608 Refactor for more ES6 features
Now that nodejs/node#3072 is mostly fixed, we can finally start using
Node 4+ features.

This refactor:

- uses arrow functions where appropriate

  Note that arrow functions still aren't used in Mocha, where `this`
  is sometimes meaningful.

  This also removes the need for .bind() nearly everywhere, as well
  as the `self = this` trick.

- refactors Validator and Connection into ES6 classes

- no longer uses Array#forEach for iterating arrays

  We strongly prefer for (let i = 0; i < arr.length; i++) because of
  performance reasons. Most forEaches have been replaced with for..of,
  though, which is 5x slower than the long-form loop but 2x faster
  than forEach, which is good enough outside of most inner loops.

  The only exception is tournaments, which is due for a more invasive
  refactor soon anyway.
2016-02-10 17:40:21 -06:00
Guangcong Luo
8a8838552d Improve crashlogger
Crashlogger now supports passing in a dictionary of additional
information to report, so we no longer need to resort to making fake
errors.

The hadException parameter has now been removed entirely. I don't know
of a use case for it to be false.
2016-02-04 03:04:05 -06:00
Marty-D
a088853208 Filter more zalgo-like characters 2016-01-02 17:25:54 -05:00
Konrad Borowski
81f602b8d8 Always use trailing comma for multiline objects 2016-01-01 00:20:07 +01:00
Guangcong Luo
b56ddc7d78 Allow style tags on buttons in private roomintros 2015-12-30 15:49:32 -05:00
Guangcong Luo
aa5b659cac Ban certain zalgo-like characters 2015-12-19 04:12:31 -05:00
Guangcong Luo
381d66a01b Nicer error message for <button> permission 2015-12-17 06:28:52 -05:00
Guangcong Luo
13b2ba1622 Fix image src validation in canHTML 2015-12-14 16:25:14 -05:00
Guangcong Luo
4fa910a932 Add Droplr to list of valid HTTPS domains 2015-12-14 16:25:14 -05:00
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