mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-18 22:49:10 +00:00
Set supported preset on start
This commit is contained in:
parent
6f1fe36412
commit
d44e9f861b
@ -275,6 +275,9 @@ public class ConnectionService: Codable {
|
|||||||
providerProfile.poolId = fallbackPool.id
|
providerProfile.poolId = fallbackPool.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX: fix unsupported preset
|
||||||
|
providerProfile.setSupportedPreset()
|
||||||
|
|
||||||
profile = providerProfile
|
profile = providerProfile
|
||||||
|
|
||||||
case .host:
|
case .host:
|
||||||
|
@ -76,6 +76,16 @@ public class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable {
|
|||||||
presetId = infrastructure.defaults.preset
|
presetId = infrastructure.defaults.preset
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func setSupportedPreset() {
|
||||||
|
guard let pool = pool else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let supported = pool.supportedPresetIds(in: infrastructure)
|
||||||
|
if let current = preset?.id, !supported.contains(current), let fallback = supported.first {
|
||||||
|
presetId = fallback
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private func validateEndpoint() {
|
private func validateEndpoint() {
|
||||||
guard let pool = pool, let preset = preset else {
|
guard let pool = pool, let preset = preset else {
|
||||||
manualAddress = nil
|
manualAddress = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user