Commit Graph

49 Commits

Author SHA1 Message Date
Pieter-Jan Briers
2e6eaa45c5 Fix admin notes and database time nonsense. (#25280)
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
2024-02-20 10:13:31 +01:00
Pieter-Jan Briers
a6c9c36b68 Dependency update / fixes / skrungle bungle (#23745)
* Give .props files 2-space indents.

* Move to Central Package Management.

Allows us to store NuGet package versions all in one place. Yay!

* Update NuGet packages and fix code for changes.

Notable:

Changes to ILVerify.
Npgsql doesn't need hacks for inet anymore, now we need hacks to make the old code work with this new reality.
NUnit's analyzers are already complaining and I didn't even update it to 4.x yet.
TerraFX changed to GetLastSystemError so error handling had to be changed.
Buncha APIs have more NRT annotations.

* Remove dotnet-eng NuGet package source.

I genuinely don't know what this was for, and Central Package Management starts throwing warnings about it, so YEET.

* Remove Robust.Physics project.

Never used.

* Remove erroneous NVorbis reference.

Should be VorbisPizza and otherwise wasn't used.

* Sandbox fixes

* Remove unused unit test package references.

Castle.Core and NUnit.ConsoleRunner.

* Update NUnit to 4.0.1

This requires replacing all the old assertion methods because they removed them 🥲

* Oh so that's what dotnet-eng was used for. Yeah ok that makes sense.

* Add Robust.Analyzers.Test

* Update submodule

* commit to re-run CI
2024-01-12 23:22:01 +01:00
Pieter-Jan Briers
46e36934a6 High-latency DB testing stuff (#22282) 2023-12-10 16:30:12 +01:00
Pieter-Jan Briers
b4f8393f42 Log server ID in connection logs table (#21911) 2023-12-07 09:48:56 +11:00
DrSmugleaf
f985e7dc5c Fix role unbans not applying in real time (#20547) 2023-09-28 16:46:39 -07:00
DrSmugleaf
71f5e38faf Fix search being case sensitive for admin logs from uncached db rounds (#19066)
* Fix search being case sensitive for admin logs from uncached db rounds

* Fix text search query for sqlite
2023-08-14 18:27:25 -06:00
Pieter-Jan Briers
12391b4881 Fix unit tests being inconsistent now. (#18298) 2023-07-26 10:03:29 +10:00
Pieter-Jan Briers
978887bf03 (Probably) fix random integration test failures. (#18270) 2023-07-25 11:10:50 +10:00
Riggle
579913b617 Better notes and bans (#14228)
Co-authored-by: Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com>
2023-07-21 13:38:52 +02:00
Pieter-Jan Briers
50257c3bd7 Limit postgres database concurrency (#17246) 2023-06-10 21:52:08 +10:00
Leon Friedrich
160e3efe00 Fix sqlite ban time conversion (#17101) 2023-06-03 11:56:22 -07:00
DrSmugleaf
d072cb6144 Fix admin logs duplicate id error when running tests (#16203) 2023-05-07 20:14:23 +10:00
Pieter-Jan Briers
1c4a2594ce Database thread pool use (#14498)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2023-05-02 10:36:39 +10:00
Chief-Engineer
5eba1d230a Add IP ban exemption flag (#15815) 2023-04-27 11:59:18 -07:00
metalgearsloth
3dc0908151 Revert "Show ban and note count in ahelp window" (#15347) 2023-04-12 19:43:33 +10:00
DrSmugleaf
26cd16eeaa Show ban and note count in ahelp window (#15328) 2023-04-12 10:34:25 +10:00
Pieter-Jan Briers
c8e90e561b Server ban exemption system (#15076) 2023-04-03 10:24:55 +10:00
Kara
f24d3208b2 Probably fix roleban hwid issues (#13548) 2023-01-17 11:10:08 -07:00
DrSmugleaf
5227d1a023 Admin notes (#7259)
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2022-04-16 20:57:50 +02:00
Julian Giebel
414d226ec5 Server names and admin log full-text search (#6327)
Co-authored-by: Julian Giebel <j.giebel@netrocks.info>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
2022-03-13 18:36:48 +01:00
Pieter-Jan Briers
950ead9b47 Introduce artificial delay into SQLite on DEBUG.
This makes SQLite DB ops properly asynchronous (instead of synchronously completing tasks). This makes them more consistent with postgres and means that any deadlock bugs introduced the next time somebody does .Result will be caught on SQLite too.
2022-03-04 23:55:35 +01:00
ShadowCommander
4a68718050 Role ban improvements (#6855) 2022-02-21 22:00:55 -07:00
ShadowCommander
4825142210 Role bans (#6703) 2022-02-21 23:11:39 +01:00
Pieter-Jan Briers
4da56becab Fix DbContext configuration nightmares.
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.
2022-02-03 03:13:34 +01:00
Pieter-Jan Briers
5091c6aa9d Revert "Revert "Log ban hits in DB. ( (#6361) 2022-02-02 22:57:11 +01:00
Pieter-Jan Briers
764010fea0 Revert "Log ban hits in DB. (#6337)" (#6357)
This reverts commit b75f005bb4.
2022-01-28 19:33:09 +01:00
Pieter-Jan Briers
b75f005bb4 Log ban hits in DB. (#6337) 2022-01-28 19:10:44 +01:00
Pieter-Jan Briers
a3aabf59ad Unify remaining DB model classes between SQLite and Postgres.
As part of this, the ban and unban table were renamed to server_* on SQLite to move them in line with Postgres. Data is preserved.
2022-01-27 18:12:09 +01:00
wrexbe
c0416aeaf8 Fix logs blowing up on Sqlite (#6093) 2022-01-10 09:21:39 +01:00
DrSmugleaf
b5a78073ef Fix fetching the entire database when adding a round or admin log on SQLite
EF Core was a mistake
2021-12-20 17:54:50 +01:00
DrSmugleaf
c3fe5909ad THE RETURN OF THE KING
This reverts commit c18d07538a.
2021-11-22 19:08:27 +01:00
DrSmugleaf
c18d07538a Revert "Admin logs (#5419)"
This reverts commit 319aec109d.
2021-11-22 18:55:17 +01:00
Javier Guardia Fernández
319aec109d Admin logs (#5419)
* 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
2021-11-22 18:49:26 +01:00
Javier Guardia Fernández
720e750e86 Merge player database models (#5267) 2021-11-11 17:54:02 +01:00
Saphire Lattice
eb567dc0bb DB QOL stuff, but not breaking the migrations now (#5086) 2021-10-31 15:18:01 +01:00
Pieter-Jan Briers
5c5534de9a Revert "A bit of DB model cleanup (#5016)"
This reverts commit 8a3cee9a10.
2021-10-29 16:10:58 +02:00
Saphire Lattice
8a3cee9a10 A bit of DB model cleanup (#5016) 2021-10-29 15:41:13 +02:00
Visne
b7dc3c81ae Remove redundant #nullable enable (#4275) 2021-07-16 17:37:09 -07:00
DrSmugleaf
f878f353e4 Move some files out of Content.Shared root because I forgot (#4182) 2021-06-13 22:52:40 +10:00
DrSmugleaf
ff1a2d97ea Re-organize all projects (#4166) 2021-06-09 22:19:39 +02:00
Pieter-Jan Briers
a321b4302e Use HWIDs for bans. 2021-03-22 01:32:09 +01:00
DrSmugleaf
f4978d1b9e Add pardon command and tests (#3190)
* Add pardon command

* Make pardoning check for an existing ban and unban first

* Add pardon test and documentation
2021-02-13 17:51:54 +01:00
DrSmugleaf
9f5fca2334 Add banlist command (#3163)
* Add banlist command

* Fix up args
2021-02-12 13:04:32 +01:00
Acruid
ca4fd649fe Massive Namespace Cleanup (#3120)
* Engine namespace changes.

* Automated remove redundant using statements.

* Simplified Graphics namespace.

* Apparently the container system stores full type names in the map file.😞 This updates those names.

* API Changes to LocalizationManager.LoadCulture.

* Update submodule to v0.3.2
2021-02-11 01:13:03 -08:00
Pieter-Jan Briers
de2bdf4630 Fix integration tests race condition. 2020-12-30 01:18:39 +01:00
DrSmugleaf
5c0cf1b1a0 Use 'new' expression in places where the type is evident for content (#2590)
* Content.Client

* Content.Benchmarks

* Content.IntegrationTests

* Content.Server

* Content.Server.Database

* Content.Shared

* Content.Tests

* Merge fixes

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2020-11-27 21:00:49 +11:00
Pieter-Jan Briers
f364c4b01f Fix .NET 5 warnings in admin code. 2020-11-13 01:51:42 +01:00
Pieter-Jan Briers
e39ddd4802 Permissions panel. 2020-11-10 16:50:28 +01:00
Pieter-Jan Briers
66c8a68891 Holy crap auth works (#2099)
* Holy crap auth works

* Fix some usages of UserID instead of UserName

* Refactor preferences.

They be non-async now. Also faster.

* Rename DbContext.

* Guest username assignment.

* Fix saving of profiles.

* Don't store data for guests.

* Fix generating invalid random colors.

* Don't allow dumb garbage for char preferences.

* Bans.

* Lol forgot to fill out the command description.

* Connection log.

* Rename all the tables and columns to be snake_case.

* Re-do migrations.

* Fixing tests and warnings.

* Update submodule
2020-09-29 14:26:00 +02:00