Skip to content

Commit

Permalink
Merge branch 'rustdesk:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangbo8418 authored Jan 22, 2024
2 parents 9209b78 + b1a946e commit 54cfeb9
Show file tree
Hide file tree
Showing 45 changed files with 35 additions and 57 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Go through [DEVCONTAINER.md](docs/DEVCONTAINER.md) for more info.

## Dependencies

Desktop versions use Flutter or Sciter (deprecated) for GUI, this tutorial is for Sciter only, since it is easier and more friendly to starter. Check out our [CI](https://github.com/rustdesk/rustdesk/blob/master/.github/workflows/flutter-build.yml) for building Flutter version.
Desktop versions use Flutter or Sciter (deprecated) for GUI, this tutorial is for Sciter only, since it is easier and more friendly to start. Check out our [CI](https://github.com/rustdesk/rustdesk/blob/master/.github/workflows/flutter-build.yml) for building Flutter version.

Please download Sciter dynamic library yourself.

Expand Down
10 changes: 8 additions & 2 deletions flutter/lib/common/hbbs/hbbs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class LoginRequest {
String? type;
String? verificationCode;
String? tfaCode;
String? secret;

LoginRequest(
{this.username,
Expand All @@ -130,7 +131,8 @@ class LoginRequest {
this.autoLogin,
this.type,
this.verificationCode,
this.tfaCode});
this.tfaCode,
this.secret});

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
Expand All @@ -144,6 +146,7 @@ class LoginRequest {
data['verificationCode'] = verificationCode;
}
if (tfaCode != null) data['tfaCode'] = tfaCode;
if (secret != null) data['secret'] = secret;

Map<String, dynamic> deviceInfo = {};
try {
Expand All @@ -160,14 +163,17 @@ class LoginResponse {
String? access_token;
String? type;
String? tfa_type;
String? secret;
UserPayload? user;

LoginResponse({this.access_token, this.type, this.tfa_type, this.user});
LoginResponse(
{this.access_token, this.type, this.tfa_type, this.secret, this.user});

LoginResponse.fromJson(Map<String, dynamic> json) {
access_token = json['access_token'];
type = json['type'];
tfa_type = json['tfa_type'];
secret = json['secret'];
user = json['user'] != null ? UserPayload.fromJson(json['user']) : null;
}
}
Expand Down
8 changes: 3 additions & 5 deletions flutter/lib/common/widgets/dialog.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:async';
import 'dart:io';
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand Down Expand Up @@ -429,7 +428,6 @@ class Dialog2FaField extends ValidationField {
this.autoFocus = true,
this.reRequestFocus = false,
this.title,
this.helperText,
this.hintText,
this.errorText,
this.readyCallback,
Expand All @@ -440,7 +438,6 @@ class Dialog2FaField extends ValidationField {
final bool autoFocus;
final bool reRequestFocus;
final String? title;
final String? helperText;
final String? hintText;
final String? errorText;
final VoidCallback? readyCallback;
Expand All @@ -457,7 +454,6 @@ class Dialog2FaField extends ValidationField {
reRequestFocus: reRequestFocus,
hintText: hintText,
readyCallback: readyCallback,
helperText: helperText ?? translate('2fa_tip'),
onChanged: _onChanged,
keyboardType: TextInputType.number,
inputFormatters: [
Expand Down Expand Up @@ -1860,6 +1856,8 @@ void enter2FaDialog(
'OK',
onPressed: submitReady.isTrue ? submit : null,
)),
]);
],
onSubmit: submit,
onCancel: cancel);
});
}
13 changes: 7 additions & 6 deletions flutter/lib/common/widgets/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,7 @@ class LoginWidgetUserPass extends StatelessWidget {

const kAuthReqTypeOidc = 'oidc/';

/// common login dialog for desktop
/// call this directly
// call this directly
Future<bool?> loginDialog() async {
var username =
TextEditingController(text: UserModel.getLocalUserInfo()?['name'] ?? '');
Expand Down Expand Up @@ -457,11 +456,12 @@ Future<bool?> loginDialog() async {
if (isEmailVerification != null) {
if (isMobile) {
if (close != null) close(false);
verificationCodeDialog(resp.user, isEmailVerification);
verificationCodeDialog(
resp.user, resp.secret, isEmailVerification);
} else {
setState(() => isInProgress = false);
final res =
await verificationCodeDialog(resp.user, isEmailVerification);
final res = await verificationCodeDialog(
resp.user, resp.secret, isEmailVerification);
if (res == true) {
if (close != null) close(false);
return;
Expand Down Expand Up @@ -611,7 +611,7 @@ Future<bool?> loginDialog() async {
}

Future<bool?> verificationCodeDialog(
UserPayload? user, bool isEmailVerification) async {
UserPayload? user, String? secret, bool isEmailVerification) async {
var autoLogin = true;
var isInProgress = false;
String? errorText;
Expand All @@ -626,6 +626,7 @@ Future<bool?> verificationCodeDialog(
final resp = await gFFI.userModel.login(LoginRequest(
verificationCode: code.text,
tfaCode: isEmailVerification ? null : code.text,
secret: secret,
username: user?.name,
id: await bind.mainGetMyId(),
uuid: await bind.mainGetUuid(),
Expand Down
2 changes: 2 additions & 0 deletions src/hbbs_http/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ pub struct AuthBody {
pub r#type: String,
#[serde(default)]
pub tfa_type: String,
#[serde(default)]
pub secret: String,
pub user: UserPayload,
}

Expand Down
1 change: 0 additions & 1 deletion src/lang/ar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", ""),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/ca.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", ""),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/cn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", "交换Control键和Command键"),
("swap-left-right-mouse", "交换鼠标左右键"),
("2FA code", "双重认证代码"),
("2fa_tip", "请输入授权 app 中的双重认证代码"),
("More", "更多"),
("enable-2fa-title", "启用双重认证"),
("enable-2fa-desc", "现在请设置身份验证器。您可以在手机或台式电脑上使用 Authy、Microsoft 或 Google Authenticator 等验证器。用验证器扫描二维码,然后输入显示的验证码以启用双重认证。"),
Expand Down
1 change: 0 additions & 1 deletion src/lang/cs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", "Prohození klávesy control-command"),
("swap-left-right-mouse", "Prohodit levé a pravé tlačítko myši"),
("2FA code", "2FA kód"),
("2fa_tip", "Zadejte svůj kód 2FA do ověřovací aplikace."),
("More", "Více"),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/da.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", ""),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", "Steuerungs- und Befehlstasten tauschen"),
("swap-left-right-mouse", "Linke und rechte Maustaste tauschen"),
("2FA code", "2FA-Code"),
("2fa_tip", "Bitte geben Sie Ihren 2FA-Code in der Authentifizierungs-App ein."),
("More", "Mehr"),
("enable-2fa-title", "Zwei-Faktor-Authentifizierung aktivieren"),
("enable-2fa-desc", "Bitte richten Sie jetzt Ihren Authentifikator ein. Sie können eine Authentifizierungs-App wie Authy, Microsoft oder Google Authenticator auf Ihrem Telefon oder Desktop verwenden.\n\nScannen Sie den QR-Code mit Ihrer App und geben Sie den Code ein, den Ihre App anzeigt, um die Zwei-Faktor-Authentifizierung zu aktivieren."),
Expand Down
1 change: 0 additions & 1 deletion src/lang/el.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", "Εναλλαγή κουμπιών control-command"),
("swap-left-right-mouse", "Εναλλαγή αριστερό-δεξί κουμπί του ποντικιού"),
("2FA code", "κωδικός 2FA"),
("2fa_tip", "Παρακαλώ εισάγεται τον κωδικό 2FA στην εφαρμογή πιστοποίησης"),
("More", "Περισσότερα"),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/en.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("capture_display_elevated_connections_tip", "Capturing multiple displays is not supported in the elevated user mode. Please try again after installation if you want to control multiple displays."),
("swap-left-right-mouse", "Swap left-right mouse button"),
("2FA code", "2FA code"),
("2fa_tip", "Please enter your 2FA code in the authentication app."),
("enable-2fa-title", "Enable two-factor authentication"),
("enable-2fa-desc", "Please set up your authenticator now. You can use an authenticator app such as Authy, Microsoft or Google Authenticator on your phone or desktop.\n\nScan the QR code with your app and enter the code that your app shows to enable two-factor authentication."),
("wrong-2fa-code", "Can't verify the code. Check that code and local time settings are correct"),
Expand Down
1 change: 0 additions & 1 deletion src/lang/eo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", ""),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/es.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", "Intercambiar teclas control-comando"),
("swap-left-right-mouse", "Intercambiar botones derecho-izquierdo del ratón"),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/et.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", "Vaheta vasak ja parem hiirenupp"),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/fa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", "گرفتن چندین نمایشگر در حالت کاربر زیاد پشتیبانی نمی شود. اگر می‌خواهید چند نمایشگر را کنترل کنید، لطفاً پس از نصب دوباره امتحان کنید."),
("swap-left-right-mouse", "دکمه چپ و راست ماوس را عوض کنید"),
("2FA code", "کد ورود 2 مرحله ای"),
("2fa_tip", "لطفا کد ورود 2 مرحله ای خود را در برنامه احراز هویت وارد کنید"),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/fr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", "Échanger la touche de controle-commande"),
("swap-left-right-mouse", "Intervertir le bouton gauche et droit de la souris"),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/hu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", ""),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", ""),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/it.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", "Scambia tasto controllo-comando"),
("swap-left-right-mouse", "Scambia pulsante sinistro-destro mouse"),
("2FA code", "Codice 2FA"),
("2fa_tip", "Inserisci il codice 2FA nell'app di autenticazione."),
("More", "Altro"),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/ja.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", ""),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/ko.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", ""),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/kz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", ""),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/lt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", ""),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/lv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", "Apmainīt vadības un komandas taustiņu"),
("swap-left-right-mouse", "Apmainīt kreiso un labo peles pogu"),
("2FA code", "2FA kods"),
("2fa_tip", "Lūdzu, ievadiet savu 2FA kodu autentifikācijas lietotnē."),
("More", "Vairāk"),
("enable-2fa-title", "Iespējot divu faktoru autentifikāciju"),
("enable-2fa-desc", "Lūdzu, iestatiet savu autentifikatoru tūlīt. Tālrunī vai darbvirsmā varat izmantot autentifikācijas lietotni, piemēram, Authy, Microsoft vai Google Authenticator.\n\nIzmantojot lietotni, skenējiet QR kodu un ievadiet lietotnē parādīto kodu, lai iespējotu divu faktoru autentifikāciju."),
Expand Down
1 change: 0 additions & 1 deletion src/lang/nb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", ""),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/nl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", "Wissel controle-commando toets"),
("swap-left-right-mouse", "wissel-links-rechts-muis"),
("2FA code", "2FA-code"),
("2fa_tip", "Geef je 2FA-code op in de verificatie-app."),
("More", "Meer"),
("enable-2fa-title", "activeer-2fa-titel"),
("enable-2fa-desc", "activeer-2fa-desc"),
Expand Down
1 change: 0 additions & 1 deletion src/lang/pl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", "Zamiana przycisków sterujących myszki"),
("swap-left-right-mouse", "Zamień przyciski myszki (lewy - prawy)"),
("2FA code", "Kod 2FA"),
("2fa_tip", "Proszę wprowadzić swój kod 2FA w aplikacji do autoryzacji."),
("More", "Więcej"),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/pt_PT.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", ""),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/ptbr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", ""),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/ro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", ""),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/ru.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", "Поменять кнопки управления и команд"),
("swap-left-right-mouse", "Поменять левую и правую кнопки мыши"),
("2FA code", "Код 2FA"),
("2fa_tip", "Введите код двухфакторной аутентификации из приложения для аутентификации."),
("More", "Ещё"),
("enable-2fa-title", "Использовать двухфакторную аутентификацию"),
("enable-2fa-desc", "Настройте приложение аутентификации. Используйте, например, Authy, Microsoft или Google Authenticator, на телефоне или компьютере.\n\nОтсканируйте QR-код с помощью приложения аутентификации и введите код, который отобразит это приложение, чтобы включить двухфакторную аутентификацию."),
Expand Down
1 change: 0 additions & 1 deletion src/lang/sk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", "Vymeniť kláves ovládania a príkazu"),
("swap-left-right-mouse", "Prehodiť ľavé a pravé tlačidlo myši"),
("2FA code", "2FA kód"),
("2fa_tip", "Zadajte svoj kód 2FA do aplikácie na overovanie."),
("More", "Viac"),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/sl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", ""),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
1 change: 0 additions & 1 deletion src/lang/sq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Swap control-command key", ""),
("swap-left-right-mouse", ""),
("2FA code", ""),
("2fa_tip", ""),
("More", ""),
("enable-2fa-title", ""),
("enable-2fa-desc", ""),
Expand Down
Loading

0 comments on commit 54cfeb9

Please sign in to comment.