Distinguish SSH route admission from Telnet target admission and wire Telnet access and automatic Wake hooks. Await entitlement resolution for manual Wake and duplication before host or credential mutation. Use explicit protocol-extension forwarding overloads so existential single-argument calls cannot bypass the concrete admission witness. Remove dead paywall state and update obsolete quota/date test fixtures. Validation: 81 focused macOS and 58 focused iOS tests passed.
42 lines
1.4 KiB
Swift
42 lines
1.4 KiB
Swift
import Foundation
|
|
import TermindApplication
|
|
import TermindDomain
|
|
import TermindPresentation
|
|
import TermindRemoteInfrastructure
|
|
|
|
import struct TermindDomain.Host
|
|
|
|
extension AppModel {
|
|
func localDiscoveryModel(protocol connectionProtocol: LocalDiscoveryProtocol) -> LocalDiscoveryModel {
|
|
LocalDiscoveryModel(service: LANHostDiscovery(connectionProtocol: connectionProtocol))
|
|
}
|
|
|
|
func requestWake(_ host: Host, configure: () -> Void) async -> String? {
|
|
do {
|
|
switch try await hostLibrary.requestWake(host) {
|
|
case .configurationRequired:
|
|
configure()
|
|
return nil
|
|
case .sent:
|
|
return String(localized: AppStrings.LocalNetwork.sent)
|
|
case .failed:
|
|
return String(localized: AppStrings.LocalNetwork.wakeFailed)
|
|
}
|
|
} catch HostAccessError.lockedHost {
|
|
proAccess.presentPaywall()
|
|
return nil
|
|
} catch is CancellationError {
|
|
return nil
|
|
} catch {
|
|
return HostAccessError.presentationDescription(of: error)
|
|
}
|
|
}
|
|
|
|
func macAddressModel(host: Host, custom: HostCustomIdentityDraft, tailscaleUsername: String) -> HostMACAddressModel
|
|
{
|
|
HostMACAddressModel(
|
|
host: host, library: hostLibrary, resolver: SSHHostMACAddressResolver(coordinator: connections),
|
|
custom: custom, tailscaleUsername: tailscaleUsername)
|
|
}
|
|
}
|