Commit graph

4387 commits

Author SHA1 Message Date
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
69b98980f1
feat(db): add Postgres support to configuration
Extends database configuration to support Postgres in addition to existing SQLite and MySQL options.

Includes new settings for Postgres host, database name, username, and password.

Implements a connection builder for Postgres, ensuring proper error handling when connecting.

Updates dependency to include Npgsql for Postgres connectivity.
2025-04-28 15:51:27 +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
27fde1f9ac
feat(db): Add Postgres to SQL connection types + Refactor matching logic
Implements pattern matching for easier identification of database types.

Adds support for Postgres alongside existing Sqlite and MySQL types, enhancing flexibility for database connections.

Updates enum to include Postgres type.
2025-04-28 14:17:59 +02:00
Sakura Akeno Isayeki
f28f1bf536
feat(db): Add PostgreSQL query creator implementation
Implements a query creator for PostgreSQL, allowing for proper database type mapping and table creation functionalities.

Enhances the library's database support by incorporating PostgreSQL-specific features such as SERIAL/BIGSERIAL for auto-increment columns and improved escape handling for table names.

Improves the extensibility and compatibility of the database framework with different SQL databases.
2025-04-28 14:09:10 +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
Sakura Akeno Isayeki
0021f9884d
refactor(server/db): Move database connection logic to separate class
Implements a DbBuilder class to streamline the creation of database connections for both SQLite and MySQL storage types.

Enhances error handling for database setup and ensures that necessary directories are created dynamically based on configuration settings.

This refactor improves code maintainability and readability, consolidating connection logic into a dedicated builder class.
2025-04-21 14:04:27 +02:00
Nightklp
43daa67465
Update TShockAPI/Bouncer.cs
Co-authored-by: Arthri <41360489+Arthri@users.noreply.github.com>
2025-04-04 12:49:31 +08:00
Nightklp
3af71c70fe
Update TShockAPI/Bouncer.cs
Co-authored-by: Arthri <41360489+Arthri@users.noreply.github.com>
2025-04-04 12:48:09 +08:00
Cai
57a3173a4d fix(SpawnHandler): player "break" after respawning 2025-04-04 01:58:55 +08:00
Nightklp
f814d568e5
Update Bouncer.cs
return a item when a item frame was interacted in protected region you do not have permission with
2025-04-03 16:21:57 +08:00
LaoSparrow
596d7873b7 fix(SendTileRectHandler): unable to place LogicSensors 2025-03-25 15:27:43 +08:00
Lucas Nicodemus
d595a3fe0a
Merge branch 'general-devel' into pr3076 2025-03-18 17:04:35 +09:00
SGKoishi
413a2b91e3
Fix Pryaxis/TShock#3073 2025-03-18 17:17:45 +09:00
LaoSparrow
988042e6c1 fix(Bouncer/SendTileRectHandler): two typos which causes incorrect validating range 2025-03-17 22:12:54 +08:00
Lucas Nicodemus
29477ab305
Update version codename 2025-03-15 17:33:04 +09:00
SGKoishi
ea5c274279
Add default permissions 2025-03-15 14:21:28 +09:00
SGKoishi
4e26051869
Fix some confusion introduced by 98eed42 and b184133 2025-03-15 14:09:00 +09:00
Lucas Nicodemus
db9c47d7c0
Version tick: 5.2.3 2025-03-10 01:22:38 +09:00
Lucas Nicodemus
56041f2c1a
Merge remote-tracking branch 'ghsa/handshake-final-update-fix' into general-devel 2025-03-10 01:08:28 +09:00
Lucas Nicodemus
18ffe08293
Merge branch 'general-devel' into feature/properly-seed-group-names-in-database 2025-03-10 00:56:13 +09:00
Lucas Nicodemus
329fce0089
Merge branch 'general-devel' into feature/properly-seed-group-names-in-database 2025-03-10 00:51:37 +09:00
Lucas Nicodemus
c89c34b356
Merge branch 'general-devel' into add-moondial-permission 2025-03-10 00:49:27 +09:00
Lucas Nicodemus
13a4a0864b
Merge branch 'general-devel' into playerdata-changes 2025-03-10 00:39:33 +09:00
Lucas Nicodemus
531ec1376c
Merge branch 'general-devel' into general-devel 2025-03-10 00:20:50 +09:00
Lucas Nicodemus
25644449e8
Merge branch 'general-devel' into fix-infinities 2025-03-10 00:16:22 +09:00
ohayo
1abb53b22e
Update TShockAPI/TSPlayer.cs
Oops

