Commit Graph

23714 Commits

Author SHA1 Message Date
Guangcong Luo
713f914d75 Fix Net error behavior
A lot of Net functions returned Promises that would not reliably
resolve/reject if a Net request failed. This fixes it so they should
now all reliably reject on request failure.

(Yes, this fixes the ladder issues and memory leak in Main.)
2020-06-10 16:08:48 -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
cd5c7991b7 Only check .ts files in server/
Mostly, this prevents TypeScript from complaining about .js
files in config/chat-plugins/private/
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
HoeenHero
6fd69b469d Fix issue when using /data with tiershift mod
Probably not the best way to fix this, though I'd rather the server stop crashing right now.
2020-06-10 11:21:30 -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
377969aab2 Simplify tsconfig
A lot of this complexity was because we were once half-migrated, but
now we're basically fully migrated to TypeScript so there's no more
need.
2020-06-09 13:55:53 -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
386afbaf38
UU: Ban Drizzle
https://www.smogon.com/forums/posts/8495783/
2020-06-08 12:38:19 -04:00
Marty-D
f0753192a4 Update datacenters 2020-06-08 11:59:42 -04:00
Kris Johnson
4908ee1343
Move Melmetal to DUber and remove suspect notice (#6818)
* Move Melmetal to DUber and remove suspect notice

https://www.smogon.com/forums/threads/ss-dou-melmetal-voting.3665737/post-8495347

* Update formats.ts
2020-06-08 11:03:58 +04:00
whales
12cd759307 Update Mafia codeowners 2020-06-08 16:24:06 +09:30
Kris Johnson
86f7aafc6b
Move Galarian Rapidash and Golurk to PUBL (#6816)
https://www.smogon.com/forums/threads/np-pu-stage-1-la-devotee-golurk-and-gapidash-banned.3661966/page-4#post-8494713
2020-06-07 16:58:11 -07:00
DeltaCoderr
f447333bdd
SSB: Batch Update (#6797) 2020-06-07 12:12:18 -07:00
Charlie Kobayashi
8cccbff826
Tier shift: Ban Eviolite (#6809)
as per https://www.smogon.com/forums/threads/tier-shift-om-of-the-month.3662165/page-2#post-8490625
2020-06-07 06:59:36 -07:00
urkerab
eb84554a12
Remove last vestige of Pokebank (#6812) 2020-06-07 06:46:40 -07:00
urkerab
9c2690321c
Allow formats to reorder all six Pokémon again (#6813) 2020-06-07 06:45:43 -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
urkerab
32d84a1d1a
Correctly attribute target with full HP (#6807) 2020-06-06 05:11:27 -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
Guangcong Luo
23a4b11430 Support ./build --force 2020-06-05 10:48:23 -07:00
Guangcong Luo
b99c8db5d2 Fix Net library 2020-06-05 10:38:27 -07:00
Guangcong Luo
c925c15070 Support incremental builds 2020-06-05 10:38:27 -07:00
Charlie Kobayashi
3394053fb6
Scavengers - minor fixes (#6802) 2020-06-05 08:03:42 +02:00
Kirk Scheibelhut
922d292322 Simplify @pokemon-showdown/sets and rename package
@smogon is the preferred namespace for packages (eg. @smogon/calc),
but the fact that this import logic previously contained code from
two non-Smogon sources made such naming awkward. Given the damage
calc didn't end up using these sources (and the Pokémon Showdown
client doesn't either), its simpler to just remove the logic for
third party imports entirely. This allows us to remove ugly 'hidden'
JSON5 dependency, as well as `smogon.com/` namespacing on the
sources.

This commit also tidies up the package.json and type definitions to
be more robust. It makes `--access public` the default when
publishing and cleans up unpkg support.

This is obviously a breaking change, but it's also a package rename
so we get to start the version from zero there :). A corresponding
commit will be added to the client to account for these changes.
2020-06-04 19:43:56 -07: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
Guangcong Luo
287743c83b Fix Pumpkaboo CC1v1 crash
This will probably need to be less hardcoded in the future, but
for now this is fine.

A better solution would involve revising `getLearnsetData` to be
able to do these things.
2020-06-04 12:21:25 -04:00
The Immortal
a258a24ff9 Challenge Cup: Fix Pumpkaboo-Super and Zygarde-10% 2020-06-04 20:18:16 +04:00
Mia
c9c7f6a747
Youtube: Accredit videos and improve interval (#6762) 2020-06-04 06:54:05 -07:00
urkerab
a21c64fd10
Back out erroneous change from 1fa9e14 to fix After You regression (#6799) 2020-06-04 06:52:55 -07:00
The Immortal
390e8b8d4f Random Battle updates 2020-06-04 17:02:34 +04:00
The Immortal
0199852386 Gen 3: Random Battle improvements 2020-06-04 16:57:55 +04:00
Kris Johnson
ff1a7bcc1a
Fix crash from adding Two vs Two to triples formats (#6801) 2020-06-04 16:11:34 +04:00
Kris Johnson
0c63694bbb
Add LC suspect notice (#6800)
https://www.smogon.com/forums/threads/lc-suspect-sun-comes-up.3665545/
2020-06-04 02:23:14 -07:00
The Immortal
f9791abba9 Random Battles: Fix cosmetic formes 2020-06-04 03:06:07 +04:00