Fix login fail on browser

This commit is contained in:
Inex Code 2020-10-14 23:07:36 +03:00
parent c1791edd4d
commit c175674cd8
1 changed files with 16 additions and 10 deletions

View File

@ -225,11 +225,14 @@ class Client extends MatrixApi {
var wellKnown = WellKnownInformations.fromJson(json.decode(response.body));
if (Uri.parse(wellKnown.mHomeserver.baseUrl).host !=
MatrixIdOrDomain.domain) {
final response = await http.get(
'https://${Uri.parse(wellKnown.mHomeserver.baseUrl).host}/.well-known/matrix/client');
if (response.statusCode == 200) {
wellKnown = WellKnownInformations.fromJson(json.decode(response.body));
}
try {
final response = await http.get(
'https://${Uri.parse(wellKnown.mHomeserver.baseUrl).host}/.well-known/matrix/client');
if (response.statusCode == 200) {
wellKnown =
WellKnownInformations.fromJson(json.decode(response.body));
}
} catch (_) {}
}
return wellKnown;
}
@ -241,11 +244,14 @@ class Client extends MatrixApi {
await http.get('https://${homeserver.host}/.well-known/matrix/client');
var wellKnown = WellKnownInformations.fromJson(json.decode(response.body));
if (Uri.parse(wellKnown.mHomeserver.baseUrl).host != homeserver.host) {
final response = await http.get(
'https://${Uri.parse(wellKnown.mHomeserver.baseUrl).host}/.well-known/matrix/client');
if (response.statusCode == 200) {
wellKnown = WellKnownInformations.fromJson(json.decode(response.body));
}
try {
final response = await http.get(
'https://${Uri.parse(wellKnown.mHomeserver.baseUrl).host}/.well-known/matrix/client');
if (response.statusCode == 200) {
wellKnown =
WellKnownInformations.fromJson(json.decode(response.body));
}
} catch (_) {}
}
return wellKnown;
}