remove useless stop-rendezvous-service

This commit is contained in:
rustdesk 2024-06-10 16:12:08 +08:00
parent 9ab5512bfa
commit dd90096e13
2 changed files with 6 additions and 9 deletions

View File

@ -1430,9 +1430,8 @@ bool option2bool(String option, String value) {
if (option.startsWith("enable-")) { if (option.startsWith("enable-")) {
res = value != "N"; res = value != "N";
} else if (option.startsWith("allow-") || } else if (option.startsWith("allow-") ||
option == kOptionStopService || option == "stop-service" ||
option == kOptionDirectServer || option == kOptionDirectServer ||
option == "stop-rendezvous-service" ||
option == kOptionForceAlwaysRelay) { option == kOptionForceAlwaysRelay) {
res = value == "Y"; res = value == "Y";
} else { } else {
@ -1447,9 +1446,8 @@ String bool2option(String option, bool b) {
if (option.startsWith('enable-')) { if (option.startsWith('enable-')) {
res = b ? defaultOptionYes : 'N'; res = b ? defaultOptionYes : 'N';
} else if (option.startsWith('allow-') || } else if (option.startsWith('allow-') ||
option == kOptionStopService || option == "stop-service" ||
option == kOptionDirectServer || option == kOptionDirectServer ||
option == "stop-rendezvous-service" ||
option == kOptionForceAlwaysRelay) { option == kOptionForceAlwaysRelay) {
res = b ? 'Y' : defaultOptionNo; res = b ? 'Y' : defaultOptionNo;
} else { } else {
@ -1485,9 +1483,9 @@ bool mainGetPeerBoolOptionSync(String id, String key) {
return option2bool(key, bind.mainGetPeerOptionSync(id: id, key: key)); return option2bool(key, bind.mainGetPeerOptionSync(id: id, key: key));
} }
// Don't use `option2bool()` and `bool2option()` to convert the session option. mainSetPeerBoolOptionSync(String id, String key, bool v) {
// Use `sessionGetToggleOption()` and `sessionToggleOption()` instead. bind.mainSetPeerOptionSync(id: id, key: key, value: bool2option(key, v));
// Because all session options use `Y` and `<Empty>` as values. }
Future<bool> matchPeer(String searchText, Peer peer) async { Future<bool> matchPeer(String searchText, Peer peer) async {
if (searchText.isEmpty) { if (searchText.isEmpty) {
@ -2672,7 +2670,7 @@ Future<void> start_service(bool is_start) async {
!isMacOS || !isMacOS ||
await callMainCheckSuperUserPermission(); await callMainCheckSuperUserPermission();
if (checked) { if (checked) {
mainSetBoolOption(kOptionStopService, !is_start); bind.mainSetOption(key: "stop-service", value: is_start ? "" : "Y");
} }
} }

View File

@ -2027,7 +2027,6 @@ pub fn option2bool(option: &str, value: &str) -> bool {
} else if option.starts_with("allow-") } else if option.starts_with("allow-")
|| option == "stop-service" || option == "stop-service"
|| option == keys::OPTION_DIRECT_SERVER || option == keys::OPTION_DIRECT_SERVER
|| option == "stop-rendezvous-service"
|| option == "force-always-relay" || option == "force-always-relay"
{ {
value == "Y" value == "Y"