diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f0c7b51..e5c93c3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Fixed + +- Only show pushed server configuration. + ## 1.9.1 (2019-11-10) ### Changed diff --git a/Passepartout-iOS/Scenes/ConfigurationViewController.swift b/Passepartout-iOS/Scenes/ConfigurationViewController.swift index b0124fd2..db69e46b 100644 --- a/Passepartout-iOS/Scenes/ConfigurationViewController.swift +++ b/Passepartout-iOS/Scenes/ConfigurationViewController.swift @@ -46,12 +46,16 @@ class ConfigurationViewController: UIViewController, StrongTableHost { return originalConfigurationURL != nil } + var isServerPushed = false + weak var delegate: ConfigurationModificationDelegate? // MARK: StrongTableHost - lazy var model: StrongTableModel = { - let model: StrongTableModel = StrongTableModel() + let model: StrongTableModel = StrongTableModel() + + func reloadModel() { + model.clear() // sections model.add(.communication) @@ -59,7 +63,9 @@ class ConfigurationViewController: UIViewController, StrongTableHost { if isEditable { model.add(.reset) } - model.add(.tls) + if !isServerPushed { + model.add(.tls) + } model.add(.other) // headers @@ -74,18 +80,47 @@ class ConfigurationViewController: UIViewController, StrongTableHost { } // rows - model.set([.cipher, .digest], forSection: .communication) + if isServerPushed { + var rows: [RowType] + + rows = [] + if let _ = configuration.cipher { + rows.append(.cipher) + } + if let _ = configuration.digest { + rows.append(.digest) + } + model.set(rows, forSection: .communication) + + rows = [] + if let _ = configuration.compressionFraming { + rows.append(.compressionFraming) + } + if let _ = configuration.compressionAlgorithm { + rows.append(.compressionAlgorithm) + } + model.set(rows, forSection: .compression) + + rows = [] + if let _ = configuration.keepAliveInterval { + rows.append(.keepAlive) + } + if let _ = configuration.renegotiatesAfter { + rows.append(.renegSeconds) + } + if let _ = configuration.randomizeEndpoint { + rows.append(.randomEndpoint) + } + model.set(rows, forSection: .other) + } else { + model.set([.cipher, .digest], forSection: .communication) + model.set([.compressionFraming, .compressionAlgorithm], forSection: .compression) + model.set([.keepAlive, .renegSeconds, .randomEndpoint], forSection: .other) + } if isEditable { model.set([.resetOriginal], forSection: .reset) } model.set([.client, .tlsWrapping, .eku], forSection: .tls) - model.set([.compressionFraming, .compressionAlgorithm], forSection: .compression) - model.set([.keepAlive, .renegSeconds, .randomEndpoint], forSection: .other) - - return model - }() - - func reloadModel() { } // MARK: UIViewController @@ -96,7 +131,8 @@ class ConfigurationViewController: UIViewController, StrongTableHost { guard let _ = initialConfiguration else { fatalError("Initial configuration not set") } - + reloadModel() + guard isEditable else { tableView.allowsSelection = false return diff --git a/Passepartout-iOS/Scenes/ServiceViewController.swift b/Passepartout-iOS/Scenes/ServiceViewController.swift index 4f64607e..3745f6ab 100644 --- a/Passepartout-iOS/Scenes/ServiceViewController.swift +++ b/Passepartout-iOS/Scenes/ServiceViewController.swift @@ -522,6 +522,7 @@ class ServiceViewController: UIViewController, StrongTableHost { let vc = StoryboardScene.Main.configurationIdentifier.instantiate() vc.title = caption vc.initialConfiguration = $0 + vc.isServerPushed = true self?.navigationController?.pushViewController(vc, animated: true) } }