Add notification for OTP pair
This commit is contained in:
@@ -613,6 +613,11 @@ namespace nvhttp {
|
||||
auto hash = util::hex(crypto::hash(one_time_pin + ptr->second.async_insert_pin.salt + otp_passphrase), true);
|
||||
|
||||
if (hash.to_string_view() == it->second) {
|
||||
|
||||
#if defined SUNSHINE_TRAY && SUNSHINE_TRAY >= 1
|
||||
system_tray::update_tray_otp_pair(ptr->second.client.name);
|
||||
#endif
|
||||
|
||||
if (!otp_device_name.empty()) {
|
||||
ptr->second.client.name = std::move(otp_device_name);
|
||||
}
|
||||
|
||||
@@ -381,5 +381,30 @@ namespace system_tray {
|
||||
tray_update(&tray);
|
||||
}
|
||||
|
||||
void
|
||||
update_tray_otp_pair(std::string device_name) {
|
||||
if (!tray_initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
tray.notification_title = NULL;
|
||||
tray.notification_text = NULL;
|
||||
tray.notification_cb = NULL;
|
||||
tray.notification_icon = NULL;
|
||||
tray.icon = TRAY_ICON;
|
||||
tray_update(&tray);
|
||||
char msg[256];
|
||||
snprintf(msg, std::size(msg), "OTP Pairing started for device \"%s\". Please make sure you have access to the device initiating the pairing request.", device_name.c_str());
|
||||
#ifdef _WIN32
|
||||
strcpy(msg, convertUtf8ToCurrentCodepage(msg).c_str());
|
||||
#endif
|
||||
tray.icon = TRAY_ICON;
|
||||
tray.notification_title = "Incoming OTP Pairing Request";
|
||||
tray.notification_text = msg;
|
||||
tray.notification_icon = TRAY_ICON_LOCKED;
|
||||
tray.tooltip = PROJECT_NAME;
|
||||
tray_update(&tray);
|
||||
}
|
||||
|
||||
} // namespace system_tray
|
||||
#endif
|
||||
|
||||
@@ -84,4 +84,7 @@ namespace system_tray {
|
||||
*/
|
||||
void
|
||||
update_tray_require_pin();
|
||||
|
||||
void
|
||||
update_tray_otp_pair(std::string device_name);
|
||||
} // namespace system_tray
|
||||
|
||||
Reference in New Issue
Block a user