Extract multiplexer dialect and resumable terminal engine registries while preserving session and checkpoint compatibility. Share local-network and theme policies, add regression coverage, and update discovery actions to Cancel and Rescan with localized Telnet copy.
27 lines
830 B
Swift
27 lines
830 B
Swift
import TermindDomain
|
|
|
|
import struct TermindDomain.Host
|
|
|
|
public nonisolated enum HostWakeOutcome: Equatable, Sendable {
|
|
case accessDenied
|
|
case configurationRequired
|
|
case sent
|
|
case failed
|
|
}
|
|
|
|
extension HostLibraryModel {
|
|
/// Request access before configuration, then read the latest saved preferences.
|
|
public func requestWake(_ proposed: Host, requestAccess: () -> Bool) -> HostWakeOutcome {
|
|
guard requestAccess() else { return .accessDenied }
|
|
let host = host(proposed.id) ?? proposed
|
|
guard host.wakeOnLAN.address != nil else { return .configurationRequired }
|
|
do {
|
|
guard let wakeOnLAN else { throw WakeOnLANError.noLocalNetwork }
|
|
try wakeOnLAN.wake(host.wakeOnLAN)
|
|
return .sent
|
|
} catch {
|
|
return .failed
|
|
}
|
|
}
|
|
}
|