mirror of
https://github.com/ProtonMail/protoncore_ios.git
synced 2026-01-16 23:00:24 +00:00
feat: Allow using custom domain with http:// instead of https://
Refs: https://gitlab.protontech.ch/apple/shared/protoncore/-/merge_requests/1874
This commit is contained in:
commit
f08d320ccf
1 changed files with 19 additions and 2 deletions
|
|
@ -34,6 +34,7 @@ public enum Environment {
|
|||
case blackPayment
|
||||
|
||||
case custom(String)
|
||||
case customHttp(String)
|
||||
|
||||
static let productionMail = ProductionMail()
|
||||
static let productionVPN = ProductionVPN()
|
||||
|
|
@ -88,7 +89,7 @@ extension Environment {
|
|||
Environment.blackServer.status = status
|
||||
case .blackPayment:
|
||||
Environment.blackPaymentsServer.status = status
|
||||
case .custom:
|
||||
case .custom, .customHttp:
|
||||
assertionFailure("Cannot set doH status of custom black environment via this method")
|
||||
}
|
||||
}
|
||||
|
|
@ -113,6 +114,8 @@ extension Environment {
|
|||
return Environment.blackPaymentsServer
|
||||
case .custom(let customDomain):
|
||||
return Environment.buildCustomDoh(customDomain: customDomain)
|
||||
case .customHttp(let customDomain):
|
||||
return Environment.buildCustomHttpDoh(customDomain: customDomain)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +133,7 @@ extension Environment {
|
|||
return Environment.productionPass
|
||||
case .walletProd:
|
||||
return Environment.productionWallet
|
||||
case .black, .blackPayment, .custom:
|
||||
case .black, .blackPayment, .custom, .customHttp:
|
||||
fatalError("Invalid index")
|
||||
}
|
||||
}
|
||||
|
|
@ -148,6 +151,20 @@ extension Environment {
|
|||
apnEnvironment: .development
|
||||
)
|
||||
}
|
||||
|
||||
static func buildCustomHttpDoh(customDomain: String) -> CustomServerConfigDoH {
|
||||
return CustomServerConfigDoH.build(
|
||||
signupDomain: customDomain,
|
||||
captchaHost: "http://api.\(customDomain)",
|
||||
humanVerificationV3Host: "http://verify.\(customDomain)",
|
||||
accountHost: "http://account.\(customDomain)",
|
||||
defaultHost: "http://\(customDomain)",
|
||||
apiHost: ProductionHosts.mailAPI.dohHost,
|
||||
defaultPath: "/api",
|
||||
proxyToken: nil,
|
||||
apnEnvironment: .development
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
extension Environment {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue