Harden chess against forged packets and lost moves
- Chain values count once and in order; moves need a fresh value - Game info carries the inviter's chain value; colours come from the invite - Accepters keep their seed; unconfirmed sends keep the move and resend it - Check draw accept and timeout claim preconditions; drop unused minutes - Notify in the background, keep own games under the cap, 16-bit ply - Sanitise adopted castling rights, guard incoming handling - Localised square labels and translations for the new strings - Restore two Korean strings changed by mistake
This commit is contained in:
1 parent
adead644c7
commit
c2877f6875
53 files changed
+1977
-306
No files matched your search
@@ -154,6 +154,7 @@ void _seedChessGames(ChessService chess, String channelId) {
|
||||
deadline: ChessDeadline.hour1,
|
||||
whiteCommitment: white.commitment,
|
||||
blackCommitment: black.commitment,
|
||||
inviterValue: white.valueAt(1),
|
||||
whiteName: 'Alexandra the Long-Named',
|
||||
blackName: 'Bartholomew Repeater Fan',
|
||||
),
|
||||
@@ -167,9 +168,11 @@ void _seedChessGames(ChessService chess, String channelId) {
|
||||
ChessMovePacket(
|
||||
gameId: _chessGameId,
|
||||
ply: i + 1,
|
||||
minutes: i,
|
||||
moveIndex: index,
|
||||
chainValue: (i.isEven ? white : black).valueAt(i ~/ 2 + 1),
|
||||
// White invited, so its value 1 belongs to the game info.
|
||||
chainValue: i.isEven
|
||||
? white.valueAt(i ~/ 2 + 2)
|
||||
: black.valueAt(i ~/ 2 + 1),
|
||||
position: probe.packedPosition(),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user