Co-authored-by: Chris <2648373+QuiCM@users.noreply.github.com>
2025-03-04 21:01:01 +10:00
ohayo
701a7d1ca0
Update TShockAPI/TSPlayer.cs
Co-authored-by: Chris <2648373+QuiCM@users.noreply.github.com>
2025-03-04 21:00:33 +10:00
LaoSparrow
740c5c9250 fix(GetDataHandlers): handle and ignore NpcItemStrike(msgid 24) 2025-03-01 03:53:13 +08:00
LaoSparrow
28aa3aea48 fix(Bouncer/SendTileRectHandler): tile rect changes not synced between clients && unable to place HatRack 2025-03-01 01:42:18 +08:00
LaoSparrow
1e23785a04 fix(Bouncer/SendTileRectHandler): MatchRemoval incorrect check range 2025-02-28 23:01:40 +08:00
ohayo
98eed425e2 Suppress logging of un-spawnable npcs
Not anything related to the handshake fixes, but still a nice fix which could help server owners deal with mischievous client users.
2025-02-12 21:51:14 +10:00
ohayo
56c5865043 Emergency bug fix for handshake on all/server player
The All Player does not have a valid state and because FinishedHandshake is false by default, they would never get time update packets, etc.
2025-02-11 07:47:14 +10:00
Joseph Goh
836cc33c8d rewrite: bed spawning for SSC 2025-02-10 11:42:36 +08:00
Arthri
2053213558 Bounce infinite or NaN velocity / position 2025-02-08 07:13:03 +00: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
ohayo
de142e419e I guess update the magic number here too? 2025-02-05 09:37:53 +10:00
ohayo
5a23073db5 Suggestions + fix last missed magic number 2025-02-05 09:33:36 +10:00
ohayo
72f529fcb1 Typo fix 2025-02-04 21:24:44 +10:00
ohayo
ce04d9d173 Remove magic number + Use suggestions by particles
Added a new ClientState enum based on code in Terraria.MessageBuffer.GetData & Terraria.Netplay.InnerClientLoop
2025-02-04 21:06:40 +10:00
ohayo
ff9cb9f858 Change the cast PacketTypes for 74 to its corresponding definition 2025-02-04 12:13:47 +10:00
ohayo
fa3c144274 Add necessary packets to a static hashset for further performance boosts
title
2025-02-04 11:28:09 +10:00
ohayo
52d1840003 Packet filtering for those who never finish the handshake
This also kicks those who never finish handshaking upon chat now. (To free up the resources a bit I guess?)

Before a player finishes the connection handshake, the server will check if it's necessary to send them a packet - it checks against a list of necessary packets like:

- ContinueConnecting (Send User Slot),
- PlayerSpawnSelf (CompleteConnectionAndSpawn),
- WorldInfo (Which the server does a further check if the player is at the appropriate state to be sent the world info)
- Status
- Disconnection
- TileFrameSection & TileSendSection
2025-02-04 11:07:10 +10:00
Luke
677426b746 Merge remote-tracking branch 'upstream/general-devel' into net9-upgrade 2025-02-02 16:43:59 +10:00
ohayo
b5d546a660 Remove debug logging (sorry haha) 2025-02-02 12:41:35 +10:00
ohayo
4f2fff050d Quick bug fix - forgot about respawns + only set handshake once
The connection state should NEVER be set to under 3 if the player is fully connected.
2025-02-02 12:40:04 +10:00
ohayo
4c01740177 Fix handshake stuff part 2
If the player has requested world data before sending the spawn player packet, they should be at state 3, otherwise they should be at state 1 for skipping it. Just check based on that instead.
2025-02-02 12:08:14 +10:00
Lucas Nicodemus
e4e28cb1b5
Version tick: 5.2.2 2025-02-01 22:32:36 +09:00
ohayo
53789b40e4 Prevent further things from clients who dont handshake
- The player will only finish the handshake once they spawn their player, a normal client would always do this eventually.

- They cannot chat, even if they request world data but just not spawn their player.

- Other clients will not be notified of their join/leave in both cases (dont request WD or do but dont spawn)

- And most importantly, they do not show on the in game player list but still show on the server console /playing cmd.
2025-01-31 09:17:26 +10:00
ohayo
d35934b3a2 Check for bans on connection as well as join, etc
Should prevent people from being able to bypass this.
2025-01-30 22:46:13 +10:00