Commit Graph

95 Commits

Author SHA1 Message Date
Scott Anderson b558bd722d Prevent multiple clients from using the same account (#706)
## Description:

This change blocks a persistent ID from being reused by more than one
client in the same game. This setting is only enabled in staging and
prod.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
2025-05-17 21:03:05 -07:00
Scott Anderson 70745faac4 Enable strictNullChecks, eqeqeq (#436)
## Description:

Improve type safety and runtime correctness by:
1. Enabling TypeScript's
[strictNullChecks](https://www.typescriptlang.org/tsconfig/#strictNullChecks)
compiler option.
2. Replacing all loose equality operators (`==` and `!=`) with strict
equality operators (`===` and `!==`).
3. Cleaning up of type declarations, null handling logic, and equality
expressions throughout the project.

Currently, the code allows implicit assumptions that `null` and
`undefined` are interchangeable, and relies on type-coercing equality
checks that can introduce subtle bugs. These practices make it difficult
to reason about when values may be absent and hinder the effectiveness
of static analysis.

Migrating to strict null checks and enforcing strict equality
comparisons will clarify intent, reduce bugs, and make the codebase
safer and easier to maintain.

Fixes #466 

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
Co-authored-by: evanpelle <openfrontio@gmail.com>
2025-05-15 16:39:40 -07:00
evan 7f6068ebbe anonymize ips 2025-05-09 14:40:52 -07:00
evan c5152f035f add endpoint to kick players from a game given admin token, game id & client id 2025-05-09 13:00:39 -07:00
Scott Anderson cb9b5a7a17 Remove clientID, persistentID, gameID from ClientBaseMessageSchema, TurnSchema (#666)
## Description:

Remove the devils `clientID`, `persistentID`, and `gameID` from
`ClientBaseMessageSchema`, as well as `gameID` from `TurnSchema`. These
values are already known through the `Client` object that is hoisted
into the relevant handler.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
2025-05-07 11:11:18 -07:00
Aotumuri cddcc681dd Added custom disable settings (#593)
## Description:
I will write an issue later as I don't have time.

![スクリーンショット 2025-04-23 22 04
24](https://github.com/user-attachments/assets/77754140-eee9-46bd-a98f-a3abec35ca6a)
<img width="735" alt="スクリーンショット 2025-04-23 22 04 40"
src="https://github.com/user-attachments/assets/24bb3461-8e05-418c-8dbf-2ba1a624fe27"
/>
<img width="790" alt="スクリーンショット 2025-04-23 22 04 47"
src="https://github.com/user-attachments/assets/33387200-d0af-4394-9d60-af1f88a036e9"
/>

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:
aotumuri
2025-05-07 06:14:54 -07:00
evan b3c59da29d validate persistent id on client reconnect, validate client message ClientID and intent ClientID match to prevent spoofing 2025-05-06 19:44:18 -07:00
evanpelle d6a412aa50 implement duos (#630)
## Description:
Implement Duos team mode.
Also assign teams to nations at the start instead of assigning them
randomly on spawn. This gives more consistent team sizes

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

<DISCORD USERNAME>

Co-authored-by: evan <openfrontio@gmail.com>
2025-04-30 13:47:35 -07:00
evan 94c499a5e5 fix teams mode on private multiplayer games 2025-04-24 07:47:08 -07:00
evan 13e2a02b2d fix private games not archiving because they haven't prestarted 2025-04-23 12:30:33 -07:00
Evan cdc56f3191 don't archive game if it hasn't started 2025-04-15 12:21:31 -07:00
Evan 58b151f585 remove slog, use winston instead. 2025-04-12 17:54:36 -07:00
Evan 08c2c01dae bugfix: flags not showing in game 2025-04-06 10:27:52 -07:00
Evan b947b764b7 bugfix: npe when winner is null 2025-04-04 16:10:16 -07:00
Evan 950344c0bd created prestart message: add 2 second delay before starting public games to allow all players to connect 2025-04-03 15:42:25 -07:00
Scott Anderson 52f64db6d3 Fix various ESLint violations (#402)
## Description:

Fixes a number of ESLint violations. Although I have tested these
changes through the local dev server, I don't have a high confidence
that the testing is sufficient, as I am new to this codebase. This
change would benefit from heightened scrutiny.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

fake.neo

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
2025-04-02 18:06:08 -07:00
Evan 8b6895d745 add prettier import plugin 2025-03-31 13:09:27 -07:00
evanpelle ab3f4fbac1 All players must join game before spawn (#380)
## Description:
The server stores all players that have joined, and once the game starts
it sends a list of players to all clients. Players cannot join after the
game has started. Server now generated the PlayerID instead of the
client.

The is necessary for team mode, we need to know how who is playing the
game before it starts so we can properly assign teams based on clans.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

evan
2025-03-30 17:04:29 -07:00
evanpelle d8fe41de7a teams (#349) 2025-03-27 20:43:56 -07:00
Readixyee e02361c2f4 Disable nukes option (#237)
This makes it possible to disable all nukes as well as missile silos
from the game in privat lobbies and singleplayer games
2025-03-21 13:52:36 -07:00
evanpelle b34dd8acf2 only send desync message once per client (#300) 2025-03-20 10:38:36 -07:00
evanpelle 6499569240 add winston logger (#289) 2025-03-18 14:36:30 -07:00
Evan 364387578b fix lobby duration at 60s now that we limit lobby size. remove "high traffic time" 2025-03-15 17:22:15 -07:00
Ilan Schemoul 2dd0c56583 fix: lobby were twice as long because of dynamic timer (#252)
We previously had a system where lobbyLifetime = gameCreationRate * 2
It was to always have one lobby ready.
With dynamic timer (start if enough player or timer's over) we cannot
rely on this system (which used setInterval) so we have one lobby and
check every 100ms if we need to create another lobby.
Might add 100ms+time of creating a lobby ms latency. Which is fine I
guess.
2025-03-14 14:30:05 -07:00
Ilan Schemoul 07ad7912bc feat: timer starts if enough player or enough time (#229)
Avoid these huge lobbies
2025-03-12 14:18:34 -07:00
evanpelle 5dc00bc3ab use git commit hash verification when replaying archived games (#204) 2025-03-10 12:40:36 -07:00
evanpelle 33292aec5c feat: replay archived games, gamestate hash verification (#195)
create endpoint to load archived game. when joining game client first
checks if the game is active, if not it requests the game archive from
the server. the archive is sent to LocalServer to replay the game
locally. Every 10 ticks a hash is stored on the archive, and during
replay the LocalServer verifies this hash.
2025-03-09 14:24:39 -07:00
ilan schemoul 1b76c46bc5 feat: remove LocalPersistantStats so we locally save GameRecords
GameRecords also now include PlayerStats
2025-03-08 17:39:41 +01:00
Evan 74ce3b3187 Update to Gatekeeper 2025-03-02 09:39:54 -08:00
Evan daa9820c32 added security middleware 2025-03-02 09:39:54 -08:00
Evan bad74a0488 schedule game duration based on time of day 2025-03-02 09:39:54 -08:00
Evan 3b492df56b set trust proxy to 3 2025-03-02 09:39:54 -08:00
Evan ccc2140f2d don't log each hash 2025-03-02 09:39:36 -08:00
Evan b449d6ef9b don't send desync message to client until fixed. 2025-03-02 09:39:36 -08:00
Evan a9caee6323 make GameManager more efficient 2025-03-02 09:39:36 -08:00
Evan a029b4277f use node cluster to shard server 2025-03-02 09:39:09 -08:00
Evan ff33c2db50 have server check hashes, crash game if out of sync 2025-03-02 09:29:10 -08:00
Evan cd5e2dfbb5 only limit ips in public games 2025-03-02 09:29:10 -08:00
Evan e0938253df send game hash to server each second 2025-03-02 09:29:10 -08:00
Evan 808107c9c3 don't log zod validation errors 2025-03-02 09:29:10 -08:00
NewHappyRabbit 02d5060352 Customizable creative mode 2025-02-24 23:06:50 +02:00
Evan a7f08b5233 allow up to 3 of same ip to join game 2025-02-23 19:57:51 -08:00
Evan 0994fb19bb rate limit start & create private lobby, change max game duration to 3 hours 2025-02-23 19:42:25 -08:00
Evan 528c8c371e only allow 1 ip per game, don't allow modifying public games 2025-02-23 19:42:15 -08:00
Evan 951d708763 only allow one ip per game 2025-02-23 19:41:56 -08:00
Evan a072a24433 add ws rate limiter 2025-02-23 19:41:38 -08:00
Evan 876fb8dbf9 validate persistent id to prevent player spoofing 2025-02-18 13:53:28 -08:00
Evan 6d507914c9 add websocket error handling 2025-02-12 13:31:22 -08:00
NewHappyRabbit 1f1a07113c Fixed creative mode not working in private lobby 2025-02-12 02:21:46 +02:00
NewHappyRabbit 684b0bb2e0 Added checkboxes to disable Bots and NPCs for single player and private lobbies 2025-02-11 03:29:56 +02:00