mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Small Fixes
This commit is contained in:
parent
19cfd08a55
commit
0d1dd29b19
5 changed files with 27 additions and 9 deletions
|
@ -579,7 +579,6 @@ ApplicationWindow {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
dialog.close();
|
dialog.close();
|
||||||
deviceVerificationList.remove(flow.tranId);
|
deviceVerificationList.remove(flow.tranId);
|
||||||
delete flow;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,6 @@
|
||||||
|
|
||||||
#include "blurhash.hpp"
|
#include "blurhash.hpp"
|
||||||
|
|
||||||
#include <iostream> // only for debugging
|
|
||||||
|
|
||||||
// TODO: Needs to be updated with an actual secret.
|
// TODO: Needs to be updated with an actual secret.
|
||||||
static const std::string STORAGE_SECRET_KEY("secret");
|
static const std::string STORAGE_SECRET_KEY("secret");
|
||||||
|
|
||||||
|
@ -1471,7 +1469,6 @@ ChatPage::query_keys(
|
||||||
static_cast<int>(err->status_code));
|
static_cast<int>(err->status_code));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::cout << "Over here " << user_id << std::endl;
|
|
||||||
cache::setUserCache(std::move(user_id),
|
cache::setUserCache(std::move(user_id),
|
||||||
std::move(UserCache{res, true}));
|
std::move(UserCache{res, true}));
|
||||||
cb(res, err);
|
cb(res, err);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
static constexpr int TIMEOUT = 2 * 60 * 1000; // 2 minutes
|
static constexpr int TIMEOUT = 2 * 60 * 1000; // 2 minutes
|
||||||
|
|
||||||
|
@ -75,7 +76,14 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *,
|
||||||
DeviceVerificationFlow::Error::UnknownMethod);
|
DeviceVerificationFlow::Error::UnknownMethod);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this->canonical_json = nlohmann::json(msg);
|
if (!sender)
|
||||||
|
this->canonical_json = nlohmann::json(msg);
|
||||||
|
else {
|
||||||
|
if (utils::localUser().toStdString() <
|
||||||
|
this->toClient.to_string()) {
|
||||||
|
this->canonical_json = nlohmann::json(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
this->acceptVerificationRequest();
|
this->acceptVerificationRequest();
|
||||||
} else {
|
} else {
|
||||||
this->cancelVerification(DeviceVerificationFlow::Error::UnknownMethod);
|
this->cancelVerification(DeviceVerificationFlow::Error::UnknownMethod);
|
||||||
|
@ -124,6 +132,7 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *,
|
||||||
if (msg.relates_to.value().event_id != this->relation.event_id)
|
if (msg.relates_to.value().event_id != this->relation.event_id)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this->deleteLater();
|
||||||
emit verificationCanceled();
|
emit verificationCanceled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -226,6 +235,11 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *,
|
||||||
&ChatPage::recievedDeviceVerificationReady,
|
&ChatPage::recievedDeviceVerificationReady,
|
||||||
this,
|
this,
|
||||||
[this](const mtx::events::msg::KeyVerificationReady &msg) {
|
[this](const mtx::events::msg::KeyVerificationReady &msg) {
|
||||||
|
if (!sender) {
|
||||||
|
this->deleteLater();
|
||||||
|
emit verificationCanceled();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (msg.transaction_id.has_value()) {
|
if (msg.transaction_id.has_value()) {
|
||||||
if (msg.transaction_id.value() != this->transaction_id)
|
if (msg.transaction_id.value() != this->transaction_id)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -298,6 +298,13 @@ EventStore::handleSync(const mtx::responses::Timeline &events)
|
||||||
msg->content, msg->sender);
|
msg->content, msg->sender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// only the key.verification.ready sent by localuser's other device is of
|
||||||
|
// significance as it is used for detecting accepted request
|
||||||
|
if (auto msg = std::get_if<
|
||||||
|
mtx::events::RoomEvent<mtx::events::msg::KeyVerificationReady>>(
|
||||||
|
event)) {
|
||||||
|
ChatPage::instance()->recievedDeviceVerificationReady(msg->content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,16 +161,17 @@ UserProfile::fetchDeviceList(const QString &userID)
|
||||||
for (auto sign_key : luk.value().keys) {
|
for (auto sign_key : luk.value().keys) {
|
||||||
// checking if the signatures are empty as "at" could
|
// checking if the signatures are empty as "at" could
|
||||||
// cause exceptions
|
// cause exceptions
|
||||||
if (!mk.value().signatures.empty()) {
|
auto signs = mk->signatures;
|
||||||
auto signs =
|
if (!signs.empty() &&
|
||||||
mk.value().signatures.at(local_user_id);
|
signs.find(local_user_id) != signs.end()) {
|
||||||
|
auto sign = signs.at(local_user_id);
|
||||||
try {
|
try {
|
||||||
isUserVerified =
|
isUserVerified =
|
||||||
isUserVerified ||
|
isUserVerified ||
|
||||||
(olm::client()->ed25519_verify_sig(
|
(olm::client()->ed25519_verify_sig(
|
||||||
sign_key.second,
|
sign_key.second,
|
||||||
json(mk.value()),
|
json(mk.value()),
|
||||||
signs.at(sign_key.first)));
|
sign.at(sign_key.first)));
|
||||||
} catch (std::out_of_range) {
|
} catch (std::out_of_range) {
|
||||||
isUserVerified =
|
isUserVerified =
|
||||||
isUserVerified || false;
|
isUserVerified || false;
|
||||||
|
|
Loading…
Reference in a new issue