commit 84ddb74a791ab12d8835155e2b932dc3ee386105
parent 3afa8e002a3269ab6905c5fbc95ec4201913c73a
Author: FIGBERT <figbert@figbert.com>
Date: Fri, 30 Sep 2022 22:41:34 -0700
Add support for cert error statuses
Diffstat:
1 file changed, 38 insertions(+), 0 deletions(-)
diff --git a/Shared/CapsuleView.swift b/Shared/CapsuleView.swift
@@ -25,6 +25,8 @@ struct CapsuleView: View {
.ProxyError, .SlowDown, .PermanentFailure,
.NotFound, .Gone, .ProxyRequestRefused, .BadRequest:
FailureView()
+ case .ClientCertRequired, .ClientCertNotAuth, .ClientCertNotValid:
+ CertErrorView()
default:
Text(data.tab.response?.status.description ?? "boop")
}
@@ -176,6 +178,42 @@ struct FailureView: View {
}
}
+struct CertErrorView: View {
+ @EnvironmentObject var data: BrowserData
+ var body: some View {
+ VStack {
+ Text(data.tab.response?.status.description ?? "Certificate Error")
+ .font(.system(size: 35, weight: .bold))
+ switch data.tab.response?.status {
+ case .ClientCertRequired:
+ Text("This page requires a client certificate to access.")
+ .font(.system(size: 15))
+ .foregroundColor(.gray)
+ case .ClientCertNotAuth:
+ VStack {
+ Text("The client certificate in use is not authorised for this particular page.")
+ Text("The certificate itself is not the issue, and can be used for other purposes.")
+ }
+ .font(.system(size: 15))
+ .foregroundColor(.gray)
+ case .ClientCertNotValid:
+ Text("The client certificate in use was not accepted because it is invalid.")
+ .font(.system(size: 15))
+ .foregroundColor(.gray)
+ default:
+ Text("error")
+ .font(.system(size: 15))
+ .foregroundColor(.gray)
+ }
+ if case .CertInfo(let info) = data.tab.response?.header {
+ Text(info)
+ .font(.system(size: 15))
+ .foregroundColor(.gray)
+ }
+ }
+ }
+}
+
struct CapsuleView_Previews: PreviewProvider {
static var previews: some View {
CapsuleView()