mirror of
https://github.com/LHY0125/Gobang-Game.git
synced 2026-06-28 16:35:55 +08:00
fix: 代码审查修复 — serde camelCase/CSP/TS检查/replay/undo/AI禁手/星位/未使用依赖
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -98,6 +98,14 @@ pub fn undo(steps: u32, state: State<AppState>) -> Result<(), String> {
|
||||
board = board.undo().map_err(|e| e.to_string())?;
|
||||
}
|
||||
|
||||
// 根据剩余步数修正当前颜色 (偶数 = 黑, 奇数 = 白)
|
||||
let corrected_color = match board.history().last() {
|
||||
Some(last_move) => last_move.color.opponent(),
|
||||
None => state.config.lock().map_err(|e| e.to_string())?.player_color,
|
||||
};
|
||||
*state.current_color.lock().map_err(|e| e.to_string())? = corrected_color;
|
||||
*state.game_over.lock().map_err(|e| e.to_string())? = false;
|
||||
|
||||
*board_opt = Some(board);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": null
|
||||
"csp": "default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob:; connect-src 'self' ipc: http://ipc.localhost"
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
|
||||
Reference in New Issue
Block a user