Rewrite server URL string if logging into Write.as

This commit is contained in:
Angelo Stavrow 2021-02-01 15:45:33 -05:00
parent 461f9cca40
commit c00b71cd43
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE

View File

@ -58,6 +58,13 @@ struct AccountLoginView: View {
#if os(iOS)
hideKeyboard()
#endif
// If logging in to Write.as, trim any path in the hostname.
if server.hasPrefix("https://write.as") ||
server.hasPrefix("http://write.as") ||
server.hasPrefix("write.as") {
server = "https://write.as"
}
// Trim any trailing slashes that would cause the request to fail.
if server.hasSuffix("/") {
server = String(server.dropLast(1))
}