Commit Graph

118 Commits

Author SHA1 Message Date
YotaXP
e404e45ffc Persist construction menu favorites server-side (#35867)
* 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
2025-05-17 13:37:19 -04:00
nikthechampiongr
09f75394be Require hwid (#35331)
* Make cvar to require that the client has a modern hwid

* Ignore guests and don't disable cvar on dev

* Rename and add docs
2025-02-20 19:04:45 +01:00
metalgearsloth
15b28936df Add loadout names (#31303)
* Add loadout names

Did it for AI, breaking change for pgsql + migrations in general. Nothing atm uses it.

* the box

* Spawning cherry pick

* Fix nit

* revert

* Final cleanup

* Real

* Name UI fix

* Migrations

* a

* Review

* Re-run migrations

---------

Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
2025-02-11 18:30:24 +01:00
Myra
6041c828de Remove baby jail (#34443)
* Remove baby jail

Closes #33893

* Test fail fix.
2025-01-15 22:08:15 +01:00
Pieter-Jan Briers
c2e050ced0 Persist deadmin to database, add admin suspension system (#34048) 2025-01-15 00:46:45 +01:00
Myra
96d913b147 Add IPIntel API support. (#33339)
Co-authored-by: PJB3005 <pieterjan.briers+git@gmail.com>
2025-01-12 20:41:26 +01:00
Pieter-Jan Briers
4f3db43696 Integrate Modern HWID into content
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.
2024-11-12 01:51:54 +01:00
Pieter-Jan Briers
36aceb178c Database SnakeCaseNaming fixes
Fixes formatting of owned entity type property names. These are normally named "FooBar_Baz" by EF Core, but the snake case thing was turning them into "foo_bar__baz". The double underscore is now fixed.

We don't *yet* have any EF Core owned entity in use, but I am planning to add one. I don't know if downstreams are using any so this should still be marked as a breaking change.

Also fixed it creating and dropping a Compiled Regex instance for every name, the regex is now cached (and pregenerated).
2024-11-12 01:51:54 +01:00
Simon
f92ef41538 Automated whitelists (#23985)
* 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>
2024-08-27 18:01:17 +02:00
Julian Giebel
df95be1ce5 Kick on ban for entire server group (#28649)
* 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>
2024-08-20 23:31:33 +02:00
Chief-Engineer
6d664c9157 Add debug logs to baby jail and fix playtime logic (#30158)
* add debug logs

* Update Model.cs

* fix playtime logic for null playtime

* remove unnecessary condition

* either me or the compiler is having a C# skill issue
2024-07-21 01:28:43 +02:00
Chief-Engineer
6371a04621 Fix baby jail (#29896)
* Revert "Revert Baby Jail (#29891)"

This reverts commit 24a2866747.

* the fix
2024-07-11 15:14:01 +10:00
Vasilis
24a2866747 Revert Baby Jail (#29891)
* Revert "SS14-28662 Add Baby Jail: a Jail for Babies (inverse panic bunker) (#28763)"

This reverts commit 3ceb92a0c4.

* Revert configs

* Oops
2024-07-11 10:33:47 +10:00
Pieter-Jan Briers
0c34eb6138 Ban template system (#29365)
To help out admins, so they can easily fill out datacenter bans and stuff. Supports ban exemption flags and everything.

This is for use with SS14.Admin so it's just DB models here.
2024-06-23 17:33:54 +02:00
Pieter-Jan Briers
f041f58a6d Add time index to connection log (#29281)
* Add time index to connection log

Queries go nyoom.

* Don't let me code shit at 5 AM
2024-06-21 15:29:10 +02:00
nikthechampiongr
76a65c8e43 Implement BlacklistedRange exempt flag (#29258)
* Implement a new kind of ip range ban that only applies to new players

* Put determining whether a player record exists to its own function

* Make BlacklistedRange bans get bypassed by any ban exemption

* Stop trying to get another DbGuard while already having one

This does break with convention on the functions in that area but
considering the use of this function it's probably fine?
I could alternatively just move the place it's called from.

Also I was suppossed to wait for tests to finish locally just to be
sure, but nah. I am pushing this now
2024-06-21 14:06:07 +02:00
Hannah Giovanna Dawson
3ceb92a0c4 SS14-28662 Add Baby Jail: a Jail for Babies (inverse panic bunker) (#28763) 2024-06-09 14:58:10 -04:00
AJCM-git
63e0ee08cb Fixes client having authority over rules popup cvars (#28655)
* Fixes client having authority over rules popup cvars

* Delete duplicate migration

* Pre-update

* Post-update
2024-06-07 21:53:20 +02:00
Nemanja
1333b48747 Convert rules to use guidebook parsing (#28647) 2024-06-06 03:11:26 -04:00
DrSmugleaf
19be94c9ea Add job whitelist system (#28085)
* Add job whitelist system

* Address reviews

* Fix name

* Apply suggestions from code review

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>

* cancinium

---------

Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
2024-06-01 05:08:31 -07:00
Pieter-Jan Briers
bbf0505fdc Re-add IAdminRemarksCommon to DB model for SS14.Admin (#27028)
This was removed in #25280 as the relevant DB entities didn't go outside the DB layer anymore. SS14.Admin however still uses them directly (as it only supports Postgres), so the interface is still useful there.
2024-04-17 00:19:36 +02:00
metalgearsloth
12766fe6e3 Loadouts redux (#25715)
* Loadouts redux

* Loadout window mockup

* More workout

* rent

* validation

* Developments

* bcs

* More cleanup

* Rebuild working

* Fix model and loading

* obsession

* efcore

* We got a stew goin

* Cleanup

* Optional + SeniorEngineering fix

* Fixes

* Update science.yml

* add

add

* Automatic naming

* Update nukeops

* Coming together

* Right now

* stargate

* rejig the UI

* weh

* Loadouts tweaks

* Merge conflicts + ordering fix

* yerba mate

* chocolat

* More updates

* Add multi-selection support

* test

h

* fikss

* a

* add tech assistant and hazard suit

* huh

* Latest changes

* add medical loadouts

* and science

* finish security loadouts

* cargo

* service done

* added wildcards

* add command

* Move restrictions

* Finalising

* Fix existing work

* Localise next batch

* clothing fix

* Fix storage names

* review

* the scooping room

* Test fixes

* Xamlify

* Xamlify this too

* Update Resources/Prototypes/Loadouts/Jobs/Medical/paramedic.yml

Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com>

* Update Resources/Prototypes/Loadouts/loadout_groups.yml

Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com>

* Update Resources/Prototypes/Loadouts/Jobs/Civilian/clown.yml

Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com>

* Update Resources/Prototypes/Loadouts/Jobs/Civilian/clown.yml

Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com>

* Update Resources/Prototypes/Loadouts/loadout_groups.yml

Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com>

* Update Resources/Prototypes/Loadouts/Jobs/Security/detective.yml

Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com>

* Update Resources/Prototypes/Loadouts/loadout_groups.yml

Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com>

* ben

* Margins

---------

Co-authored-by: Firewatch <54725557+musicmanvr@users.noreply.github.com>
Co-authored-by: Mr. 27 <koolthunder019@gmail.com>
Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com>
2024-04-16 22:57:43 +10:00
Pieter-Jan Briers
d3ac3d06bb Fix database round start date issues (#26838)
How can ONE DATABASE COLUMN have so many cursed issues I don't know, but it certainly pissed off the devil in its previous life.

The start_date column on round entities in the database was added by https://github.com/space-wizards/space-station-14/pull/21153. For some reason, this PR gave the column a nonsensical default value instead of making it nullable. This default value causes the code from #25280 to break. It actually trips an assert though that's not what the original issue report ran into.

This didn't get noticed on wizden servers because we at some point backfilled the start_date column based on the stored admin logs.

So I change the database model to make this column nullable, updated the C# code to match, and made the existing migration set the invalid values to be NULL instead. Cool.

Wait how's SQLite handle in this scenario anyways? Well actually turns out the column was *completely broken* in the first place!

The code for inserting into the round table was copy pasted between SQLite and PostgreSQL, with the only difference being that the SQLite key manually assigned the primary key instead of letting SQLite AUTOINCREMENT it. And then the code to give a start_date value was only added to the PostgreSQL version (which is actually in the base class already). So for SQLite that column's been filled up with the same invalid default the whole time.

Why was the code manually assigning a PK? I checked the SQLite docs for AUTOINCREMENT[1], and the behavior seems appropriate.

I removed the SQLite-specific code path and it just seems to work regardless. The migration just sets the old values to NULL too.

BUT WAIT, THERE'S MORE!

Turns out just doing the migration on SQLite is a pain in the ass! EF Core has to create a new table to apply the nullability change, because SQLite doesn't support proper ALTER COLUMN. This causes the generated SQL commands to be weird and the UPDATE for the migration goes BEFORE the nullability change... I ended up having to make TWO migrations for SQLite. Yay.

Fixes #26800

[1]: https://www.sqlite.org/autoinc.html
2024-04-14 07:39:43 +02:00
Pieter-Jan Briers
4ad1e0598b Fix missing semicolon after migration. (#26337)
Are you kidding me EFCore doesn't sanitize this itself?
2024-03-22 16:50:55 +01:00
Pieter-Jan Briers
d776c4b392 Improve admin message seen/dismiss state. (#26223)
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.
2024-03-21 16:15:46 +01:00
Pieter-Jan Briers
fc76996dc5 Fix EFCore obsoletion warnings in Content.Server.Database (#26285) 2024-03-20 15:47:36 +01:00
Pieter-Jan Briers
b1de6dd601 Switch project files to C# 12. (#25487)
Just unlocks new language features like primary constructors.
2024-02-23 15:02:59 +11:00
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
Krunklehorn
ed0f2aa221 Client customization late-join spawner priority for arrivals/cryostorage (#24586)
* Initial commit, requires server restart to take effect

* Exposes callbacks directly instead, takes effect immediately

* Cleaned up control flow, swapped cvar for client customization

* Switched to int, dictionary of callbacks, migration

* Update Content.Shared/Preferences/SpawnPriorityPreference.cs

* krunkle stan

---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2024-02-01 21:12:09 +11: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
a39999fb9c Fix admin log key order. (#23052)
The keys for admin logs were set as (log_id, round_id). This made no sense because logs are usually accessed per round.
2024-01-11 01:03:25 +01:00
Pieter-Jan Briers
b4f8393f42 Log server ID in connection logs table (#21911) 2023-12-07 09:48:56 +11:00
DrSmugleaf
0e0ac5fcc5 Drop admin log entity db table (#21216) 2023-10-23 22:08:20 -07:00
DrSmugleaf
52e1d64ee2 Stop all reads/writes to the admin_log_entity table (#21186) 2023-10-22 21:24:03 -07:00
DrSmugleaf
43d5c00648 Store round start date in the database (#21153) 2023-10-22 21:01:48 -07:00
Pieter-Jan Briers
7c9d7423d2 Remove autogenerated from admin log key. (#18377) 2023-07-29 16:44:28 +10:00
Pieter-Jan Briers
e0c4884995 GDPR stuff update (#18300) 2023-07-26 20:05:51 +02:00
Pieter-Jan Briers
b4b0fe41db Admin notes bugfixes (#18189) 2023-07-21 15:43:47 +02: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
Chief-Engineer
5eba1d230a Add IP ban exemption flag (#15815) 2023-04-27 11:59:18 -07:00
Pieter-Jan Briers
c8e90e561b Server ban exemption system (#15076) 2023-04-03 10:24:55 +10:00
Pieter-Jan Briers
360a507688 Shared interfaces for server and role ban entities (#14730) 2023-03-18 20:44:14 +01:00
Pieter-Jan Briers
c5b3f62f6f Update project files for configuration changes. (#14281) 2023-03-06 11:38:07 -08:00
Pieter-Jan Briers
220b19f5ca Rename migrations to fix CS8981 warnings. (#14160) 2023-02-19 10:59:52 +11:00
DrSmugleaf
cd803a82bd Update projects to C# 11 (#13111) 2022-12-20 22:33:57 +11:00
Visne
4cc5fa239e Implement traits system (#10693) 2022-09-10 08:40:06 -07:00
Pieter-Jan Briers
e852ada6c8 Play time tracking: Job timers 3: more titles: when the (#9978)
Co-authored-by: Veritius <veritiusgaming@gmail.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
2022-08-07 16:00:42 +10:00
Moony
8e90bf46e9 Implements panic bunkering. (#9315)
* Implements panic bunkering.
Helps with raid management, esp with unknown accounts.

* adds an enable/disable command.
2022-07-01 22:46:37 +02:00
wrexbe
0fc8c0ef5e Update some nugets (#8738) 2022-06-09 18:25:59 -07:00
Veritius
3b7e202044 Flavor text (#8070) 2022-05-13 15:58:45 -07:00