* Persist construction menu favorites to player profile
* Use `ProtoId`s for construction favorites
* Validate construction favorites updates from the client
* Actually await the async database call
This should be the primary changes for the future-proof "Modern HWID" system implemented into Robust and the auth server.
HWIDs in the database have been given an additional column representing their version, legacy or modern. This is implemented via an EF Core owned entity. By manually setting the column name of the main value column, we can keep DB compatibility and the migration is just adding some type columns.
This new HWID type has to be plumbed through everywhere, resulting in some breaking changes for the DB layer and such.
New bans and player records are placed with the new modern HWID. Old bans are still checked against legacy HWIDs.
Modern HWIDs are presented with a "V2-" prefix to admins, to allow distinguishing them. This is also integrated into the parsing logic for placing new bans.
There's also some code cleanup to reduce copy pasting around the place from my changes.
Requires latest engine to support ImmutableArray<byte> in NetSerializer.
* Beginnings of making the breadmemes jobs easier
* stuff
* stuff pt. 2
* Stuff pt.3
* Stuff I forgot last time
* Basic whitelist
Only people that are added to the whitelist with the addwhitelist command will be able to join. I call this the "legacy" whitelist
* Remove always deny condition in favor of just breaking if playtime check fails
* Change default whitelist
Default whitelist is now the "legacy" whitelist.
* localization
* Admin check
* minor spelling change
* Fix build
* Whitelist message
* Fix vars not being datafield and spelling mistakes
* Minor spelling mistake
* Change config for salamander
* Reviews and stuff
* Add summaries
* Fix whitelists
* Forgot to add a datafield
* Fixing stuff I guess
* Reuse admin remarks to reduce load when connecting.
* Update log messages to be verbose instead of debug
* Reviews
* whoops
* Explain a bit more how whitelist checking works
* Apply CE's review
* Append Membership to Blacklist and Whitelist conditions
* Fix review comments
* Uncapitalize playerConnectionWhitelist, add to ignored client prototypes
* Make note count field work
* Fix cvar for thingy
---------
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
* Start work on PostgresNotificationManager
Implement initial version of init and listening code
* Finish implementing PostgresNotificationManager
Implement ban insert trigger
* Implement ignoring notifications if the ban was from the same server
* Address reviews
* Fixes and refactorings
Fix typo in migration SQL
Pull new code in BanManager out into its own partial file.
Unify logic to kick somebody with that when a new ban is placed directly on the server.
New bans are now checked against all parameters (IP, HWID) instead of just user ID.
Extracted SQLite ban matching code into a new class so that it can mostly be re-used by the ban notification code. No copy-paste here.
Database notifications are now not implicitly sent to the main thread, this means basic checks will happen in the thread pool beforehand.
Bans without user ID are now sent to servers. Bans are rate limited to avoid undue work from mass ban imports, beyond the rate limit they are dropped.
Improved error handling and logging for the whole system.
Matching bans against connected players requires knowing their ban exemption flags. These are now cached when the player connects.
ServerBanDef now has exemption flags, again to allow matching full ban details for ban notifications.
Made database notifications a proper struct type to reduce copy pasting a tuple.
Remove copy pasted connection string building code by just... passing the string into the constructor.
Add lock around _notificationHandlers just in case.
Fixed postgres connection wait not being called in a loop and therefore spamming LISTEN commands for every received notification.
Added more error handling and logging to notification listener.
Removed some copy pasting from SQLite database layer too while I was at it because god forbid we expect anybody else to do all the work in this project.
Sorry Julian
---------
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
First bug: if an error occured during pref loading code, it would fail. If the person then readied up, it would likely cause the round to fail to start.
Why could they ready up? The code only checks that the prefs finished loading, not that they finished loading *successfully*. Whoops.
Anyways, now people get kicked if their prefs fail to load. And I improved the error handling.
Second bug: if a user disconnected while their prefs were loading, it would cause an exception. This exception would go unobserved on lobby servers or raise through gameticker on non-lobby servers.
This happened even on a live server once and then triggered the first bug, but idk how.
Fixed this by properly plumbing through cancellation into the preferences loading code. The stuff is now cancelled properly.
Third bug: if somebody has a loadout item with a playtime requirement active, load-time sanitization of player prefs could run into a race condition because the sanitization can happen *before* play time was loaded.
Fixed by moving pref sanitizations to a later stage in the load process.
Fixes#26211
Admin messages now have separate "seen" and "dismissed" fields. The idea is that an admin should be able to tell whether a user pressed the "dismiss for now" button. Instead of using "seen" as "show this message to players when they join", "dismissed" is now used for this.
Existing notes in the database will automatically be marked as dismissed on migration. A note cannot be dismissed without being seen (enforced via constraint in the database too, aren't I fancy).
As part of this, it has become impossible for a player to play without dismissing the message in some form. Instead of a shitty popup window, the popup is now a fullscreen overlay that blocks clicks behind it, making the game unplayable. Also, if a user somehow has multiple messages they will be combined into one popup.
Also I had enough respect for the codebase to make it look better and clean up the code somewhat. Yippee.
God bloody christ. There's like three layers of shit here.
So firstly, apparently we were still using Npgsql.EnableLegacyTimestampBehavior. This means that time values (which are stored UTC in the database) were converted to local time when read out. This meant they were passed around as kind Local to clients (instead of UTC in the case of SQLite). That's easy enough to fix just turn off the flag and fix the couple spots we're passing a local DateTime ez.
Oh but it turns out there's a DIFFERENT problem with SQLite: See SQLite we definitely store the DateTimes as UTC, but when Microsoft.Data.Sqlite reads them it reads them as Kind Unspecified instead of Utc.
Why are these so bad? Because the admin notes system passes DateTime instances from EF Core straight to the rest of the game code. And that means it's a PAIN IN THE ASS to run the necessary conversions to fix the DateTime instances. GOD DAMNIT now I have to make a whole new set of "Record" entities so we avoid leaking the EF Core model entities. WAAAAAAA.
Fixes#19897
* Fix next never sending logs for rounds outside the cache
* Show round's total log count on the ui
* Disable next button when waiting for a next response
* Cleanup AdminLogsEui.CurrentRoundId
* Fix popout window width
Thanks to julian figuring out IDesignTimeDbContextFactory exists in #6327.
All this DbContext configuration and options setup stuff is insane. Microsoft should be absolutely ashamed for coming up with this load of garbage.
* Add admin logging, models, migrations
* Add logging damage changes
* Add Log admin flag, LogFilter, Logs admin menu tab, message
Refactor admin logging API
* Change admin log get method names
* Fix the name again
* Minute amount of reorganization
* Reset Postgres db snapshot
* Reset Sqlite db snapshot
* Make AdminLog have a composite primary key of round, id
* Minute cleanup
* Change admin system to do a type check instead of index check
* Make admin logs use C# 10 interpolated string handlers
* Implement UI on its own window
Custom controls
Searching
Add admin log converters
* Implement limits into the query
* Change logs to be put into an OutputPanel instead for text wrapping
* Add log <-> player m2m relationship back
* UI improvements, make text wrap, add separators
* Remove entity prefix from damaged log
* Add explicit m2m model, fix any players filter
* Add debug command to test bulk adding logs
* Admin logs now just kinda go
* Add histogram for database update time
* Make admin log system update run every 5 seconds
* Add a cap to the log queue and a metric for how many times it has been reached
* Add metric for logs sent in a round
* Make cvars out of admin logs queue send delay and cap
* Merge fixes
* Reset some changes
* Add test for adding and getting a single log
* Add tests for bulk adding logs
* Add test for querying logs
* Add CallerArgumentExpression to LogStringHandler methods and test
* Improve UI, fix SQLite, add searching by round
* Add entities to admin logs
* Move distinct after orderby
* Add migrations
* ef core eat my ass
* Add cvar for client logs batch size
* Sort logs from newest to oldest by default
* Merge fixes
* Reorganize tests and add one for date ordering
* Add note to log types to not change their numeric values
* Add impacts to logs, better UI filtering
* Make log add callable from shared for convenience
* Get current round id directly from game ticker
* Revert namespace change for DamageableSystem