Commit graph

76 commits

Author SHA1 Message Date
xuyuwtu
4671a6d7f7 resolve some warnings 2026-01-29 15:16:53 +08:00
xuyuwtu
75c8a8ced4 Use better code 2026-01-29 13:50:09 +08:00
Terrabade
55e80e044c Add player bans to server reload 2025-05-24 11:21:03 +01:00
Sakura Akeno Isayeki
9c473e35a6
refactor(db/pgsql): Revert SQL queries, lower column casing for PGSQL
Reverts SQL query identifier escaping to simplify queries and improves overall readability by using lowercase column names.

Enhances maintainability and alignment with database conventions by adopting a uniform casing scheme across all SQL operations.

Removes unnecessary complexity in query construction, streamlining the database operations performed within the application.
2025-05-03 19:21:10 +02:00
Sakura Akeno Isayeki
2d839e3609
fix(db/postgres): Resolve SQL identifier casing issues
Improves SQL query execution by ensuring proper casing for identifiers across various database types, particularly for Postgres.

Enhances security and compatibility by using an identifier escaping method, preventing potential errors due to case sensitivity in SQL queries.

Addresses potential issues with existing queries for better reliability and consistency.
2025-04-29 00:47:19 +02:00
Sakura Akeno Isayeki
084411f847
refactor(db): Update SqlQueryBuilder references + Various refactors
Consolidates the creation of SQL query builders across multiple classes to ensure a unified approach for database operations.

Replaces manual type checks and specific query creators with a generic method for better maintainability and to prevent errors.

Improves code readability and reduces duplication, facilitating easier updates in the future.
2025-04-28 15:51:26 +02:00
Sakura Akeno Isayeki
8a75b1fdc5
refactor(db): Move DbQueryBuilders to separate namespace
Removes obsolete query builder interface and implementations.

Introduces a new namespace for query-related classes to enhance organization.

Updates various database managers to use the new query utilities, promoting code reuse and maintainability.

Enhances query functionality, ensuring better consistency across the codebase.
2025-04-28 14:06:02 +02:00
ohayo
6d5fff83cf Prevent blank UUIDs from being banned
This fixes a bug with a bad actor getting banned with a blank client UUID and then preventing anyone from joining the server due to a lack of UUID on the Connect Request ban check.
2025-02-08 14:37:48 +10:00
Janet Blackquill
f63b26ac76 Some i18nifiying 2022-10-21 16:12:04 -04:00
Chris
e80f0bfda5 Add ban ticket ID to ban messages 2021-04-19 21:48:34 +09:30
Luke
d0ce5746ea Fix mysql & sqlite ban manager migration during init
Tested with existing bans in both sqlite & mysql environments.
This is in addition to the syntax fix from earlier.
2021-04-11 21:18:37 +10:00
Lucas Nicodemus
78eab01904 Fix ban system conversion issue with MySQL
DeathCradle spotted a typo in the ban converter and identified that the
issue is likely because we used table_name in some, but not all, of the
conversion SQL.

Co-authored-by: DeathCradle <rt.luke.s@gmail.com>
2021-04-11 00:12:28 -07:00
Chris
9423febd0a Refactor for new configuration 2020-12-03 17:43:10 +10:30
Chris
ae8ab04e8a Change BanManager.Bans to a readonly dictionary
Entries to this dictionary should be added through `InsertBan` rather than directly to the dictionary
2020-12-03 14:25:38 +10:30
Chris
24a4ab885c Offload ban checking to BanManager
Remove ban immunity
2020-11-29 18:10:47 +10:30
Chris
af9957f8ec Refactoring based on suggestions 2020-11-29 16:18:09 +10:30
Chris
29170e62a6 Rename unique ID -> ticket number
Also get ban conversion to execute cleanly and clean up after itself
2020-11-29 15:17:49 +10:30
Chris
c71cf79125 Refactor 'Id' to 'TicketNumber' and extend the identifier model 2020-11-29 14:23:58 +10:30
Chris
cde4cc5f04 Ban rewrite and various other adjustments 2020-11-26 17:20:19 +10:30
Chris
56de9f6684 Ban rewrite 2020-11-15 11:05:04 +10:30
Lucas Nicodemus
70dd72443d Update copyright to 2019 again
Fixes #1658, most likely.
2019-03-29 17:16:37 -07:00
Lucas Nicodemus
569b350cea Update to Pryaxis, 2018 part 2
If there's one thing I learned in this exercise, it's that letting
people add random python scripts to the repo like gpltext.py that
promise to be easier than find and replace is a bad idea.
2018-01-01 02:20:56 -07:00
Lucas Nicodemus
17d151b8f8 Move HasBanExpired to Bans.RemoveBanIfExpired().
The ban system needs a full rewrite anyway, but this move removes
something from Utils, puts it closer to its operating point, simplifies
the method, and clarifies what it actually does.
2017-12-29 08:32:45 -07:00
Lucas Nicodemus
903bd5bb75 Migrate AddBan2 calls to AddBan
No more deprecation warnings on this release #yolo
2017-12-26 20:05:52 -07:00
Lucas Nicodemus
718525904a Add remaining backbone for banning accounts (sort of)
Frontend still doesn't work properly. In particular:

