Commit Graph

185 Commits

Author SHA1 Message Date
Kris Johnson
081326b69c
Refactor minor activities (#7766) 2021-01-28 12:12:54 -08:00
Mia
db92804541
Support automodchat when all roomstaff are offline (#7810) 2021-01-28 11:14:55 -08:00
Mia
5c9c84c415
Remove User#inRooms and User#games (#7815) 2021-01-28 10:41:35 -08:00
Mia
ca94dea20f
FS: Fix hotpatching and add more throttling (#7878)
- `writeUpdate` state is now stored in a global variable, so hotpatching doesn't crash it
- throttling now writes on the tail (so two throttled `writeUpdate` calls will write one update, not two)
- room settings, punishments, and helptickets are now throttled
2021-01-09 15:49:30 -08:00
Kris Johnson
7bb99e2abb
Add roomsettings for tournaments (#7876)
* Add roomsettings for tournaments

* gar ehseth et hseh

* aeth srth esg
2021-01-05 14:15:57 -08:00
Annika
6d92ac8547
Repeats: Support non-time-based repeats (#7518) 2020-12-28 03:39:52 -08:00
Mia
2cca8bd48e
Support persisting polls and announcements (#7477) 2020-12-28 01:02:13 -08:00
Mia
9712f6ecf1
Modlog: Remove Rooms global in PM (#7799) 2020-12-13 12:52:52 -08:00
Guangcong Luo
54c8c8c24b Fix crash when launching with subrooms 2020-12-01 15:43:09 +00:00
Guangcong Luo
2fde654c78
Refactor subroom code (#7721)
This introduces a new function, `setParent`, to handle the details
of setting up subrooms.

`roomid`, `parent`, and `subRooms` are now read-only, so they can't
be accidentally be set directly rather than through their setters
(`rename`, `setParent`, and `clearSubRooms`).

I don't think setters should be used for this, because I think it's
important to be clear that `rename` and `setParent` will change a lot
of other state and induce network activity.
2020-12-01 06:22:44 -08:00
Guangcong Luo
67ff14e92a Refactor setPrivate 2020-11-17 10:24:16 +00:00
Mia
080ecc7469
Rooms: Merge privacy setting code into setPrivate (#7695) 2020-11-17 02:00:06 -08:00
Guangcong Luo
4d98067b8f Don't show tour battles in subrooms list
Fixes #7670
2020-11-11 03:25:07 +00:00
Mia
f00e2fa44e
Rooms: Properly rename private battle rooms (#7675) 2020-11-10 10:43:00 -08:00
Mia
50522e3f66
Deprecate /showmedia (#7671) 2020-11-09 19:24:12 -08:00
Mia
6145fab828
Allow the Help auto-response filter to be used in all rooms (#7645) 2020-11-08 20:16:25 -08:00
Annika
edc53a6fc6 Fix password generation for private battles 2020-11-06 17:43:46 -08:00
Annika
e6a61e52aa
Fix renaming battle rooms (#7399) 2020-11-06 15:14:08 -08:00
Annika
7f2dec0797
Modlog: Avoid optional properties in ModlogEntry (#7613)
* Modlog: Avoid optional properties in ModlogEntry

* Use a type

* Make IP nullable

* Add NOT NULL constrains

* Fix typo
2020-11-01 14:07:01 -08:00
Annika
58d8a2af70 Fix API for writing to the global modlog 2020-10-30 16:57:29 -07:00
Annika
2f130e8762
Modlog: Support logging to a SQLite database (#7513)
* Modlog: Support logging to a SQLite database

Co-authored-by: Christopher Monsanto <chris@monsan.to>
2020-10-30 19:27:25 -04:00
Annika
0164af53e4
Support banning users from using groupchats (#7558) 2020-10-28 14:12:42 -07:00
Annika
a3b83ba50b
Translations: Convert JSON to TypeScript (#7493) 2020-10-09 12:03:44 -07:00
Annika
216e4a7354
Add a plugin to repeat phrases in chatrooms (#7338) 2020-10-05 14:25:18 -07:00
Mia
4d8580df97
Rooms: Refactor Modlog import (#7463) 2020-10-03 09:56:40 -07:00
Guangcong Luo
3d68248efa Update to latest eslint
We're skipping two major typescript-eslint versions, so there are a
bunch of changes here, including:

- it's catching a lot of things it didn't catch in the past, for
  reasons unclear to me

- no-unused-vars has to be explicitly disabled in global-types now

- a lot of `ts-ignore`s were never necessary and have been fixed

- Crashlogger can now handle being thrown things that aren't errors.
  This has never been a problem in the past, but to satisfy TypeScript
	we might as well not die in a fire on the off chance someone tries to
	`throw null` or something.
2020-09-29 15:28:08 -07:00
Annika
f1b4e3d43a
Modlog: Refactor to use ModlogEntry objects (#7403) 2020-09-28 11:06:30 -07:00
Guangcong Luo
a7c902328f
Refactor staffAutojoin (#7429)
`room.settings.autojoin` and `room.settings.staffAutojoin` are now
merged.

Staff autojoin rooms are now simply regular autojoin rooms with a
modjoin setting. You simply autojoin all autojoin modjoin rooms that
you're allowed to join.

Fixes #7413
2020-09-27 17:47:15 -07:00
Mia
78933408bf
Quotes: Move to a chat plugin (#7421) 2020-09-26 08:11:42 -07:00
Guangcong Luo
360668b00e Revert "Fix renaming battle rooms (#7326)"
(It had a bug that made private battles unplayable.)

This reverts commit 930c00410b.
2020-09-19 05:36:34 -04:00
Annika
930c00410b
Fix renaming battle rooms (#7326) 2020-09-19 02:05:27 -07:00
Annika
62a2eda1a1
RoomGame: Support room.subGame (#7380) 2020-09-19 00:40:24 -07:00
Kris Johnson
dd494bb973
Tournaments: Modernize permission checking (#7375) 2020-09-16 03:40:15 -07:00
Mia
e1b91066c3
Support adding quotes in rooms (#7352) 2020-09-11 13:44:14 -07:00
Guangcong Luo
e543cb843f Revert "Improve privacy for hidden battles (#7281)"
It wasn't implemented in `user.games` and a few other places, leading to bugs.

This reverts commit 222d2e1ac9.
2020-09-06 22:15:55 -04:00
Annika
222d2e1ac9
Improve privacy for hidden battles (#7281)
Co-authored-by: Kirk Scheibelhut <kjs@google.com>
2020-09-06 18:46:35 -07:00
Guangcong Luo
e14485656f Implement a basic /hiderank
This doesn't really have any nice-to-have automatic restoration
features but it should be all the important parts.

`user.group` no longer exists, and has been replaced with
`user.tempGroup`, which now applies both to temporary promotions of
unregistered users, as well as temporary hidden ranks of auth.
2020-08-22 07:20:26 -07:00
Annika
3ef50d8feb
Move forced public prefix logic to RoomBattle (#7244) 2020-08-22 05:29:51 -07:00
Mia
2561764bdc
Make /requestshow approvals staffintro look nicer (#7233) 2020-08-20 21:35:05 -07:00
Annika
27d4212771
Display whitelist correctly in demotion messages (#7238) 2020-08-20 21:18:09 -07:00
fart
b9ced489cd
Show staff intro + pending requests on autojoin (#7228)
At the moment, the staff intro and pending requests only appear on manual joins, not on autojoin. This is because `user.can('mute', null, this)` results false when it is run since the user is not yet logged in. This change creates a new method for generating the staff intro that is run after the user is fully logged in. It also modifies the original `getIntroMessage` so that the staff intro and pending requests still appear on manual joins.

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
2020-08-20 21:17:02 -07:00
fart
d03c6dc435
Fix HTML error with pending media requests (#7227)
This was an extraneous </div> tag which resulted in only the first pending media request to show inside of the <details> tag.
2020-08-19 00:33:45 -07:00
Kirk Scheibelhut
0bf366c181
Fix getBattles skip behavior wrt private rooms (#7204) 2020-08-12 16:41:52 -07:00
Annika
fc99159589
Punishments: Make autolocks last a week on users with bad records (#7074) 2020-08-12 12:06:45 -07:00
Guangcong Luo
a315c93836 Switch to using import type
We were previously using `type Foo = import('bar').Foo` which works
actually equally well, because sucrase didn't support `import type`,
but now it does!
2020-08-09 08:07:00 -05:00
Annika
e00f122b5c
Fix BasicRoom#tr (#7166) 2020-08-06 19:31:38 -07:00
Annika
f563252418
Modlog: Fix bugs and support hotpatching (#7163) 2020-08-06 22:05:13 -04:00
Peach
bfb993e3b2
Fix crash message formatting (#7160) 2020-08-06 09:55:45 -07:00
Annika
f34ffa9e74
Refactor Modlog into one file (#7127) 2020-08-06 00:39:37 -07:00
Annika
8287cbc7fb
Remove User#authAtLeast and add more sysop bypasses (#7046) 2020-08-06 00:12:30 -07:00
Annika
ae11a699a6
Add a BasicRoom#tr method (#7143) 2020-08-05 19:14:41 -07:00
Mia
fbfd31e1cf
Support configuring when crashes are private (#7122) 2020-08-04 02:18:57 -07:00
Volco
26e2a1c4d4
Fix renaming groupchats and groupchat creation (#7123) 2020-08-02 16:21:49 -07:00
Charlie Kobayashi
69cf80ed2a
Make broadcastBuffer an array (#7103)
This removes any extra unnecessary newlines at the end of each message sent to each client, and will always handle all messages assigned to the buffer properly.
2020-07-31 17:57:19 -07:00
Guangcong Luo
7d95f68d26 Fix message corruption
Fixes #7099
2020-07-31 16:39:35 -07:00
Guangcong Luo
c39be07d23 Fix crash messages not appearing in Upper Staff 2020-07-30 17:17:04 -07:00
Mia
29afa9f454
Fix RO rank displaying (#7090) 2020-07-30 13:17:46 -07:00
Annika
74a22d0402
Correctly display reveal button for /cleartext (#7082) 2020-07-29 14:21:42 -07:00
Guangcong Luo
add3a5d9f0 Fix bug when hidetexting own text 2020-07-29 00:37:18 -07:00
Mia
94fff9d496
Support customizing permissions per-room (#6883) 2020-07-29 00:22:03 -07:00
Mia
7216c493bb
Support renaming groupchats (#6965) 2020-07-29 00:21:24 -07:00
Annika
2da0317a71
Implement a /cleartext command (#7065) 2020-07-29 00:16:30 -07:00
Annika
3a3af89054
Display join/leave messages for locked players (#7066) 2020-07-26 16:03:28 -07:00
Guangcong Luo
c08a1a3199 Fix drivers not having mod powers in battles
Battles are now considered personal rooms, and so
`globalGroupInPersonalRoom` now applies to them properly.
2020-07-24 18:51:38 -07:00
Annika
7375ab4d90
Add cooldown for unregistered namechanges (#7032) 2020-07-23 00:00:29 -07:00
Peach
e9611b7ce2
Remove unnecessary references to the global room (#7033) 2020-07-22 08:52:46 -07:00
Annika
960d7a927f
Fix bug in destroyPersonalRooms() (#7031)
This will actually destroy groupchats when a user is locked/globally banned, which to my understanding is the intended behavior.
`continue`ing when a room isn't persistent makes no sense, since groupchats are by definition not persistent.
2020-07-21 21:24:50 -07:00
Annika
570df13186
Support renaming battles (#7015) 2020-07-18 21:27:24 -07:00
Kirk Scheibelhut
eea2196280
Server side changes to support persistent user settings and privacy changes (#6947)
NOTE: This is changes the semantics of `hidenext`/`ionext` from
applying to the next created *battle* to applying to the next
created *search*/*challenge*.
2020-07-06 21:18:38 -07:00
Annika
26150aab1b
Fix bug in /renameroom (#6952) 2020-07-03 11:48:25 -07:00
Guangcong Luo
26615490f7 Merge BasicChatRoom and BasicRoom
They were only ever kept separate because of GlobalRoom. It might be
useful to support rooms that aren't ChatRooms, but we've been chucking
properties into either BasicChatRoom or BasicRoom essentially at
random, so I think it makes sense to wait until we actually have a
use-case for a non-Chat room before carefully deciding which properties
belong where.
2020-07-02 18:54:02 -07:00
Guangcong Luo
46c9afa2f3
"Remove" the global room (#6885)
I couldn't completely remove the global room in one commit, but this
solves basically every problem with it by making it no longer a `Room`.

In particular, this means:

- It's no longer of type `Room`
- It's no longer in the `Rooms.rooms` table
- Its class name is now `GlobalRoomState` rather than `GlobalRoom`
- It no longer tracks its own user list (online user count is now
  provided by `Users.onlineCount`)
- It's no longer a socket channel (there's new syntax for "send this
  message to every user")
2020-07-02 11:31:34 -07:00
Mia
75f9937aad
Info: Support viewing current media requests and hiding media (#6907) 2020-06-30 15:59:52 -07:00
Annika
bc2aec5c82
Roomevents: Support event categories (#6820) 2020-06-21 21:46:11 -07:00
Mia
f9e79220dd
Polls: Support queuing (#6595) 2020-06-20 23:56:04 -07:00
Guangcong Luo
214aef6df6 Strongly type Rooms.global.settingsList 2020-06-20 21:45:02 -07:00
Guangcong Luo
20336fdfa0 Refactor /requestshow 2020-06-18 23:47:39 -07:00
Mia
501f773204
Improve /requestshow (#6868) 2020-06-18 23:43:41 -07:00
Mia
f8b95ce9a0
Rooms: Save creation time for all rooms (#6845) 2020-06-18 19:45:30 -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
Mia
6c97866f83
Add commands to show media in chat (#6745) 2020-06-16 14:40:10 -07:00
Guangcong Luo
97b856596e Fix lobby autojoin on side servers 2020-06-11 17:06:16 -07:00
Austin Couturier
c9b2b9dbf2
Change |pm|~ to |pm|& (#6827) 2020-06-10 21:53:36 -07:00
Mia
6839a1f4db
Add a library for utility functions (#6817) 2020-06-09 22:06:43 -07:00
Guangcong Luo
8c4d55b184 Fix bugs in Settings refactor 2020-06-09 15:40:54 -04: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
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
b454343aee
Room events: Support aliases and renaming (#6748) 2020-05-30 17:54:13 -07:00
Guangcong Luo
ddb9a5d11e Improve code documentation 2020-05-26 21:29:34 -04:00
Guangcong Luo
69f866ea94 Rephrase "has crashed" to "crashed"
This is a really minor thing, but fewer words tend to make
sentences more readable, and crash messages should focus more
on why something crashed than the crash itself.
2020-05-26 19:35:46 -04:00
Charlie Kobayashi
b30d09a3eb
Scavengers: Initialize all settings as null (#6734) 2020-05-23 14:46:59 -07:00
Charlie Kobayashi
9cb8fc4257
Scavengers: Convert to TypeScript (#6726) 2020-05-22 17:06:03 -07:00
Konrad Borowski
c687b3b0ed
Replace attributed uhtml on change (#6693)
Not doing so wastes a lot of bandwidth.

This fixes https://www.smogon.com/forums/threads/dont-send-all-uhtml-messages.3664370/

`|uhtmlchange|` is no longer automatically parsed; please use
`room.uhtmlchange(` instead.
2020-05-16 07:16:42 -07:00
Kris Johnson
2a642afac9
Support changing /data's tier in /roomsettings (#6675) 2020-05-15 18:55:09 -07:00
HoeenHero
8c9225fc5c Don't override the rules link with null when initializing 2020-05-15 09:13:14 -04:00
Ben Davies
1f595fd6a6
Prevent user identity updates from sending leave messages for guests (#6641)
Guests usually don't appear in join/leave/rename messages, but it's
possible for a bot to /trn to a guest nick with an assertion from the
login server and trigger a leave message for a guest nick to get sent.
This shouldn't have any consequences for the official client, but can
crash bots that keep state for users.
2020-05-02 12:33:00 -07:00
Guangcong Luo
8498842697 Make custom room ranks always override
Custom room rank symbols will now override all other ranks in the
userlist.

Their permissions now also fall back to global permissions.

(Also fix an obscure crash with custom rank symbols.)
2020-04-18 07:22:29 -07:00
Guangcong Luo
776ccf9796
Refactor Sockets to ProcessManager+TypeScript (#6584) 2020-04-17 04:05:45 -07:00
Guangcong Luo
c49343b7e2 Setting a room rank can no longer demote globals
Previously, if you gave e.g. roomvoice to a global moderator, that
would demote their room rank to voice. Now, they will remain a
moderator, with "voice" only appearing in `/roomauth` and `/auth`.

(Includes a refactor of Config.groups)
2020-04-17 03:32:11 -07:00
Guangcong Luo
ae129ed8d7 Report full stack trace for crashes
We previously only reported the first line of the stack trace, but now that .readmore exists, showing
the full stack trace isn't too spammy anymore.

Also, private logs are now put into Upper Staff.
2020-04-11 04:20:19 -04:00