Revisit pull section in OpenVPN Endpoint

- Hide from server diagnostics

- Use a better section title
This commit is contained in:
Davide De Rosa 2022-10-29 13:23:43 +02:00
parent b2ec7f0422
commit b2bdf23c54
14 changed files with 81 additions and 62 deletions

View File

@ -40,9 +40,15 @@ extension EndpointAdvancedView {
var body: some View { var body: some View {
List { List {
let cfg = builder.build() let cfg = builder.build()
ipv4Section if !isServerPushed {
ipv6Section pullSection(configuration: cfg)
pullSection(configuration: cfg) }
if builder.ipv4 != nil || builder.routes4 != nil {
ipv4Section
}
if builder.ipv6 != nil || builder.routes6 != nil {
ipv6Section
}
dnsSection(configuration: cfg) dnsSection(configuration: cfg)
proxySection(configuration: cfg) proxySection(configuration: cfg)
if !isReadonly { if !isReadonly {
@ -62,63 +68,6 @@ extension EndpointAdvancedView {
} }
extension EndpointAdvancedView.OpenVPNView { extension EndpointAdvancedView.OpenVPNView {
@ViewBuilder
private var ipv4Section: some View {
if builder.ipv4 != nil || builder.routes4 != nil {
Section {
if let settings = builder.ipv4 {
themeLongContentLinkDefault(
L10n.Global.Strings.address,
content: .constant(settings.localizedAddress)
)
themeLongContentLinkDefault(
L10n.NetworkSettings.Gateway.title,
content: .constant(settings.localizedDefaultGateway)
)
}
builder.routes4.map { routes in
ForEach(routes, id: \.self) { route in
themeLongContentLinkDefault(
L10n.Endpoint.Advanced.Openvpn.Items.Route.caption,
content: .constant(route.localizedDescription)
)
}
}
} header: {
Text(Unlocalized.Network.ipv4)
}
}
}
@ViewBuilder
private var ipv6Section: some View {
if builder.ipv6 != nil || builder.routes6 != nil {
Section {
if let settings = builder.ipv6 {
themeLongContentLinkDefault(
L10n.Global.Strings.address,
content: .constant(settings.localizedAddress)
)
themeLongContentLinkDefault(
L10n.NetworkSettings.Gateway.title,
content: .constant(settings.localizedDefaultGateway)
)
}
builder.routes6.map { routes in
ForEach(routes, id: \.self) { route in
themeLongContentLinkDefault(
L10n.Endpoint.Advanced.Openvpn.Items.Route.caption,
content: .constant(route.localizedDescription)
)
}
}
} header: {
Text(Unlocalized.Network.ipv6)
}
}
}
private func pullSection(configuration: OpenVPN.Configuration) -> some View { private func pullSection(configuration: OpenVPN.Configuration) -> some View {
configuration.pullMask.map { mask in configuration.pullMask.map { mask in
Section { Section {
@ -126,11 +75,61 @@ extension EndpointAdvancedView.OpenVPNView {
Text($0.localizedDescription) Text($0.localizedDescription)
} }
} header: { } header: {
Text(L10n.Global.Strings.download) Text(L10n.Endpoint.Advanced.Openvpn.Sections.Pull.header)
} }
} }
} }
private var ipv4Section: some View {
Section {
if let settings = builder.ipv4 {
themeLongContentLinkDefault(
L10n.Global.Strings.address,
content: .constant(settings.localizedAddress)
)
themeLongContentLinkDefault(
L10n.NetworkSettings.Gateway.title,
content: .constant(settings.localizedDefaultGateway)
)
}
builder.routes4.map { routes in
ForEach(routes, id: \.self) { route in
themeLongContentLinkDefault(
L10n.Endpoint.Advanced.Openvpn.Items.Route.caption,
content: .constant(route.localizedDescription)
)
}
}
} header: {
Text(Unlocalized.Network.ipv4)
}
}
private var ipv6Section: some View {
Section {
if let settings = builder.ipv6 {
themeLongContentLinkDefault(
L10n.Global.Strings.address,
content: .constant(settings.localizedAddress)
)
themeLongContentLinkDefault(
L10n.NetworkSettings.Gateway.title,
content: .constant(settings.localizedDefaultGateway)
)
}
builder.routes6.map { routes in
ForEach(routes, id: \.self) { route in
themeLongContentLinkDefault(
L10n.Endpoint.Advanced.Openvpn.Items.Route.caption,
content: .constant(route.localizedDescription)
)
}
}
} header: {
Text(Unlocalized.Network.ipv6)
}
}
private func communicationSection(configuration: OpenVPN.Configuration) -> some View { private func communicationSection(configuration: OpenVPN.Configuration) -> some View {
configuration.communicationSettings.map { settings in configuration.communicationSettings.map { settings in
Section { Section {

View File

@ -194,7 +194,7 @@ internal enum L10n {
/// MARK: DiagnosticsView -> DebugLogView /// MARK: DiagnosticsView -> DebugLogView
internal static let title = L10n.tr("Localizable", "debug_log.title", fallback: "Debug log") internal static let title = L10n.tr("Localizable", "debug_log.title", fallback: "Debug log")
internal enum Buttons { internal enum Buttons {
/// Copy /// MARK: DiagnosticsView -> DebugLogView
internal static let copy = L10n.tr("Localizable", "debug_log.buttons.copy", fallback: "Copy") internal static let copy = L10n.tr("Localizable", "debug_log.buttons.copy", fallback: "Copy")
} }
} }
@ -384,6 +384,10 @@ internal enum L10n {
/// Other /// Other
internal static let header = L10n.tr("Localizable", "endpoint.advanced.openvpn.sections.other.header", fallback: "Other") internal static let header = L10n.tr("Localizable", "endpoint.advanced.openvpn.sections.other.header", fallback: "Other")
} }
internal enum Pull {
/// Pull from server
internal static let header = L10n.tr("Localizable", "endpoint.advanced.openvpn.sections.pull.header", fallback: "Pull from server")
}
internal enum Reset { internal enum Reset {
/// If you ended up with broken connectivity after changing the communication parameters, tap to revert to the original configuration. /// If you ended up with broken connectivity after changing the communication parameters, tap to revert to the original configuration.
internal static let footer = L10n.tr("Localizable", "endpoint.advanced.openvpn.sections.reset.footer", fallback: "If you ended up with broken connectivity after changing the communication parameters, tap to revert to the original configuration.") internal static let footer = L10n.tr("Localizable", "endpoint.advanced.openvpn.sections.reset.footer", fallback: "If you ended up with broken connectivity after changing the communication parameters, tap to revert to the original configuration.")
@ -571,6 +575,10 @@ internal enum L10n {
internal static func title(_ p1: Any) -> String { internal static func title(_ p1: Any) -> String {
return L10n.tr("Localizable", "menu.system.quit.title", String(describing: p1), fallback: "Quit %@") return L10n.tr("Localizable", "menu.system.quit.title", String(describing: p1), fallback: "Quit %@")
} }
internal enum Messages {
/// The VPN, if enabled, will still run in the background. Do you want to quit?
internal static let confirm = L10n.tr("Localizable", "menu.system.quit.messages.confirm", fallback: "The VPN, if enabled, will still run in the background. Do you want to quit?")
}
} }
} }
} }

View File

@ -203,6 +203,7 @@
"endpoint.wireguard.items.allowed_ip.caption" = "Zulässige IP"; "endpoint.wireguard.items.allowed_ip.caption" = "Zulässige IP";
"endpoint.advanced.title" = "Technische Details"; "endpoint.advanced.title" = "Technische Details";
"endpoint.advanced.openvpn.sections.pull.header" = "Vom Server ziehen";
"endpoint.advanced.openvpn.sections.communication.header" = "Kommunikation"; "endpoint.advanced.openvpn.sections.communication.header" = "Kommunikation";
"endpoint.advanced.openvpn.sections.reset.footer" = "Wenn du nach einer Änderung der Kommunikations-Parameter dich nicht mehr verbinden kannst, hier tippen um zur originalen Konfiguration zurückzukehren."; "endpoint.advanced.openvpn.sections.reset.footer" = "Wenn du nach einer Änderung der Kommunikations-Parameter dich nicht mehr verbinden kannst, hier tippen um zur originalen Konfiguration zurückzukehren.";
"endpoint.advanced.openvpn.sections.compression.header" = "Komprimierung"; "endpoint.advanced.openvpn.sections.compression.header" = "Komprimierung";

View File

@ -203,6 +203,7 @@
"endpoint.wireguard.items.allowed_ip.caption" = "Επιτρεπόμενη IP"; "endpoint.wireguard.items.allowed_ip.caption" = "Επιτρεπόμενη IP";
"endpoint.advanced.title" = "Τεχνικές Λεπτομέρειες"; "endpoint.advanced.title" = "Τεχνικές Λεπτομέρειες";
"endpoint.advanced.openvpn.sections.pull.header" = "Τραβήξτε από τον διακομιστή";
"endpoint.advanced.openvpn.sections.communication.header" = "Επικοινωνία"; "endpoint.advanced.openvpn.sections.communication.header" = "Επικοινωνία";
"endpoint.advanced.openvpn.sections.reset.footer" = "Αν καταλήξατε σε κατεστραμένη συνδεσιμότητα μετά την αλλαγή των παραμέτρων επικοινωνίας, πατήστε για να επανέλθετε στην αρχική διαμόρφωση."; "endpoint.advanced.openvpn.sections.reset.footer" = "Αν καταλήξατε σε κατεστραμένη συνδεσιμότητα μετά την αλλαγή των παραμέτρων επικοινωνίας, πατήστε για να επανέλθετε στην αρχική διαμόρφωση.";
"endpoint.advanced.openvpn.sections.compression.header" = "Συμπίεση"; "endpoint.advanced.openvpn.sections.compression.header" = "Συμπίεση";

View File

@ -203,6 +203,7 @@
"endpoint.wireguard.items.allowed_ip.caption" = "Allowed IP"; "endpoint.wireguard.items.allowed_ip.caption" = "Allowed IP";
"endpoint.advanced.title" = "Technical details"; "endpoint.advanced.title" = "Technical details";
"endpoint.advanced.openvpn.sections.pull.header" = "Pull from server";
"endpoint.advanced.openvpn.sections.communication.header" = "Communication"; "endpoint.advanced.openvpn.sections.communication.header" = "Communication";
"endpoint.advanced.openvpn.sections.reset.footer" = "If you ended up with broken connectivity after changing the communication parameters, tap to revert to the original configuration."; "endpoint.advanced.openvpn.sections.reset.footer" = "If you ended up with broken connectivity after changing the communication parameters, tap to revert to the original configuration.";
"endpoint.advanced.openvpn.sections.compression.header" = "Compression"; "endpoint.advanced.openvpn.sections.compression.header" = "Compression";

View File

@ -203,6 +203,7 @@
"endpoint.wireguard.items.allowed_ip.caption" = "IP permitida"; "endpoint.wireguard.items.allowed_ip.caption" = "IP permitida";
"endpoint.advanced.title" = "Detalles técnicos"; "endpoint.advanced.title" = "Detalles técnicos";
"endpoint.advanced.openvpn.sections.pull.header" = "Obtener del servidor";
"endpoint.advanced.openvpn.sections.communication.header" = "Comunicación"; "endpoint.advanced.openvpn.sections.communication.header" = "Comunicación";
"endpoint.advanced.openvpn.sections.reset.footer" = "Si acabaste estropeando tu conectividad tras cambiar los parámetros de comunicación, pulsa para volver a la configuración inicial."; "endpoint.advanced.openvpn.sections.reset.footer" = "Si acabaste estropeando tu conectividad tras cambiar los parámetros de comunicación, pulsa para volver a la configuración inicial.";
"endpoint.advanced.openvpn.sections.compression.header" = "Compresión"; "endpoint.advanced.openvpn.sections.compression.header" = "Compresión";

View File

@ -203,6 +203,7 @@
"endpoint.wireguard.items.allowed_ip.caption" = "IP autorisée"; "endpoint.wireguard.items.allowed_ip.caption" = "IP autorisée";
"endpoint.advanced.title" = "Détails techniques"; "endpoint.advanced.title" = "Détails techniques";
"endpoint.advanced.openvpn.sections.pull.header" = "Tirer du serveur";
"endpoint.advanced.openvpn.sections.communication.header" = "Communications"; "endpoint.advanced.openvpn.sections.communication.header" = "Communications";
"endpoint.advanced.openvpn.sections.reset.footer" = "Si vous obtenez une connection erronnée après le changement des parameters de communication, tapotez pour revenir à la configuration initiale."; "endpoint.advanced.openvpn.sections.reset.footer" = "Si vous obtenez une connection erronnée après le changement des parameters de communication, tapotez pour revenir à la configuration initiale.";
"endpoint.advanced.openvpn.sections.compression.header" = "Compression"; "endpoint.advanced.openvpn.sections.compression.header" = "Compression";

View File

@ -203,6 +203,7 @@
"endpoint.wireguard.items.allowed_ip.caption" = "IP ammesso"; "endpoint.wireguard.items.allowed_ip.caption" = "IP ammesso";
"endpoint.advanced.title" = "Dettagli tecnici"; "endpoint.advanced.title" = "Dettagli tecnici";
"endpoint.advanced.openvpn.sections.pull.header" = "Ottieni dal server";
"endpoint.advanced.openvpn.sections.communication.header" = "Comunicazione"; "endpoint.advanced.openvpn.sections.communication.header" = "Comunicazione";
"endpoint.advanced.openvpn.sections.reset.footer" = "Se ti trovi con una connettività compromessa dopo aver cambiato i parametri di comunicazione, tocca per tornare alla configurazione originale."; "endpoint.advanced.openvpn.sections.reset.footer" = "Se ti trovi con una connettività compromessa dopo aver cambiato i parametri di comunicazione, tocca per tornare alla configurazione originale.";
"endpoint.advanced.openvpn.sections.compression.header" = "Compressione"; "endpoint.advanced.openvpn.sections.compression.header" = "Compressione";

View File

@ -203,6 +203,7 @@
"endpoint.wireguard.items.allowed_ip.caption" = "Toegestane IP"; "endpoint.wireguard.items.allowed_ip.caption" = "Toegestane IP";
"endpoint.advanced.title" = "Technische details"; "endpoint.advanced.title" = "Technische details";
"endpoint.advanced.openvpn.sections.pull.header" = "Pull van server";
"endpoint.advanced.openvpn.sections.communication.header" = "Communicatie"; "endpoint.advanced.openvpn.sections.communication.header" = "Communicatie";
"endpoint.advanced.openvpn.sections.reset.footer" = "Tik hier als de connectiviteit niet meer werkt na het aanpassen van instellingen, om terug te gaan naar de originele configuratie."; "endpoint.advanced.openvpn.sections.reset.footer" = "Tik hier als de connectiviteit niet meer werkt na het aanpassen van instellingen, om terug te gaan naar de originele configuratie.";
"endpoint.advanced.openvpn.sections.compression.header" = "Compressie"; "endpoint.advanced.openvpn.sections.compression.header" = "Compressie";

View File

@ -203,6 +203,7 @@
"endpoint.wireguard.items.allowed_ip.caption" = "IP z zezwoleniem"; "endpoint.wireguard.items.allowed_ip.caption" = "IP z zezwoleniem";
"endpoint.advanced.title" = "Dane techniczne"; "endpoint.advanced.title" = "Dane techniczne";
"endpoint.advanced.openvpn.sections.pull.header" = "Pobierz z serwera";
"endpoint.advanced.openvpn.sections.communication.header" = "Komunikacja"; "endpoint.advanced.openvpn.sections.communication.header" = "Komunikacja";
"endpoint.advanced.openvpn.sections.reset.footer" = "Jeśli masz problemy z połączeniem po zmianie konfiguracji komunikacji, kliknij żeby przywrócić domyślną konfigurację."; "endpoint.advanced.openvpn.sections.reset.footer" = "Jeśli masz problemy z połączeniem po zmianie konfiguracji komunikacji, kliknij żeby przywrócić domyślną konfigurację.";
"endpoint.advanced.openvpn.sections.compression.header" = "Kompresja"; "endpoint.advanced.openvpn.sections.compression.header" = "Kompresja";

View File

@ -203,6 +203,7 @@
"endpoint.wireguard.items.allowed_ip.caption" = "IP Permitido"; "endpoint.wireguard.items.allowed_ip.caption" = "IP Permitido";
"endpoint.advanced.title" = "Detalhes técnicos"; "endpoint.advanced.title" = "Detalhes técnicos";
"endpoint.advanced.openvpn.sections.pull.header" = "Puxar do servidor";
"endpoint.advanced.openvpn.sections.communication.header" = "Comunicação"; "endpoint.advanced.openvpn.sections.communication.header" = "Comunicação";
"endpoint.advanced.openvpn.sections.reset.footer" = "Se você foi desconectado após mudar parâmetros de comunicação, toque para restaurar a configuração original."; "endpoint.advanced.openvpn.sections.reset.footer" = "Se você foi desconectado após mudar parâmetros de comunicação, toque para restaurar a configuração original.";
"endpoint.advanced.openvpn.sections.compression.header" = "Compressão"; "endpoint.advanced.openvpn.sections.compression.header" = "Compressão";

View File

@ -203,6 +203,7 @@
"endpoint.wireguard.items.allowed_ip.caption" = "Допустимый IP"; "endpoint.wireguard.items.allowed_ip.caption" = "Допустимый IP";
"endpoint.advanced.title" = "Техническая информация"; "endpoint.advanced.title" = "Техническая информация";
"endpoint.advanced.openvpn.sections.pull.header" = "Вытащить с сервера";
"endpoint.advanced.openvpn.sections.communication.header" = "Связь"; "endpoint.advanced.openvpn.sections.communication.header" = "Связь";
"endpoint.advanced.openvpn.sections.reset.footer" = "Если после изменения параметров связи у Вас разорвалось соединение, нажмите, чтобы вернуться к исходной конфигурации."; "endpoint.advanced.openvpn.sections.reset.footer" = "Если после изменения параметров связи у Вас разорвалось соединение, нажмите, чтобы вернуться к исходной конфигурации.";
"endpoint.advanced.openvpn.sections.compression.header" = "Компресия"; "endpoint.advanced.openvpn.sections.compression.header" = "Компресия";

View File

@ -203,6 +203,7 @@
"endpoint.wireguard.items.allowed_ip.caption" = "Tillåtet IP"; "endpoint.wireguard.items.allowed_ip.caption" = "Tillåtet IP";
"endpoint.advanced.title" = "Tekniska detaljer"; "endpoint.advanced.title" = "Tekniska detaljer";
"endpoint.advanced.openvpn.sections.pull.header" = "Dra från servern";
"endpoint.advanced.openvpn.sections.communication.header" = "Communication"; "endpoint.advanced.openvpn.sections.communication.header" = "Communication";
"endpoint.advanced.openvpn.sections.reset.footer" = "Om du slutade med bruten anslutning efter att ha ändrat kommunikationsparametrarna trycker du på för att återgå till den ursprungliga konfigurationen."; "endpoint.advanced.openvpn.sections.reset.footer" = "Om du slutade med bruten anslutning efter att ha ändrat kommunikationsparametrarna trycker du på för att återgå till den ursprungliga konfigurationen.";
"endpoint.advanced.openvpn.sections.compression.header" = "Kompression"; "endpoint.advanced.openvpn.sections.compression.header" = "Kompression";

View File

@ -203,6 +203,7 @@
"endpoint.wireguard.items.allowed_ip.caption" = "允许的IP"; "endpoint.wireguard.items.allowed_ip.caption" = "允许的IP";
"endpoint.advanced.title" = "技术细节"; "endpoint.advanced.title" = "技术细节";
"endpoint.advanced.openvpn.sections.pull.header" = "从服务器拉取";
"endpoint.advanced.openvpn.sections.communication.header" = "通信"; "endpoint.advanced.openvpn.sections.communication.header" = "通信";
"endpoint.advanced.openvpn.sections.reset.footer" = "如果你在更改连接参数后变成断开状态,点按已恢复到原始的配置。"; "endpoint.advanced.openvpn.sections.reset.footer" = "如果你在更改连接参数后变成断开状态,点按已恢复到原始的配置。";
"endpoint.advanced.openvpn.sections.compression.header" = "压缩"; "endpoint.advanced.openvpn.sections.compression.header" = "压缩";