1. Need a way to list bans by account name.
2. Need a way to unban by account name.
3. Really need a way to change the IP on a ban lol.

Ban system still needs to be be rebuilt fully, but at least this
doesn't necessarily character ban someone if you were going for an IP
ban.

Fixes #1412
2017-12-02 20:41:14 -07:00
Lucas Nicodemus
0edfc6834f Add technical infrastructure for adding account bans 2017-12-02 19:19:17 -07:00
White
c4a3a9fb67 Updated Copyright for 2017 2017-03-13 12:17:16 +10:30
White
3989f0e21a Ban.BanDateTime and Ban.ExpirationDateTime are now nullable, in case of bad bans.
Ban sorting now uses an IComparer<Ban> to do its dirty work.
2017-02-21 22:18:41 +10:30
White
3ec7cb1d09 Renamed Ban.DateTime to Ban.BanDateTime because System.DateTime is a thing
Ban.BanDateTime and Ban.ExpirationDateTime are now actually set
2017-02-21 21:42:50 +10:30
White
c3cffd1559 BanManager.cs now consistently uses tabs 2017-02-21 21:17:31 +10:30
White
dba89e45c8 Added sorting to ban retrieval.
Default retrieval sorts bans by the date they were added, from newest to oldest.
Progress on #1400
2017-02-21 16:40:59 +10:30
Lucas Nicodemus
678f6c7cf8
Update to Mintaka (thanks @enerdy) 2016-12-06 17:36:44 -07:00
Adilson Carvalho
49b4effe74 Changed year to 2016 on all GPL headers 2016-10-16 17:06:02 -02:00
Beau Hastings
c0771556fc Fixes #1116
Signed-off-by: Beau Hastings <beausy@gmail.com>
2015-10-07 11:42:20 -05:00
Tyler Watson
01486f7ba9 Fixed an issue preventing bans being added when a ban already existed
Fixes #1094
2015-08-21 22:58:52 +10:00
Lucas Nicodemus
d971db165c Remove several obsolete shims
No need to keep obsolete shims in for several versions of TShock
2015-02-28 20:15:56 -07:00
Lucas Nicodemus
cbce64f1eb Remove more obsolete code; fix tab/space screwup in TSPlayer 2015-02-28 19:37:06 -07:00
Lucas Nicodemus
04145a4aca Re-add EnsureExists signature to fix compat with old plugins
Fixes #862
2015-02-22 08:43:12 -07:00
Zack
f9bf470b1d Tick version and update copyright 2015-01-28 15:29:13 -05:00
Zack
fb451c6d49 Update license header for 2014 2014-07-10 21:48:33 -04:00
Zack
fee116c6df Update BanManager.cs
Fix uuid arg in constructor
2014-02-27 21:50:16 -05:00
MarioE
ebc36a5ada Add temp banning, remove /ban clear, fix temp ban check 2013-11-10 23:03:12 -05:00
Zack Piispanen
df5eb940bd Fix compat sigs ban method. 2013-10-01 19:02:21 -04:00
Zack Piispanen
931e65fd80 Fix bans. 2013-10-01 18:38:39 -04:00
Zidonuke Ghost
b2a8198bb1 Client UUID Implementation: Bans and User Auth.
Send ServerSideCharacter flag if set in WorldInfo.
2013-10-01 04:35:49 -04:00
Zack Piispanen
038b2c027d Added Registered field to user db.
Set all those time based fields to use UtcNow, sortable
2013-09-30 20:32:43 -04:00
Zack Piispanen
856def83b3 Added basic framework for allowing for ban durations and banning admin.
Added BanningUser, Date(of ban), and Expiration to the db
On join, Expiration is checked, if ban is expired we remove it and the user is allowed on.
When running the ban command, your UAN is used as the banning user, and the date is that moment, with no expiration.
#531
2013-09-22 16:04:12 -04:00
Zack Piispanen
b22457382e remove unused using statements 2013-09-17 02:24:02 -04:00
Lucas Nicodemus
ae7ab5f234 Updated copyright information to point to 2013. 2013-08-22 21:51:17 -06:00
Lucas Nicodemus
8d5cdf04a8 Update copyright to reflect actual year date. 2012-04-24 12:45:46 -06:00