From f531cd23ee0a68976f6d9c35ac71dd88ce362610 Mon Sep 17 00:00:00 2001 From: fufesou Date: Sat, 21 Oct 2023 23:24:54 +0800 Subject: [PATCH] add selinux tip Signed-off-by: fufesou --- Cargo.lock | 164 +++++++++++++----- Cargo.toml | 1 + .../lib/desktop/pages/connection_page.dart | 7 +- .../lib/desktop/pages/desktop_home_page.dart | 49 ++++-- src/flutter_ffi.rs | 11 ++ src/lang/ar.rs | 1 + src/lang/ca.rs | 1 + src/lang/cn.rs | 1 + src/lang/cs.rs | 1 + src/lang/da.rs | 1 + src/lang/de.rs | 1 + src/lang/el.rs | 1 + src/lang/en.rs | 1 + src/lang/eo.rs | 1 + src/lang/es.rs | 1 + src/lang/fa.rs | 1 + src/lang/fr.rs | 1 + src/lang/hu.rs | 1 + src/lang/id.rs | 1 + src/lang/it.rs | 2 +- src/lang/ja.rs | 1 + src/lang/ko.rs | 1 + src/lang/kz.rs | 1 + src/lang/lt.rs | 1 + src/lang/lv.rs | 1 + src/lang/nl.rs | 1 + src/lang/pl.rs | 1 + src/lang/pt_PT.rs | 1 + src/lang/ptbr.rs | 1 + src/lang/ro.rs | 1 + src/lang/ru.rs | 1 + src/lang/sk.rs | 1 + src/lang/sl.rs | 1 + src/lang/sq.rs | 1 + src/lang/sr.rs | 1 + src/lang/sv.rs | 1 + src/lang/template.rs | 1 + src/lang/th.rs | 1 + src/lang/tr.rs | 1 + src/lang/tw.rs | 1 + src/lang/ua.rs | 1 + src/lang/vn.rs | 1 + src/platform/linux.rs | 8 + 43 files changed, 216 insertions(+), 62 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b606cdb21..b93fa4752 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -83,7 +83,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8512c9117059663fb5606788fbca3619e2a91dac0e3fe516242eab1fa6be5e44" dependencies = [ "alsa-sys", - "bitflags", + "bitflags 1.3.2", "libc", "nix 0.24.3", ] @@ -375,7 +375,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39991bc421ddf72f70159011b323ff49b0f783cc676a7287c59453da2e2531cf" dependencies = [ "atk-sys", - "bitflags", + "bitflags 1.3.2", "glib 0.16.7", "libc", ] @@ -466,7 +466,7 @@ version = "0.59.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cexpr", "clang-sys", "clap 2.34.0", @@ -489,7 +489,7 @@ version = "0.63.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36d860121800b2a9a94f9b5604b332d5cffb234ce17609ea479d723dbc9d3885" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cexpr", "clang-sys", "lazy_static", @@ -511,7 +511,7 @@ version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cexpr", "clang-sys", "lazy_static", @@ -531,7 +531,30 @@ version = "0.65.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" dependencies = [ - "bitflags", + "bitflags 1.3.2", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "prettyplease", + "proc-macro2 1.0.63", + "quote 1.0.27", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.15", + "which", +] + +[[package]] +name = "bindgen" +version = "0.66.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" +dependencies = [ + "bitflags 2.4.1", "cexpr", "clang-sys", "lazy_static", @@ -560,6 +583,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + [[package]] name = "bitvec" version = "1.0.1" @@ -683,7 +712,7 @@ version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3125b15ec28b84c238f6f476c6034016a5f6cc0221cb514ca46c532139fc97d" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cairo-sys-rs", "glib 0.16.7", "libc", @@ -854,7 +883,7 @@ checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "ansi_term", "atty", - "bitflags", + "bitflags 1.3.2", "strsim 0.8.0", "textwrap 0.11.0", "unicode-width", @@ -868,7 +897,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "atty", - "bitflags", + "bitflags 1.3.2", "clap_lex 0.2.4", "indexmap", "strsim 0.10.0", @@ -895,7 +924,7 @@ checksum = "914c8c79fb560f238ef6429439a30023c862f7a28e688c58f7203f12b29970bd" dependencies = [ "anstream", "anstyle", - "bitflags", + "bitflags 1.3.2", "clap_lex 0.4.1", "strsim 0.10.0", ] @@ -956,7 +985,7 @@ version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -974,7 +1003,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "block", "cocoa-foundation", "core-foundation", @@ -990,7 +1019,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "931d3837c286f56e3c58423ce4eba12d08db2374461a785c86f672b08b5650d6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "block", "core-foundation", "core-graphics-types", @@ -1144,7 +1173,7 @@ version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-graphics-types", "foreign-types", @@ -1157,7 +1186,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "foreign-types", "libc", @@ -1169,7 +1198,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb17e2d1795b1996419648915df94bc7103c28f7b48062d7acf4652fc371b2ff" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation-sys 0.6.2", "coreaudio-sys", ] @@ -1753,6 +1782,12 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" +[[package]] +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + [[package]] name = "dylib_virtual_display" version = "0.1.0" @@ -1933,7 +1968,7 @@ version = "4.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20df693c700404f7e19d4d6fae6b15215d2913c27955d2b9d6f2c0f537511cd0" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", ] @@ -2331,7 +2366,7 @@ version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9cb33da481c6c040404a11f8212d193889e9b435db2c14fd86987f630d3ce1" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cairo-rs", "gdk-pixbuf", "gdk-sys", @@ -2347,7 +2382,7 @@ version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3578c60dee9d029ad86593ed88cb40f35c1b83360e12498d055022385dd9a05" dependencies = [ - "bitflags", + "bitflags 1.3.2", "gdk-pixbuf-sys", "gio", "glib 0.16.7", @@ -2466,7 +2501,7 @@ version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a1c84b4534a290a29160ef5c6eff2a9c95833111472e824fc5cb78b513dd092" dependencies = [ - "bitflags", + "bitflags 1.3.2", "futures-channel", "futures-core", "futures-io", @@ -2499,7 +2534,7 @@ version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf7f68c2995f392c49fffb4f95ae2c873297830eb25c6bc4c114ce8f4562acc" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", "libgit2-sys", "log", @@ -2512,7 +2547,7 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c685013b7515e668f1b57a165b009d4d28cb139a8a989bbd699c10dad29d0c5" dependencies = [ - "bitflags", + "bitflags 1.3.2", "futures-channel", "futures-core", "futures-executor", @@ -2531,7 +2566,7 @@ version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddd4df61a866ed7259d6189b8bcb1464989a77f1d85d25d002279bbe9dd38b2f" dependencies = [ - "bitflags", + "bitflags 1.3.2", "futures-channel", "futures-core", "futures-executor", @@ -2632,7 +2667,7 @@ version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ff5d0f7ff308ae37e6eb47b6ded17785bdea06e438a708cd09e0288c1862f33" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if 1.0.0", "futures-channel", "futures-core", @@ -2656,7 +2691,7 @@ version = "0.16.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc80888271338c3ede875d8cafc452eb207476ff5539dcbe0018a8f5b827af0e" dependencies = [ - "bitflags", + "bitflags 1.3.2", "futures-core", "futures-sink", "glib 0.10.3", @@ -2689,7 +2724,7 @@ version = "0.16.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bafd01c56f59cb10f4b5a10f97bb4bdf8c2b2784ae5b04da7e2d400cf6e6afcf" dependencies = [ - "bitflags", + "bitflags 1.3.2", "glib 0.10.3", "glib-sys 0.10.1", "gobject-sys 0.10.0", @@ -2730,7 +2765,7 @@ version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7bbb1485d87469849ec45c08e03c2f280d3ea20ff3c439d03185be54e3ce98e" dependencies = [ - "bitflags", + "bitflags 1.3.2", "futures-channel", "futures-util", "glib 0.10.3", @@ -2766,7 +2801,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4d3507d43908c866c805f74c9dd593c0ce7ba5c38e576e41846639cdcd4bee6" dependencies = [ "atk", - "bitflags", + "bitflags 1.3.2", "cairo-rs", "field-offset", "futures-channel", @@ -3140,7 +3175,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abf888f9575c290197b2c948dc9e9ff10bd1a39ad1ea8585f734585fa6b9d3f9" dependencies = [ - "bitflags", + "bitflags 1.3.2", "inotify-sys", "libc", ] @@ -3336,7 +3371,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7668b7cff6a51fe61cdde64cd27c8a220786f399501b57ebe36f7d8112fd68" dependencies = [ - "bitflags", + "bitflags 1.3.2", "serde 1.0.163", "unicode-segmentation", ] @@ -3442,7 +3477,7 @@ version = "2.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1745b20bfc194ac12ef828f144f0ec2d4a7fe993281fa3567a0bd4969aee6890" dependencies = [ - "bitflags", + "bitflags 1.3.2", "libc", "libpulse-sys", "num-derive", @@ -3779,7 +3814,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" dependencies = [ - "bitflags", + "bitflags 1.3.2", "jni-sys", "ndk-sys", "num_enum", @@ -3821,7 +3856,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea993e32c77d87f01236c38f572ecb6c311d592e56a06262a007fd2a6e31253c" dependencies = [ "anyhow", - "bitflags", + "bitflags 1.3.2", "byteorder", "libc", "netlink-packet-core", @@ -3857,7 +3892,7 @@ version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cc", "cfg-if 1.0.0", "libc", @@ -3870,7 +3905,7 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if 1.0.0", "libc", "memoffset 0.6.5", @@ -3882,7 +3917,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if 1.0.0", "libc", "memoffset 0.7.1", @@ -4121,9 +4156,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -4236,7 +4271,7 @@ version = "0.16.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdff66b271861037b89d028656184059e03b0b6ccb36003820be19f7200b1e94" dependencies = [ - "bitflags", + "bitflags 1.3.2", "gio", "glib 0.16.7", "libc", @@ -4442,7 +4477,7 @@ version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aaeebc51f9e7d2c150d3f3bfeb667f2aa985db5ef1e3d212847bdedb488beeaa" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crc32fast", "fdeflate", "flate2", @@ -4456,7 +4491,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg 1.1.0", - "bitflags", + "bitflags 1.3.2", "cfg-if 1.0.0", "concurrent-queue", "libc", @@ -4935,7 +4970,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -4944,7 +4979,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -4958,6 +4993,12 @@ dependencies = [ "thiserror", ] +[[package]] +name = "reference-counted-singleton" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bfbf25d7eb88ddcbb1ec3d755d0634da8f7657b2cb8b74089121409ab8228f" + [[package]] name = "regex" version = "1.8.1" @@ -5207,6 +5248,7 @@ dependencies = [ "samplerate", "sciter-rs", "scrap", + "selinux", "serde 1.0.163", "serde_derive", "serde_json 1.0.96", @@ -5265,7 +5307,7 @@ version = "0.37.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -5442,7 +5484,7 @@ version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-foundation-sys 0.8.4", "libc", @@ -5459,6 +5501,32 @@ dependencies = [ "libc", ] +[[package]] +name = "selinux" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80b091d970bd4a17a59cb1b7c537786f2bee4292abb5ec89ee3b7f17e9077138" +dependencies = [ + "bitflags 2.4.1", + "libc", + "once_cell", + "reference-counted-singleton", + "selinux-sys", + "thiserror", +] + +[[package]] +name = "selinux-sys" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56602385930248c57e45f6174a6a48e12b723d0cc2ae8f467fcbe80c0d06f41" +dependencies = [ + "bindgen 0.66.1", + "cc", + "dunce", + "walkdir", +] + [[package]] name = "semver" version = "1.0.17" @@ -5858,7 +5926,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75182f12f490e953596550b65ee31bda7c8e043d9386174b353bda50838c3fd" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "system-configuration-sys", ] @@ -5916,7 +5984,7 @@ name = "tao" version = "0.22.2" source = "git+https://github.com/rustdesk-org/tao?branch=dev#1e5b97258cf42a30f80f85a6aa0b1a4aece1977e" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cairo-rs", "cc", "cocoa", @@ -6935,7 +7003,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd9db37ecb5b13762d95468a2fc6009d4b2c62801243223aabd44fca13ad13c8" dependencies = [ - "bitflags", + "bitflags 1.3.2", "widestring", "windows-sys 0.45.0", ] diff --git a/Cargo.toml b/Cargo.toml index f6c014483..711a1caca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -132,6 +132,7 @@ dbus = "0.9" dbus-crossroads = "0.5" pam = { git="https://github.com/fufesou/pam", optional = true } users = { version = "0.11" } +selinux = "0.4.2" [target.'cfg(target_os = "android")'.dependencies] android_logger = "0.13" diff --git a/flutter/lib/desktop/pages/connection_page.dart b/flutter/lib/desktop/pages/connection_page.dart index 859fd0d70..272fd7c7b 100644 --- a/flutter/lib/desktop/pages/connection_page.dart +++ b/flutter/lib/desktop/pages/connection_page.dart @@ -37,7 +37,6 @@ class _ConnectionPageState extends State Timer? _updateTimer; final RxBool _idInputFocused = false.obs; - final FocusNode _idFocusNode = FocusNode(); var svcStopped = Get.find(tag: 'stop-service'); var svcIsUsingPublicServer = true.obs; @@ -334,8 +333,10 @@ class _ConnectionPageState extends State optionsViewBuilder: (BuildContext context, AutocompleteOnSelected onSelected, Iterable options) { double maxHeight = 0; for (var peer in options) { - if (maxHeight < 200) - maxHeight += 50; }; + if (maxHeight < 200) { + maxHeight += 50; + } + } return Align( alignment: Alignment.topLeft, child: ClipRRect( diff --git a/flutter/lib/desktop/pages/desktop_home_page.dart b/flutter/lib/desktop/pages/desktop_home_page.dart index 8633af1d3..74002dfc2 100644 --- a/flutter/lib/desktop/pages/desktop_home_page.dart +++ b/flutter/lib/desktop/pages/desktop_home_page.dart @@ -378,16 +378,36 @@ class _DesktopHomePageState extends State // }); // } } else if (Platform.isLinux) { + final LinuxCards = []; if (bind.mainCurrentIsWayland()) { - return buildInstallCard( + LinuxCards.add(buildInstallCard( "Warning", "wayland_experiment_tip", "", () async {}, help: 'Help', - link: 'https://rustdesk.com/docs/en/manual/linux/#x11-required'); + link: 'https://rustdesk.com/docs/en/manual/linux/#x11-required')); } else if (bind.mainIsLoginWayland()) { - return buildInstallCard("Warning", + LinuxCards.add(buildInstallCard("Warning", "Login screen using Wayland is not supported", "", () async {}, help: 'Help', - link: 'https://rustdesk.com/docs/en/manual/linux/#login-screen'); + link: 'https://rustdesk.com/docs/en/manual/linux/#login-screen')); + } + if (bind.isSelinuxEnabled()) { + final keyShowSelinuxHelpTip = "show-selinux-help-tip"; + if (bind.mainGetLocalOption(key: keyShowSelinuxHelpTip) != 'N') { + LinuxCards.add(buildInstallCard( + "Warning", "selinux_tip", "", () async {}, + marginTop: LinuxCards.isEmpty ? 20.0 : 5.0, + help: 'Help', + link: + 'https://rustdesk.com/docs/en/client/linux/#permissions-issue', + closeButton: true, + closeOption: keyShowSelinuxHelpTip, + )); + } + } + if (LinuxCards.isNotEmpty) { + return Column( + children: LinuxCards, + ); } } return Container(); @@ -395,17 +415,26 @@ class _DesktopHomePageState extends State Widget buildInstallCard(String title, String content, String btnText, GestureTapCallback onPressed, - {String? help, String? link, bool? closeButton}) { - void closeCard() { - setState(() { - isCardClosed = true; - }); + {double marginTop = 20.0, String? help, String? link, bool? closeButton, String? closeOption}) { + void closeCard() async { + if (closeOption != null) { + await bind.mainSetLocalOption(key: closeOption, value: 'N'); + if (bind.mainGetLocalOption(key: closeOption) == 'N') { + setState(() { + isCardClosed = true; + }); + } + } else { + setState(() { + isCardClosed = true; + }); + } } return Stack( children: [ Container( - margin: EdgeInsets.only(top: 20), + margin: EdgeInsets.only(top: marginTop), child: Container( decoration: BoxDecoration( gradient: LinearGradient( diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index efd2a3e82..7e1aa44e4 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -1935,6 +1935,17 @@ pub fn is_support_multi_ui_session(version: String) -> SyncReturn { SyncReturn(crate::common::is_support_multi_ui_session(&version)) } +pub fn is_selinux_enabled() -> SyncReturn { + #[cfg(target_os = "linux")] + { + SyncReturn(crate::platform::linux::is_selinux_enabled()) + } + #[cfg(not(target_os = "linux"))] + { + SyncReturn(false) + } +} + #[cfg(target_os = "android")] pub mod server_side { use hbb_common::{config, log}; diff --git a/src/lang/ar.rs b/src/lang/ar.rs index 4b80047d5..425f49d3a 100644 --- a/src/lang/ar.rs +++ b/src/lang/ar.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ca.rs b/src/lang/ca.rs index bd62b21c7..8057430e5 100644 --- a/src/lang/ca.rs +++ b/src/lang/ca.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/cn.rs b/src/lang/cn.rs index 2893eb9a5..0a4f5beea 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", "在新的窗口中打开"), ("Show displays as individual windows", "在单个窗口中打开显示器"), ("Use all my displays for the remote session", "将我的所有显示器用于远程会话"), + ("selinux_tip", "SELinux 处于启用状态,RustDesk 可能无法正常运行。"), ].iter().cloned().collect(); } diff --git a/src/lang/cs.rs b/src/lang/cs.rs index 00eb95248..c7e620665 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", "Otevřít v novém okně"), ("Show displays as individual windows", "Zobrazit obrazovky jako jednotlivá okna"), ("Use all my displays for the remote session", "Použít všechny mé obrazovky pro vzdálenou relaci"), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/da.rs b/src/lang/da.rs index 2f1076fd1..634c7e8a9 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/de.rs b/src/lang/de.rs index b15023495..6b5beb305 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", "In einem neuen Fenster öffnen"), ("Show displays as individual windows", "Jeden Bildschirm in einem eigenen Fenster anzeigen"), ("Use all my displays for the remote session", "Alle meine Bildschirme für die Fernsitzung verwenden"), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/el.rs b/src/lang/el.rs index 940889e16..baf16f82e 100644 --- a/src/lang/el.rs +++ b/src/lang/el.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/en.rs b/src/lang/en.rs index 56dc8a122..6dc185f99 100644 --- a/src/lang/en.rs +++ b/src/lang/en.rs @@ -225,5 +225,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("switch_display_elevated_connections_tip", "Switching to non-primary display is not supported in the elevated mode when there are multiple connections. Please try again after installation if you want to control multiple displays."), ("display_is_plugged_out_msg", "The display is plugged out, switch to the first display."), ("elevated_switch_display_msg", "Switch to the primary display because multiple displays are not supported in elevated mode."), + ("selinux_tip", "SELinux is enabled on your device, which may prevent RustDesk from running properly."), ].iter().cloned().collect(); } diff --git a/src/lang/eo.rs b/src/lang/eo.rs index 8685fa567..5c3c3eec1 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/es.rs b/src/lang/es.rs index 093298835..426e80a8e 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", "Abrir en una nueva ventana"), ("Show displays as individual windows", "Mostrar pantallas como ventanas individuales"), ("Use all my displays for the remote session", "Usar todas mis pantallas para la sesión remota"), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fa.rs b/src/lang/fa.rs index 845cb1868..28acc2c13 100644 --- a/src/lang/fa.rs +++ b/src/lang/fa.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fr.rs b/src/lang/fr.rs index 9f1954f7d..a2bc13a77 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/hu.rs b/src/lang/hu.rs index 882663b7e..e56cad01e 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/id.rs b/src/lang/id.rs index 21ba8a86a..f0306b962 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", "Buka di jendela baru"), ("Show displays as individual windows", "Tampilkan dengan jendela terpisah"), ("Use all my displays for the remote session", "Gunakan semua layar untuk sesi remote"), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/it.rs b/src/lang/it.rs index 617e0f0c5..738dfa79e 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -365,7 +365,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Audio Input Device", "Dispositivo ingresso audio"), ("Use IP Whitelisting", "Usa elenco IP autorizzati"), ("Network", "Rete"), - ("Enable RDP", "Abilita RDP"), ("Pin Toolbar", "Blocca barra strumenti"), ("Unpin Toolbar", "Sblocca barra strumenti"), ("Recording", "Registrazione"), @@ -566,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", "Apri in una nuova finestra"), ("Show displays as individual windows", "Visualizza schermi come finestre individuali"), ("Use all my displays for the remote session", "Usa tutti gli schermi per la sessione remota"), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ja.rs b/src/lang/ja.rs index 059b355db..51496107f 100644 --- a/src/lang/ja.rs +++ b/src/lang/ja.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ko.rs b/src/lang/ko.rs index 0a7affb3b..49cfd2931 100644 --- a/src/lang/ko.rs +++ b/src/lang/ko.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/kz.rs b/src/lang/kz.rs index 73fc04469..5fc4a4795 100644 --- a/src/lang/kz.rs +++ b/src/lang/kz.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/lt.rs b/src/lang/lt.rs index 39747e0d4..2c3551989 100644 --- a/src/lang/lt.rs +++ b/src/lang/lt.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/lv.rs b/src/lang/lv.rs index 6dd5a2b0b..d7783e052 100644 --- a/src/lang/lv.rs +++ b/src/lang/lv.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", "Atvērt jaunā logā"), ("Show displays as individual windows", "Rādīt displejus kā atsevišķus logus"), ("Use all my displays for the remote session", "Izmantot visus manus displejus attālajai sesijai"), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/nl.rs b/src/lang/nl.rs index 7a8189682..0365206a9 100644 --- a/src/lang/nl.rs +++ b/src/lang/nl.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", "Open in een nieuw venster"), ("Show displays as individual windows", "Beeldschermen weergeven als afzonderlijke vensters"), ("Use all my displays for the remote session", "Gebruik al mijn beeldschermen voor de externe sessie"), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pl.rs b/src/lang/pl.rs index 91c508aaa..f82cd4588 100644 --- a/src/lang/pl.rs +++ b/src/lang/pl.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", "Otwórz w nowym oknie"), ("Show displays as individual windows", "Pokaż ekrany w osobnych oknach"), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pt_PT.rs b/src/lang/pt_PT.rs index 9c3c01660..979add253 100644 --- a/src/lang/pt_PT.rs +++ b/src/lang/pt_PT.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index 9b052947f..fac32ccf1 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ro.rs b/src/lang/ro.rs index 61d44813d..83392ed77 100644 --- a/src/lang/ro.rs +++ b/src/lang/ro.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ru.rs b/src/lang/ru.rs index af7bf5cf3..82c9a9601 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", "Открыть в новом окне"), ("Show displays as individual windows", "Показывать дисплеи в отдельных окнах"), ("Use all my displays for the remote session", "Использовать все мои дисплеи для удалённого сеанса"), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sk.rs b/src/lang/sk.rs index b124aed71..07029c213 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sl.rs b/src/lang/sl.rs index e1bf2ab8e..83594ea75 100755 --- a/src/lang/sl.rs +++ b/src/lang/sl.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sq.rs b/src/lang/sq.rs index 1d9b218a6..f9f49345d 100644 --- a/src/lang/sq.rs +++ b/src/lang/sq.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sr.rs b/src/lang/sr.rs index 754192fc3..956be5e33 100644 --- a/src/lang/sr.rs +++ b/src/lang/sr.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sv.rs b/src/lang/sv.rs index 007e180bb..7a1faa19a 100644 --- a/src/lang/sv.rs +++ b/src/lang/sv.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/template.rs b/src/lang/template.rs index f14c3e206..6b6f28e5f 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/th.rs b/src/lang/th.rs index bb13d82b6..89b753bc6 100644 --- a/src/lang/th.rs +++ b/src/lang/th.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tr.rs b/src/lang/tr.rs index 394b9bca9..b1f3f3cd2 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tw.rs b/src/lang/tw.rs index cdc900ae2..cb7d7516a 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ua.rs b/src/lang/ua.rs index 02c4e2349..05a74f633 100644 --- a/src/lang/ua.rs +++ b/src/lang/ua.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", "Відкрити в новому вікні"), ("Show displays as individual windows", "Відображати дисплеї в якості окремих вікон"), ("Use all my displays for the remote session", "Використовувати всі мої дисплеї для віддаленого сеансу"), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/lang/vn.rs b/src/lang/vn.rs index 0e0cf6a05..9c259b8fa 100644 --- a/src/lang/vn.rs +++ b/src/lang/vn.rs @@ -565,5 +565,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Open in new window", ""), ("Show displays as individual windows", ""), ("Use all my displays for the remote session", ""), + ("selinux_tip", ""), ].iter().cloned().collect(); } diff --git a/src/platform/linux.rs b/src/platform/linux.rs index 87dc8d071..bb3474d41 100644 --- a/src/platform/linux.rs +++ b/src/platform/linux.rs @@ -1369,3 +1369,11 @@ impl Drop for WallPaperRemover { pub fn is_x11() -> bool { *IS_X11 } + +#[inline] +pub fn is_selinux_enabled() -> bool { + match selinux::kernel_support() { + selinux::KernelSupport::Unsupported => false, + _ => selinux::current_mode() == selinux::SELinuxMode::Enforcing, + } +}