mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Don't let old server lookups overwrite new ones
This commit is contained in:
parent
d70a344a4d
commit
aed1440d26
2 changed files with 12 additions and 2 deletions
|
@ -108,7 +108,13 @@ LoginPage::onMatrixIdEntered()
|
|||
emit homeserverChanged();
|
||||
|
||||
http::client()->well_known(
|
||||
[this](const mtx::responses::WellKnown &res, mtx::http::RequestErr err) {
|
||||
[this, orginal_hostname = user.hostname()](const mtx::responses::WellKnown &res,
|
||||
mtx::http::RequestErr err) {
|
||||
// Ignore if server changed
|
||||
auto currentUser = parse<User>(mxid_.toStdString());
|
||||
if (currentUser.hostname() != orginal_hostname)
|
||||
return;
|
||||
|
||||
if (err) {
|
||||
if (err->status_code == 404) {
|
||||
nhlog::net()->info("Autodiscovery: No .well-known.");
|
||||
|
|
|
@ -67,7 +67,11 @@ RegisterPage::setServer(const QString &server)
|
|||
emit lookingUpHsChanged();
|
||||
|
||||
http::client()->well_known(
|
||||
[this](const mtx::responses::WellKnown &res, mtx::http::RequestErr err) {
|
||||
[this, prevServer = server](const mtx::responses::WellKnown &res, mtx::http::RequestErr err) {
|
||||
// server changed in between
|
||||
if (lastServer != prevServer)
|
||||
return;
|
||||
|
||||
if (err) {
|
||||
if (err->status_code == 404) {
|
||||
nhlog::net()->info("Autodiscovery: No .well-known.");
|
||||
|
|
Loading…
Reference in a new issue