Commit Graph

977 Commits

Author SHA1 Message Date
Guangcong Luo
af7ca0e73c Clarify "Whitelist" in /roomauth as staff-only
I definitely heard some staff members be concerned that it shouldn't
be shown to regular users.
2020-06-18 00:01:57 -04:00
Mia
233f2aef9a
Fix setting modchat in battles (#6860) 2020-06-17 20:46:59 -07:00
Mia
1f6029e156
Youtube: Fix ID crash (#6858) 2020-06-17 20:42:02 -07:00
Guangcong Luo
cc22bae74f Fix crash in /editbattle 2020-06-17 18:12:34 -07:00
Guangcong Luo
839d86a2ab Refactor /makegroupchat a little
None of these are likely to fix the lag spike, but I couldn't find
anything that stuck out.
2020-06-17 21:11:52 -04:00
Guangcong Luo
ba53a2831c Fix bugs in /show
- Chat.getImageDimensions and Chat.fitImage now throw if passed things
  that aren't image URLs.
- Fix help message if you use /show by itself
- Link to full aize image if image is shrunk
2020-06-17 21:11:52 -04:00
Charlie Kobayashi
e51c4ce290
Fix minor issues with /show commands (#6849) 2020-06-16 20:12:34 -07:00
Charlie Kobayashi
95b29974fd
Fix server crash from overlength posts (#6847)
(Server would crash and be unable to handle any further inputs from users)

Byproduct of #6745
2020-06-16 19:42:55 -07:00
Guangcong Luo
32b5b43244 Fix unexcaped URI in /requestshow 2020-06-16 18:44:23 -07:00
Mia
9521580ecf
Modlog: Prevent non-gstaff from searching for IPs (#6844) 2020-06-16 15:51:59 -07:00
Mia
6c97866f83
Add commands to show media in chat (#6745) 2020-06-16 14:40:10 -07:00
Annika
f177ae31dc
Trivia: Fix bug with computing user ranking (#6843) 2020-06-16 14:03:39 -07:00
PartMan
0127813e8c
Show given hints on /scav hint (#6842) 2020-06-16 11:22:44 +02:00
Annika
838d53bf93
Modlog: Escape search terms (#6835) 2020-06-14 19:39:57 -07:00
Guangcong Luo
902dfaba4f Better document debug options in config-example.js 2020-06-13 15:58:35 -07:00
Kris Johnson
3228f91fbc
Fix uncommon evolution methods (#6830) 2020-06-13 12:46:21 -07:00
Kris Johnson
394a4c5c9d
Fix UNO DQ message to use correct name (#6831) 2020-06-13 11:21:58 -07:00
Guangcong Luo
8748427dce Fix TS error in PM
It's surprising to me that this happened after e0f97dcf6b, which
doesn't touch this line.
2020-06-13 10:54:22 -07:00
Guangcong Luo
e0f97dcf6b Replace Chat.uncache* with Utils.clearRequireCache
This replaces the old approach with a new "clear everything except a
whitelist" approach, which should overall involve much less code and
lead to fewer bugs of the "the path changed for a module and I forgot
to update the uncache paths" variety.

I considered a lot of other approaches, but they seem to have more
flaws without any advantages in exchange for them. (We moved away
from `uncacheTree` because it only tracks the first require: there's
no way to get a full list of dependents for a module, only its first
dependent.)
2020-06-12 22:02:32 -07:00
Guangcong Luo
d592c838c2 Separate Config.ofemain and Config.ofesockets 2020-06-12 22:02:32 -07:00
Guangcong Luo
97b856596e Fix lobby autojoin on side servers 2020-06-11 17:06:16 -07:00
Annika
428205fe93
Don't default to showing 'trusted' in /userauth (#6828) 2020-06-11 16:01:55 -07:00
Austin Couturier
c9b2b9dbf2
Change |pm|~ to |pm|& (#6827) 2020-06-10 21:53:36 -07:00
Annika
7af048c85b
Datasearch: Fix maxgen and learnset interaction (#6825) 2020-06-10 21:53:21 -07:00
Mia
31263c79a0
Youtube: Fix crashes with checking ID (#6826) 2020-06-10 21:52:54 -07:00
Guangcong Luo
1e5b5ab465 Update Streams API with pushEnd/writeEnd
Previously, ending a read stream was `stream.push(null)`, and ending a
write stream was `stream.end()`. This was often confusing, and so now,
these are consistently `stream.pushEnd()` and `stream.writeEnd()`.

This refactor already found a bug in which `stream.end()` was used
where `stream.push(null)` should have been.

Also in this refactor: By default, `pushError` ends the stream. You can
pass `true` as the second parameter if the error is recoverable (the
stream shouldn't end).
2020-06-10 16:07:24 -07:00
Guangcong Luo
0629a915a0 Support multiline /eval and /evalbattle 2020-06-10 11:23:20 -04:00
Guangcong Luo
140f4ad936 Support /forceroompromote
Previously, forcepromotes were done with a !!! sigil, which was
kind of silly. They now use a command starting with "force", as
is standard.
2020-06-10 11:23:20 -04:00
Guangcong Luo
0da724cba7 Correct /auth sorting direction
This also refactors /auth and /roomauth to both be in
moderation.ts (as good a place as any), and to use Utils.sortBy.
2020-06-10 11:23:20 -04:00
Mia
6839a1f4db
Add a library for utility functions (#6817) 2020-06-09 22:06:43 -07:00
Guangcong Luo
b53480b364 Fix memory leak in ladders-remote 2020-06-09 18:31:29 -07:00
Charlie Kobayashi
f4c680ac68
Scavengers: Fix /scavtop error due to auth/settings refactor (#6823) 2020-06-09 17:33:03 -07:00
Guangcong Luo
8c4d55b184 Fix bugs in Settings refactor 2020-06-09 15:40:54 -04:00
Guangcong Luo
c444036f85 Support whitelisting users
(Whitelist is being implemented as a hardcoded custom group.)
2020-06-09 08:22:44 -07:00
Mia
15fed24b40
Refactor auth and room.settings (#6777)
This implements two big changes:

- All settings shared between `room.chatRoomData` and `room` have been
  merged into `room.settings` (so, for instance, `room.slowchat` is now
  only `room.settings.slowchat`).

  This makes it so we never have to worry about them getting "out of
  sync".

  - Checking to see if a room is persistent is now `if (room.persist)`
    instead of `if (room.chatRoomData)`

  - `Rooms.global.writeChatRoomData()` is now rarely called directly;
    there's a new `room.saveSettings()` which will handle it for you.

  - All properties of `room.settings` are now optional (except
    `title`).

- There's a new file `user-groups.ts` which handles authority.

  - `room.auth` and `Users.globalAuth` are now
    `Auth extends Map<ID, GroupSymbol>` objects.

  - `room.auth` is now always defined, removing the need for
    `room.auth?.[userid]` workarounds.

  - A lot of code relating to usergroups and permission checks have
    been refactored.

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2020-06-09 08:22:25 -07:00
DeltaCoderr
70ab234f1d
Add Room Owner rank in Help Commands (#6821) 2020-06-09 07:48:46 -07:00
Annika
406eaed520
Add /dt(gen) as an alias to use /details for a gen (#6806) 2020-06-08 12:39:20 -07:00
PartMan
6848861887
Support Crit in Movesearch (#6808)
A lot of people had been asking about whether it was possible to search for moves with a high critical-hit ratio (relevant for building with things like Sniper or Focus Energy).

(Also includes a refactor to cut down on the number of type assertions
necessary in movesearch code, by Zarel)

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2020-06-08 09:52:21 -07:00
Annika
f4863a9444
Update references to Global Administrators post-flattening (#6815)
Co-authored-by: Charlie Kobayashi <sparkychildcharlie@gmail.com>
2020-06-08 09:41:03 -07:00
Marty-D
f0753192a4 Update datacenters 2020-06-08 11:59:42 -04:00
urkerab
eb84554a12
Remove last vestige of Pokebank (#6812) 2020-06-07 06:46:40 -07:00
Guangcong Luo
08420c7feb Reassign hotpatch permissions
Currently, 'hotpatch' and 'lockdown' are admin permissions, and
'console' is a console admin permission. In preparation for the
admin/leader unification, I'm removing the hotpatch permission:

- /memoryusage, /loadbanlist, /adddatacenters, /refreshpage,
  /loadbanlist have been moved from 'hotpatch' to 'lockdown'. This
	doesn't change anything, I'm just unifying the permission name.

- /updateserver has been moved from 'hotpatch' to 'console'.
  /updateserver in combination with either hotpatch or lockdown can be
	used for arbitrary code execution, and is approximately as dangerous
	as any other console command.

- /hotpatch, /savelearnsets have been moved from 'hotpatch' to
  'console'. They're reasonably harmless, but they don't do anything
	without console access, so a non-console admin using them is nearly
	definitely some sort of mistake.

`user.hasConsoleAccess` now also has a CommandContext function
`this.canUseConsole` to handle its error message.
2020-06-06 07:44:31 -07:00
Annika
14140d1543
Roomevents: Fix bug in getAllAliases() (#6805) 2020-06-05 18:28:28 -07:00
Annika
cc6334c8ce
Support specifying a reason for /hidetext (#6804) 2020-06-05 15:42:32 -07:00
Mia
da1da746b3
Youtube: Use Net library (#6803) 2020-06-05 15:20:29 -07:00
Charlie Kobayashi
3394053fb6
Scavengers - minor fixes (#6802) 2020-06-05 08:03:42 +02:00
Mia
cf42c6269a
Add a library for making HTTP/S requests (#6744) 2020-06-04 11:53:58 -07:00
Guangcong Luo
7b33aef0e3 Fix room events crashing with no alias
PR #6781 only fixed one of the crashes; the real problem was that the
code expects aliases to be an empty array if rooms have no aliases,
which have multiple flaws including unnecessarily taking up JSON
space.
2020-06-04 14:49:38 -04:00
Annika
14e75c7be6
Support minimizing roomintro/staffintro source code (#6754) 2020-06-04 11:04:54 -07:00
Guangcong Luo
58b958c6fe Improve TS 3.9 property checks
These were previously fixed in 6e2b475dac, but I prefer an approach
that makes sure e.g. `pipeTo = undefined` doesn't break this check.
2020-06-04 10:23:04 -07:00