fix: preserve bind IP when editing forward without explicit inIp change

- Add replaceForwardPortsPreservingInIP to maintain existing InIP values
- Track inIpTouched state in frontend to distinguish user changes
- Only send inIp in update request when user explicitly changed it
- Add unit tests for forward port replacement with preserved InIP
This commit is contained in:
sagitchu
2026-03-03 20:22:58 +08:00
parent 75edeb9afa
commit 1450b25475
5 changed files with 129 additions and 29 deletions
@@ -115,7 +115,10 @@ const validateNyItem = (line: string, value: unknown): ParsedNyImportLine => {
return { line, error: "listen_port格式错误,应为1-65535之间的数字" };
}
if (normalizedListenPort !== null && !isValidListenPort(normalizedListenPort)) {
if (
normalizedListenPort !== null &&
!isValidListenPort(normalizedListenPort)
) {
return { line, error: "listen_port必须为1-65535之间的数字" };
}