mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-06-11 12:43:12 +08:00
add ab full check
This commit is contained in:
parent
4fe85cdd4a
commit
791645fa59
@ -241,6 +241,9 @@ class _AddressBookState extends State<AddressBook> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void abAddId() async {
|
void abAddId() async {
|
||||||
|
if (gFFI.abModel.isFull(true)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var isInProgress = false;
|
var isInProgress = false;
|
||||||
IDTextEditingController idController = IDTextEditingController(text: '');
|
IDTextEditingController idController = IDTextEditingController(text: '');
|
||||||
TextEditingController aliasController = TextEditingController(text: '');
|
TextEditingController aliasController = TextEditingController(text: '');
|
||||||
|
@ -644,6 +644,9 @@ abstract class BasePeerCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
proc: () {
|
proc: () {
|
||||||
() async {
|
() async {
|
||||||
|
if (gFFI.abModel.isFull(true)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!gFFI.abModel.idContainBy(peer.id)) {
|
if (!gFFI.abModel.idContainBy(peer.id)) {
|
||||||
gFFI.abModel.addPeer(peer);
|
gFFI.abModel.addPeer(peer);
|
||||||
await gFFI.abModel.pushAb();
|
await gFFI.abModel.pushAb();
|
||||||
|
@ -29,6 +29,7 @@ class AbModel {
|
|||||||
|
|
||||||
final selectedTags = List<String>.empty(growable: true).obs;
|
final selectedTags = List<String>.empty(growable: true).obs;
|
||||||
var initialized = false;
|
var initialized = false;
|
||||||
|
var licensedDevices = 0;
|
||||||
|
|
||||||
WeakReference<FFI> parent;
|
WeakReference<FFI> parent;
|
||||||
|
|
||||||
@ -52,6 +53,10 @@ class AbModel {
|
|||||||
if (json.containsKey('error')) {
|
if (json.containsKey('error')) {
|
||||||
abError.value = json['error'];
|
abError.value = json['error'];
|
||||||
} else if (json.containsKey('data')) {
|
} else if (json.containsKey('data')) {
|
||||||
|
try {
|
||||||
|
gFFI.abModel.licensedDevices = json['licensed_devices'];
|
||||||
|
// ignore: empty_catches
|
||||||
|
} catch (e) {}
|
||||||
final data = jsonDecode(json['data']);
|
final data = jsonDecode(json['data']);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
tags.clear();
|
tags.clear();
|
||||||
@ -94,6 +99,15 @@ class AbModel {
|
|||||||
peers.add(peer);
|
peers.add(peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isFull(bool warn) {
|
||||||
|
final res = licensedDevices > 0 && peers.length >= licensedDevices;
|
||||||
|
if (res && warn) {
|
||||||
|
BotToast.showText(
|
||||||
|
contentColor: Colors.red, text: translate("exceed_max_devices"));
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
void addPeer(Peer peer) {
|
void addPeer(Peer peer) {
|
||||||
peers.removeWhere((e) => e.id == peer.id);
|
peers.removeWhere((e) => e.id == peer.id);
|
||||||
peers.add(peer);
|
peers.add(peer);
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("resolution_custom_tip", "Custom resolution"),
|
("resolution_custom_tip", "Custom resolution"),
|
||||||
("accept_and_elevate_btn_tooltip", "Accept the connection and elevate UAC permissions."),
|
("accept_and_elevate_btn_tooltip", "Accept the connection and elevate UAC permissions."),
|
||||||
("clipboard_wait_response_timeout_tip", "Timed out waiting for copy response."),
|
("clipboard_wait_response_timeout_tip", "Timed out waiting for copy response."),
|
||||||
("logout_tip", "Are you sure you want to log out?")
|
("logout_tip", "Are you sure you want to log out?"),
|
||||||
|
("exceed_max_devices", "You have reached the maximum number of managed devices."),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", "Servizio"),
|
("Service", "Servizio"),
|
||||||
("Start", "Avvia"),
|
("Start", "Avvia"),
|
||||||
("Stop", "Ferma"),
|
("Stop", "Ferma"),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", "Сервис"),
|
("Service", "Сервис"),
|
||||||
("Start", "Запустить"),
|
("Start", "Запустить"),
|
||||||
("Stop", "Остановить"),
|
("Stop", "Остановить"),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
@ -521,5 +521,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
|
|||||||
("Service", ""),
|
("Service", ""),
|
||||||
("Start", ""),
|
("Start", ""),
|
||||||
("Stop", ""),
|
("Stop", ""),
|
||||||
|
("exceed_max_devices", ""),
|
||||||
|
("Sync with recent sessions", ""),
|
||||||
|
("Sort tags", ""),
|
||||||
].iter().cloned().collect();
|
].iter().cloned().collect();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user