fix: 代码审查修复 — serde camelCase/CSP/TS检查/replay/undo/AI禁手/星位/未使用依赖

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 12:51:53 +08:00
parent bb4f393229
commit ffcc7a7675
27 changed files with 9032 additions and 181 deletions
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
{}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+8
View File
@@ -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
View File
@@ -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": {