From 5c30c5862f481ec331e2e2268ae8c516ed5ff2c2 Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Tue, 28 Jul 2026 01:47:42 +0800 Subject: [PATCH] fix: preserve WoL broadcast address (#1097) --- src/ui/sidebar/HostManagerData.ts | 1 + src/ui/tests/sidebar/HostManagerData.test.ts | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 src/ui/tests/sidebar/HostManagerData.test.ts diff --git a/src/ui/sidebar/HostManagerData.ts b/src/ui/sidebar/HostManagerData.ts index 2f2d466e..c0f9ffb5 100644 --- a/src/ui/sidebar/HostManagerData.ts +++ b/src/ui/sidebar/HostManagerData.ts @@ -63,6 +63,7 @@ export function sshHostToHost(h: SSHHostWithStatus): Host { notes: h.notes, pin: h.pin ?? false, macAddress: h.macAddress, + wolBroadcastAddress: h.wolBroadcastAddress, enableSsh: h.enableSsh != null ? h.enableSsh : isSshHost, enableTerminal: h.enableTerminal ?? (h.enableSsh != null ? h.enableSsh : isSshHost), diff --git a/src/ui/tests/sidebar/HostManagerData.test.ts b/src/ui/tests/sidebar/HostManagerData.test.ts new file mode 100644 index 00000000..a45556fb --- /dev/null +++ b/src/ui/tests/sidebar/HostManagerData.test.ts @@ -0,0 +1,18 @@ +import { describe, expect, it } from "vitest"; +import type { SSHHostWithStatus } from "@/main-axios"; +import { sshHostToHost } from "@/sidebar/HostManagerData"; + +describe("sshHostToHost", () => { + it("preserves the Wake-on-LAN broadcast address for editing", () => { + const host = sshHostToHost({ + id: 1, + name: "server", + ip: "192.168.0.10", + port: 22, + username: "root", + wolBroadcastAddress: "192.168.0.255", + } as SSHHostWithStatus); + + expect(host.wolBroadcastAddress).toBe("192.168.0.255"); + }); +});