From ac1d6782547223bbd58137cc84ea331477f2438d Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Mon, 7 Mar 2022 05:26:12 +0100 Subject: [PATCH] Fix server switching to https after bootstrap fixes #878 --- CMakeLists.txt | 2 +- io.github.NhekoReborn.Nheko.yaml | 2 +- resources/qml/Root.qml | 3 ++- src/LoginPage.cpp | 6 ++++-- src/MainWindow.cpp | 3 +-- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d350e71a..81d13be5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -405,7 +405,7 @@ if(USE_BUNDLED_MTXCLIENT) FetchContent_Declare( MatrixClient GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git - GIT_TAG e1b75074b501d2d3e0100d1170b3edef8a00799c + GIT_TAG a3fec0ae53762a8a482cde50c9709671bcf0548d ) set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "") set(BUILD_LIB_TESTS OFF CACHE INTERNAL "") diff --git a/io.github.NhekoReborn.Nheko.yaml b/io.github.NhekoReborn.Nheko.yaml index 31248a28..84743987 100644 --- a/io.github.NhekoReborn.Nheko.yaml +++ b/io.github.NhekoReborn.Nheko.yaml @@ -189,7 +189,7 @@ modules: buildsystem: cmake-ninja name: mtxclient sources: - - commit: e1b75074b501d2d3e0100d1170b3edef8a00799c + - commit: a3fec0ae53762a8a482cde50c9709671bcf0548d #tag: v0.6.2 type: git url: https://github.com/Nheko-Reborn/mtxclient.git diff --git a/resources/qml/Root.qml b/resources/qml/Root.qml index 14e6770b..c8c05a3e 100644 --- a/resources/qml/Root.qml +++ b/resources/qml/Root.qml @@ -222,7 +222,8 @@ Pane { } function destroyOnClose(obj) { - obj.closing.connect(() => obj.destroy()); + if (obj.closing != undefined) obj.closing.connect(() => obj.destroy()); + else if (obj.closed != undefined) obj.closed.connect(() => obj.destroy()); } function destroyOnClosed(obj) { diff --git a/src/LoginPage.cpp b/src/LoginPage.cpp index cdc2262f..6a83376c 100644 --- a/src/LoginPage.cpp +++ b/src/LoginPage.cpp @@ -163,6 +163,8 @@ LoginPage::checkHomeserverVersion() return; } + nhlog::net()->error("Error requesting versions: {}", *err); + emit versionErrorCb( tr("An unknown error occured. Make sure the homeserver domain is valid.")); return; @@ -276,7 +278,7 @@ LoginPage::onLoginButtonClicked(LoginMethod loginMethod, if (res.well_known) { http::client()->set_server(res.well_known->homeserver.base_url); - nhlog::net()->info("Login requested to user server: " + + nhlog::net()->info("Login requested to use server: " + res.well_known->homeserver.base_url); } @@ -301,7 +303,7 @@ LoginPage::onLoginButtonClicked(LoginMethod loginMethod, if (res.well_known) { http::client()->set_server(res.well_known->homeserver.base_url); - nhlog::net()->info("Login requested to user server: " + + nhlog::net()->info("Login requested to use server: " + res.well_known->homeserver.base_url); } diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index f3893998..73e556f7 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -338,8 +338,7 @@ MainWindow::showChatPage() { auto userid = QString::fromStdString(http::client()->user_id().to_string()); auto device_id = QString::fromStdString(http::client()->device_id()); - auto homeserver = QString::fromStdString(http::client()->server() + ":" + - std::to_string(http::client()->port())); + auto homeserver = QString::fromStdString(http::client()->server_url()); auto token = QString::fromStdString(http::client()->access_token()); userSettings_.data()->setUserId(userid);