move closing-tabs to local config, and add glgetstring to stack check

This commit is contained in:
rustdesk 2023-07-30 12:16:00 +08:00
parent 69f1969e60
commit dd4f52b63d
8 changed files with 35 additions and 20 deletions

View File

@ -1282,6 +1282,15 @@ bool mainGetBoolOptionSync(String key) {
return option2bool(key, bind.mainGetOptionSync(key: key));
}
mainSetLocalBoolOption(String key, bool value) async {
String v = bool2option(key, value);
await bind.mainSetLocalOption(key: key, value: v);
}
bool mainGetLocalBoolOptionSync(String key) {
return option2bool(key, bind.mainGetLocalOption(key: key));
}
Future<bool> matchPeer(String searchText, Peer peer) async {
if (searchText.isEmpty) {
return true;

View File

@ -314,19 +314,16 @@ class _GeneralState extends State<_General> {
Widget other() {
final children = [
_OptionCheckBox(context, 'Confirm before closing multiple tabs',
'enable-confirm-closing-tabs'),
'enable-confirm-closing-tabs',
isServer: false),
_OptionCheckBox(context, 'Adaptive Bitrate', 'enable-abr')
];
if (Platform.isLinux) {
children.add(Tooltip(
message: translate('software_render_tip'),
child: _OptionCheckBox(
context,
"Always use software rendering",
'allow-always-software-render',
),
));
}
// though this is related to GUI, but opengl problem affects all users, so put in config rather than local
children.add(Tooltip(
message: translate('software_render_tip'),
child: _OptionCheckBox(context, "Always use software rendering",
'allow-always-software-render'),
));
if (bind.mainShowOption(key: 'allow-linux-headless')) {
children.add(_OptionCheckBox(
context, 'Allow linux headless', 'allow-linux-headless'));
@ -1666,15 +1663,22 @@ Widget _OptionCheckBox(BuildContext context, String label, String key,
bool reverse = false,
bool enabled = true,
Icon? checkedIcon,
bool? fakeValue}) {
bool value = mainGetBoolOptionSync(key);
bool? fakeValue,
bool isServer = true}) {
bool value =
isServer ? mainGetBoolOptionSync(key) : mainGetLocalBoolOptionSync(key);
if (reverse) value = !value;
var ref = value.obs;
onChanged(option) async {
if (option != null) {
if (reverse) option = !option;
await mainSetBoolOption(key, option);
ref.value = mainGetBoolOptionSync(key);
isServer
? await mainSetBoolOption(key, option)
: await mainSetLocalBoolOption(key, option);
ref.value = isServer
? mainGetBoolOptionSync(key)
: mainGetLocalBoolOptionSync(key);
;
update?.call();
}
}

View File

@ -129,7 +129,7 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
} else {
final opt = "enable-confirm-closing-tabs";
final bool res;
if (!option2bool(opt, await bind.mainGetOption(key: opt))) {
if (!option2bool(opt, await bind.mainGetLocalOption(key: opt))) {
res = true;
} else {
res = await closeConfirmDialog();

View File

@ -360,7 +360,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
} else {
final opt = "enable-confirm-closing-tabs";
final bool res;
if (!option2bool(opt, await bind.mainGetOption(key: opt))) {
if (!option2bool(opt, await bind.mainGetLocalOption(key: opt))) {
res = true;
} else {
res = await closeConfirmDialog();

View File

@ -254,7 +254,7 @@ class ConnectionManagerState extends State<ConnectionManager> {
} else {
final opt = "enable-confirm-closing-tabs";
final bool res;
if (!option2bool(opt, await bind.mainGetOption(key: opt))) {
if (!option2bool(opt, await bind.mainGetLocalOption(key: opt))) {
res = true;
} else {
res = await closeConfirmDialog();

View File

@ -701,7 +701,7 @@ Future<bool> closeConfirmDialog() async {
submit() {
final opt = "enable-confirm-closing-tabs";
String value = bool2option(opt, confirm);
bind.mainSetOption(key: opt, value: value);
bind.mainSetLocalOption(key: opt, value: value);
close(true);
}

View File

@ -139,7 +139,8 @@ class AbModel {
"data": jsonEncode({"tags": tags, "peers": peersJsonData})
});
var request = http.Request('POST', Uri.parse(api));
if (licensedDevices > 0) {
// support compression
if (licensedDevices > 0 && body.length > 1024) {
authHeaders['Content-Encoding'] = "gzip";
request.bodyBytes = GZipCodec().encode(utf8.encode(body));
} else {

View File

@ -31,6 +31,7 @@ extern "C" fn breakdown_signal_handler(sig: i32) {
s.contains(&"nouveau_pushbuf_kick")
|| s.to_lowercase().contains("nvidia")
|| s.contains("gdk_window_end_draw_frame")
|| s.contains("glGetString")
}) {
Config::set_option("allow-always-software-render".to_string(), "Y".to_string());
info = "Always use software rendering will be set.".to_string();