Share Vault, persistence, SSH/SFTP, forwarding, and SwiftUI components across platforms. Add mobile editors, terminal input, standalone Assistant, Metrics navigation, transfers, and a unified Live Activity with host system icons. Validation: 35 iOS tests and 100 focused macOS tests pass; formatting and zh-Hans checks pass. The full macOS run reports 14 issues in the documented timing, Keychain, and popover suites. Remaining Assistant tool and CloudKit work is tracked in Memory/MOBILE_ROLLOUT.md.
21 lines
973 B
Swift
21 lines
973 B
Swift
import Foundation
|
|
import TermindDomain
|
|
|
|
@Observable
|
|
public final class KnownHostsLibraryModel {
|
|
private let library: HostLibraryModel
|
|
public init(library: HostLibraryModel) { self.library = library }
|
|
public var entries: [KnownHostEntry] { library.knownHosts.sorted { $0.addedAt > $1.addedAt } }
|
|
public var storageError: String? { library.storageError }
|
|
public func entry(_ id: UUID) -> KnownHostEntry? { entries.first { $0.id == id } }
|
|
public func search(_ query: String) -> [KnownHostEntry] {
|
|
entries.filter {
|
|
query.isEmpty || $0.displayAddress.localizedCaseInsensitiveContains(query)
|
|
|| $0.fingerprint.localizedCaseInsensitiveContains(query)
|
|
|| $0.algorithm.rawValue.localizedCaseInsensitiveContains(query)
|
|
}
|
|
}
|
|
public func save(_ entry: KnownHostEntry) -> Bool { library.saveKnownHost(entry) }
|
|
public func delete(_ ids: Set<UUID>) -> Bool { library.deleteKnownHosts(ids) }
|
|
}
|