Compare commits

..
Author SHA1 Message Date
rustdeskandClaude Opus 5.5 ccdd537f6a Pin hbb_common to the merged websocket-port change
rustdesk/hbb_common#626 is merged as edefa08. The range from master's
pin 5d52530 also includes 20d5019 (quiets smithay client toolkit logs,
rustdesk/hbb_common#620).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 17:54:12 +08:00
rustdeskandClaude Opus 5.5 a79723bc4a Update hbb_common: match websocket-port only against configured servers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 17:28:41 +08:00
rustdeskandClaude Opus 5.5 9bc28abb17 Update hbb_common for the websocket-port warning throttle
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 17:04:40 +08:00
rustdeskandClaude Opus 5.5 86d0199152 feat: let custom client settings set websocket-port
A domain endpoint becomes ws(s)://<domain>/ws/id with no port, so a
WebSocket reverse proxy that cannot listen on 443 (or 80) is
unreachable. hbb_common adds websocket-port for that; list it in
KEYS_SETTINGS so default-settings and override-settings carry it.

The hbb_common bump also brings in 20d5019 (quiets smithay client
toolkit logs, rustdesk/hbb_common#620).

https://github.com/rustdesk/rustdesk-server-pro/discussions/1029

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:06:04 +08:00
11 changed files with 88 additions and 296 deletions
Generated
+8 -8
View File
@@ -3737,7 +3737,7 @@ dependencies = [
"url",
"users",
"uuid",
"webpki-roots 1.0.11",
"webpki-roots 1.0.10",
"webrtc",
"whoami",
"x11 2.21.0",
@@ -3889,7 +3889,7 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "hwcodec"
version = "0.8.0"
source = "git+https://github.com/rustdesk-org/hwcodec#ec38ebaf2454269d4c5668a57e3813c6e5541be7"
source = "git+https://github.com/rustdesk-org/hwcodec#febec27e1b40bb9fbbae02e9c59b71ac824b9fe1"
dependencies = [
"bindgen 0.59.2",
"cc",
@@ -3935,7 +3935,7 @@ dependencies = [
"tokio",
"tokio-rustls",
"tower-service",
"webpki-roots 1.0.11",
"webpki-roots 1.0.10",
]
[[package]]
@@ -6930,7 +6930,7 @@ dependencies = [
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"webpki-roots 1.0.11",
"webpki-roots 1.0.10",
]
[[package]]
@@ -7041,7 +7041,7 @@ dependencies = [
[[package]]
name = "rust-pulsectl"
version = "0.2.12"
source = "git+https://github.com/rustdesk-org/pulsectl#d2ec086b5770dce934a66956364d09df8cc9484c"
source = "git+https://github.com/rustdesk-org/pulsectl#aa34dde499aa912a3abc5289cc0b547bd07dd6e2"
dependencies = [
"libpulse-binding",
]
@@ -9553,14 +9553,14 @@ version = "0.26.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
dependencies = [
"webpki-roots 1.0.11",
"webpki-roots 1.0.10",
]
[[package]]
name = "webpki-roots"
version = "1.0.11"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5f280bbb2b287bc8e7de7e3852945a0ff50d1bbcb5ed42b6c7a568c546df171"
checksum = "1c1c8e20c8a38fc7d65abfe74eb7280e4aa667e8eec8bc84996d2874810748d9"
dependencies = [
"rustls-pki-types",
]
-7
View File
@@ -1,6 +1,5 @@
import UIKit
import Flutter
import AVFoundation
@main
@objc class AppDelegate: FlutterAppDelegate {
@@ -9,12 +8,6 @@ import AVFoundation
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
do {
// Mix remote audio with other apps while still respecting silent mode.
try AVAudioSession.sharedInstance().setCategory(.ambient)
} catch {
NSLog("Failed to configure audio mixing: %@", error.localizedDescription)
}
dummyMethodToEnforceBundling();
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
@@ -21,7 +21,6 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:pull_down_button/pull_down_button.dart';
import 'package:url_launcher/url_launcher_string.dart';
import '../../common.dart';
import '../../models/platform_model.dart';
@@ -550,28 +549,6 @@ class _PeerTabPageState extends State<PeerTabPage>
});
}
Widget _openWebConsole() {
return _hoverAction(
context: context,
toolTip: translate('ab_web_console_tip'),
child: Icon(
Icons.open_in_new,
size: 18,
),
onTap: () async {
final url = await bind.mainGetApiServer();
if (await canLaunchUrlString(url)) {
launchUrlString(url);
}
});
}
bool _showWebConsole(PeerTabModel model) =>
model.currentTab == PeerTabIndex.ab.index &&
gFFI.userModel.isLogin &&
!gFFI.abModel.legacyMode.value &&
gFFI.abModel.current.canWrite();
List<Widget> _landscapeRightActions(BuildContext context) {
final model = Provider.of<PeerTabModel>(context);
return [
@@ -589,10 +566,6 @@ class _PeerTabPageState extends State<PeerTabPage>
offstage: model.currentTab == PeerTabIndex.recent.index,
child: PeerSortDropdown(),
),
Offstage(
offstage: !_showWebConsole(model),
child: _openWebConsole(),
),
Offstage(
offstage: model.currentTab != PeerTabIndex.ab.index,
child: _toggleTags(),
@@ -657,7 +630,6 @@ class _PeerTabPageState extends State<PeerTabPage>
final List<Widget> dynamicActions = [
if (model.currentTabCachedPeers.isNotEmpty) _createMultiSelection(),
if (model.currentTab != PeerTabIndex.recent.index) PeerSortDropdown(),
if (_showWebConsole(model)) _openWebConsole(),
if (model.currentTab == PeerTabIndex.ab.index) _toggleTags()
];
final rightWidth = availableWidth -
+1
View File
@@ -2872,6 +2872,7 @@ pub struct LoginConfigHandler {
pub save_ab_password_to_recent: bool, // true: connected with ab password
pub other_server: Option<(String, String, String)>,
pub custom_fps: Arc<Mutex<Option<usize>>>,
pub last_auto_fps: Option<usize>,
pub adapter_luid: Option<i64>,
pub mark_unsupported: Vec<CodecFormat>,
pub selected_windows_session_id: Option<u32>,
+5 -57
View File
@@ -98,7 +98,6 @@ pub struct Remote<T: InvokeUiSession> {
elevation_requested: bool,
peer_info: ParsedPeerInfo,
video_threads: HashMap<usize, VideoThread>,
last_auto_fps: Option<usize>,
chroma: Arc<RwLock<Option<Chroma>>>,
last_record_state: bool,
sent_close_reason: bool,
@@ -151,7 +150,6 @@ impl<T: InvokeUiSession> Remote<T> {
elevation_requested: false,
peer_info: Default::default(),
video_threads: Default::default(),
last_auto_fps: None,
chroma: Default::default(),
last_record_state: false,
sent_close_reason: false,
@@ -384,7 +382,7 @@ impl<T: InvokeUiSession> Remote<T> {
self.video_threads.iter().for_each(|(_, v)| {
*v.frame_count.write().unwrap() = 0;
});
self.fps_control(direct, fps.clone(), &mut peer).await;
self.fps_control(direct, fps.clone());
let chroma = self.chroma.read().unwrap().clone();
let chroma = match chroma {
Some(Chroma::I444) => "4:4:4",
@@ -789,11 +787,6 @@ impl<T: InvokeUiSession> Remote<T> {
self.initial_clipboard_pending = false;
}
Some(message::Union::Misc(misc)) => match misc.union {
Some(misc::Union::Option(ref option)) => {
if option.custom_fps > 0 {
self.last_auto_fps = None;
}
}
Some(misc::Union::RefreshVideo(_)) => {
self.video_threads.iter().for_each(|(_, v)| {
*v.discard_queue.write().unwrap() = true;
@@ -1393,12 +1386,7 @@ impl<T: InvokeUiSession> Remote<T> {
// Currently, this function only considers decoding speed and queue length, not network delay.
// The controlled end can consider auto fps as the maximum decoding fps.
#[inline]
async fn fps_control(
&mut self,
direct: bool,
real_fps_map: HashMap<usize, i32>,
peer: &mut Stream,
) {
fn fps_control(&mut self, direct: bool, real_fps_map: HashMap<usize, i32>) {
self.video_threads.iter_mut().for_each(|(k, v)| {
let real_fps = real_fps_map.get(k).cloned().unwrap_or_default();
if real_fps == 0 {
@@ -1438,7 +1426,7 @@ impl<T: InvokeUiSession> Remote<T> {
if limited_fps > custom_fps {
limited_fps = custom_fps;
}
let last_auto_fps = self.last_auto_fps;
let last_auto_fps = self.handler.lc.read().unwrap().last_auto_fps.clone();
let displays = self.video_threads.keys().cloned().collect::<Vec<_>>();
let mut fps_trending = |display: usize| {
let thread = self.video_threads.get_mut(&display)?;
@@ -1484,10 +1472,9 @@ impl<T: InvokeUiSession> Remote<T> {
});
let mut msg = Message::new();
msg.set_misc(misc);
// Send inline so a queued manual FPS update is applied after this decision.
allow_err!(peer.send(&msg).await);
self.sender.send(Data::Message(msg)).ok();
log::info!("Set fps to {}", auto_fps);
self.last_auto_fps = Some(auto_fps);
self.handler.lc.write().unwrap().last_auto_fps = Some(auto_fps);
}
}
// send refresh
@@ -2400,7 +2387,6 @@ impl<T: InvokeUiSession> Remote<T> {
}
fn set_peer_info(&mut self, pi: &PeerInfo) {
self.last_auto_fps = None;
self.peer_info.platform = pi.platform.clone();
// Check features field for terminal support
@@ -3033,44 +3019,6 @@ mod tests {
"a clipboard after the login was held back"
);
}
#[tokio::test]
async fn manual_fps_update_allows_the_same_automatic_limit_again() {
let (mut remote, mut peer, mut far) = remote_and_peer().await;
let (video_sender, _video_receiver) = std::sync::mpsc::channel();
remote.video_threads.insert(
0,
VideoThread {
video_queue: Arc::new(RwLock::new(ArrayQueue::new(client::VIDEO_QUEUE_SIZE))),
video_sender,
decode_fps: Arc::new(RwLock::new(Some(23))),
frame_count: Default::default(),
discard_queue: Default::default(),
fps_control: Default::default(),
},
);
for (manual_fps, expected) in [(None, 20), (Some(90), 90), (None, 20)] {
if let Some(fps) = manual_fps {
let lc = &remote.handler.lc;
let msg = lc.write().unwrap().set_custom_fps(fps, false);
remote
.handle_msg_from_ui(Data::Message(msg), &mut peer)
.await;
} else {
remote
.fps_control(true, HashMap::from([(0, 20)]), &mut peer)
.await;
}
let bytes = timeout(1000, far.next())
.await
.expect("FPS update was not sent")
.unwrap()
.unwrap();
let msg = Message::parse_from_bytes(&bytes).unwrap();
assert_eq!(msg.misc().option().custom_fps, expected);
}
}
}
#[cfg(test)]
-31
View File
@@ -143,10 +143,6 @@ fn resolve_lang(saved_lang: &str, locale: &str, cjk_fallback: bool) -> String {
"zh-cn"
})
.to_owned();
// Hong Kong, Macao and the Hant script use Traditional Chinese.
if !locale.contains("hans") && ["hk", "mo", "hant"].iter().any(|x| locale.contains(x)) {
lang = "zh-tw".to_owned();
}
}
}
if lang.is_empty() {
@@ -171,12 +167,6 @@ fn resolve_lang(saved_lang: &str, locale: &str, cjk_fallback: bool) -> String {
.map(|x| x.split("_").next().unwrap_or_default())
.unwrap_or_default()
.to_owned();
// The Kazakh and Georgian tables are keyed by country code, not by language code.
if lang == "kk" {
lang = "kz".to_owned();
} else if lang == "ka" {
lang = "ge".to_owned();
}
}
if cjk_fallback && is_cjk_lang(&lang) {
"en".to_owned()
@@ -375,25 +365,4 @@ mod test {
assert_eq!(f("", "pt-AO", false), "pt-pt");
assert_eq!(f("", "pt-MZ", false), "pt-pt");
}
#[test]
fn test_resolve_lang_detects_kazakh_and_georgian_from_locale() {
use super::resolve_lang as f;
assert_eq!(f("", "kk_KZ.UTF-8", false), "kz");
assert_eq!(f("", "kk-KZ", false), "kz");
assert_eq!(f("", "ka_GE.UTF-8", false), "ge");
assert_eq!(f("", "ka-GE", false), "ge");
}
#[test]
fn test_resolve_lang_detects_traditional_chinese_for_hong_kong_and_macao() {
use super::resolve_lang as f;
assert_eq!(f("", "zh_HK.UTF-8", false), "zh-tw");
assert_eq!(f("", "zh-Hant-HK", false), "zh-tw");
assert_eq!(f("", "zh-Hant", false), "zh-tw");
assert_eq!(f("", "zh_MO", false), "zh-tw");
assert_eq!(f("", "zh-Hans-HK", false), "zh-cn");
}
}
+34 -34
View File
@@ -781,39 +781,39 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Relay fallback delay in seconds", "릴레이 대체 작동 지연 시간 (초)"),
("relay-fallback-delay-tip", "이미 연결된 중계 연결이 직접 WebRTC 연결을 얼마나 기다린 후 대신 사용되는지입니다. 값을 늘리면 느린 직접 연결에 더 많은 시간을 주고, 줄이면 직접 연결이 불가능한 네트워크에서 더 빨리 중계로 전환합니다. 비워 두면 기본값 2.5초가 사용됩니다."),
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "음성 통화를 시작하려면 '화면 공유' 페이지에서 '오디오 캡처'를 사용함으로 하세요."),
("Keyboard shortcuts", "키보드 단축키"),
("Configure shortcuts...", "단축키 구성"),
("Enable keyboard shortcuts in remote session", "원격 세션에서 키보드 단축키 사용함"),
("shortcut-page-description", "아래 각 세션 동작에 키 조합을 할당하세요. 각 연결에는 최소 하나의 수정자가 포함되어야 합니다."),
("shortcut-passthrough-tip", "활성화되면 모든 할당 조합이 원격으로 전달됩니다. 연결이 원격에서 필요한 항목과 충돌할 때 유용합니다."),
("Pass-through to remote", "원격으로 전달"),
("Reset to defaults", "기본값으로 재설정"),
("shortcut-reset-confirm-tip", "현재의 모든 할당을 기본값으로 대체합니다. 계속하시겠습니까?"),
("Monitor", "모니터"),
("Keyboard", "키보드"),
("Toggle fullscreen", "전체 화면 전환"),
("Switch to next display", "다음 디스플레이로 전환"),
("Switch to previous display", "이전 디스플레이로 전환"),
("Switch to next tab", "다음 탭으로 전환"),
("Switch to previous tab", "이전 탭으로 전환"),
("Toggle session recording", "녹화 세션 전환"),
("Close tab", "탭 닫기"),
("Toggle toolbar", "도구 모음 전환"),
("Toggle input source", "입력 소스 전환"),
("Edit", "편집"),
("Save", "저장"),
("Set shortcut", "단축키 설정"),
("shortcut-recording-instruction", "사용할 키 조합을 누르세요."),
("shortcut-recording-press-keys-tip", "키 조합을 누르세요.."),
("shortcut-must-include-modifiers", "수정자 하나 이상을 반드시 포함해야 합니다: {}"),
("shortcut-already-bound-to", "이미 할당됨"),
("Replace", "교체"),
("Valid", "유효"),
("shortcut-mobile-physical-keyboard-tip", "녹화하려면 물리적 키보드가 필요합니다. 소프트 키보드는 지원되지 않습니다."),
("shortcut-key-not-supported", "\"{}\"는 단축키로 사용할 수 없습니다."),
("On", "켬"),
("Off", "끔"),
("api_server_connection_tip", "사용 중인 맞춤형 서버가 암호화되지 않은 HTTP를 사용합니다. HTTPS를 사용하도록 관리자에게 문의하세요."),
("api_server_empty_tip", "API 서버가 비어 있으면 사용자 지정 서버는 기본적으로 HTTP로 설정됩니다. HTTPS를 사용하도록 관리자에게 문의하세요."),
("Keyboard shortcuts", ""),
("Configure shortcuts...", ""),
("Enable keyboard shortcuts in remote session", ""),
("shortcut-page-description", ""),
("shortcut-passthrough-tip", ""),
("Pass-through to remote", ""),
("Reset to defaults", ""),
("shortcut-reset-confirm-tip", ""),
("Monitor", ""),
("Keyboard", ""),
("Toggle fullscreen", ""),
("Switch to next display", ""),
("Switch to previous display", ""),
("Switch to next tab", ""),
("Switch to previous tab", ""),
("Toggle session recording", ""),
("Close tab", ""),
("Toggle toolbar", ""),
("Toggle input source", ""),
("Edit", ""),
("Save", ""),
("Set shortcut", ""),
("shortcut-recording-instruction", ""),
("shortcut-recording-press-keys-tip", ""),
("shortcut-must-include-modifiers", ""),
("shortcut-already-bound-to", ""),
("Replace", ""),
("Valid", ""),
("shortcut-mobile-physical-keyboard-tip", ""),
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+34 -34
View File
@@ -781,39 +781,39 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Relay fallback delay in seconds", "Aktarıcıya geçiş gecikmesi (saniye)"),
("relay-fallback-delay-tip", "Zaten kurulmuş bir aktarıcı bağlantısının, onun yerine kullanılmadan önce doğrudan WebRTC bağlantısını ne kadar beklediğidir. Yavaş bir doğrudan bağlantıya daha fazla süre tanımak için artırın; doğrudan bağlantının kurulamadığı ağlarda aktarıcıya daha erken geçmek için azaltın. Varsayılan 2.5 saniye için boş bırakın."),
("To start a voice call, enable \"Audio capture\" on the \"Share screen\" page.", "Sesli arama başlatmak için \"Ekranı Paylaş\" sayfasındaki \"Ses yakalama\" seçeneğini açın."),
("Keyboard shortcuts", "Klavye kısayolları"),
("Configure shortcuts...", "Kısayolları yapılandır..."),
("Enable keyboard shortcuts in remote session", "Uzak oturumda klavye kısayollarını etkinleştir"),
("shortcut-page-description", "Aşağıdaki her oturum eylemine bir tuş birleşimi atayın. Her birleşim en az bir değiştirici tuş içermelidir."),
("shortcut-passthrough-tip", "Açıkken, atanan tüm tuş birleşimleri uzak cihaza iletilir. Bir kısayol uzak cihazda kullanmanız gereken bir işlevle çakıştığında yararlıdır."),
("Pass-through to remote", "Tuş birleşimlerini uzak cihaza ilet"),
("Reset to defaults", "Varsayılanlara sıfırla"),
("shortcut-reset-confirm-tip", "Mevcut tüm kısayol atamaları varsayılan atamalarla değiştirilecek. Devam edilsin mi?"),
("Monitor", "Ekran"),
("Keyboard", "Klavye"),
("Toggle fullscreen", "Tam ekran modunu aç/kapat"),
("Switch to next display", "Sonraki ekrana geç"),
("Switch to previous display", "Önceki ekrana geç"),
("Switch to next tab", "Sonraki sekmeye geç"),
("Switch to previous tab", "Önceki sekmeye geç"),
("Toggle session recording", "Oturum kaydını başlat/durdur"),
("Close tab", "Sekmeyi kapat"),
("Toggle toolbar", "Araç çubuğunu göster/gizle"),
("Toggle input source", "Giriş kaynağını değiştir"),
("Edit", "Düzenle"),
("Save", "Kaydet"),
("Set shortcut", "Kısayol ata"),
("shortcut-recording-instruction", "Kullanmak istediğiniz tuş birleşimine basın."),
("shortcut-recording-press-keys-tip", "Bir tuş birleşimine basın..."),
("shortcut-must-include-modifiers", "En az bir değiştirici tuş içermelidir: {}"),
("shortcut-already-bound-to", "Zaten atandığı eylem:"),
("Replace", "Değiştir"),
("Valid", "Geçerli"),
("shortcut-mobile-physical-keyboard-tip", "Kısayol kaydetmek için fiziksel klavye gerekir. Sanal klavyeler desteklenmez."),
("shortcut-key-not-supported", "\"{}\" kısayol olarak kullanılamaz."),
("On", "Açık"),
("Off", "Kapalı"),
("api_server_connection_tip", "Özel sunucunuz şifrelenmemiş HTTP kullanıyor. HTTPS'yi etkinleştirmesi için yöneticinize başvurun."),
("api_server_empty_tip", "API sunucusu alanı boş bırakıldığında özel sunucunuz varsayılan olarak HTTP kullanır. HTTPS'yi etkinleştirmesi için yöneticinize başvurun."),
("Keyboard shortcuts", ""),
("Configure shortcuts...", ""),
("Enable keyboard shortcuts in remote session", ""),
("shortcut-page-description", ""),
("shortcut-passthrough-tip", ""),
("Pass-through to remote", ""),
("Reset to defaults", ""),
("shortcut-reset-confirm-tip", ""),
("Monitor", ""),
("Keyboard", ""),
("Toggle fullscreen", ""),
("Switch to next display", ""),
("Switch to previous display", ""),
("Switch to next tab", ""),
("Switch to previous tab", ""),
("Toggle session recording", ""),
("Close tab", ""),
("Toggle toolbar", ""),
("Toggle input source", ""),
("Edit", ""),
("Save", ""),
("Set shortcut", ""),
("shortcut-recording-instruction", ""),
("shortcut-recording-press-keys-tip", ""),
("shortcut-must-include-modifiers", ""),
("shortcut-already-bound-to", ""),
("Replace", ""),
("Valid", ""),
("shortcut-mobile-physical-keyboard-tip", ""),
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+1 -5
View File
@@ -351,10 +351,7 @@ fn ui_parent(
let last_line = buf.lines().last().unwrap_or(&buf).trim().to_string();
log::info!("read from child: {}", buf);
// sudo-rs's notice for a rejected password, not an error: it asks again.
if (last_line.starts_with("sudo:") || last_line.starts_with("su:"))
&& last_line != "sudo: Authentication failed, try again."
{
if last_line.starts_with("sudo:") || last_line.starts_with("su:") {
if let Err(e) = tx_to_ui.send(Message::ErrorDialog(last_line)) {
log::error!("Channel error: {e:?}");
kill_child(child);
@@ -422,7 +419,6 @@ fn ui_parent(
if !last_line.is_empty() && initial_password.is_some() {
log::error!("received not empty line: {last_line}, clear initial password");
initial_password = None;
first = true;
}
}
}
+3 -90
View File
@@ -1322,12 +1322,7 @@ fn get_cm() -> bool {
}
pub fn is_login_wayland() -> bool {
// Debian's gdm3 reads /etc/gdm3/daemon.conf instead of custom.conf.
let files = [
"/etc/gdm3/custom.conf",
"/etc/gdm/custom.conf",
"/etc/gdm3/daemon.conf",
];
let files = ["/etc/gdm3/custom.conf", "/etc/gdm/custom.conf"];
match (
Regex::new(r"# *WaylandEnable *= *false"),
Regex::new(r"WaylandEnable *= *true"),
@@ -1424,17 +1419,7 @@ pub fn is_prelogin() -> bool {
}
let name = get_active_username();
if let Ok(res) = run_cmds(&format!("getent passwd {}", name)) {
return res.lines().any(|entry| {
let shell = entry.trim().rsplit(':').next().unwrap_or_default();
matches!(
shell,
"/bin/false"
| "/usr/bin/false"
| "/usr/sbin/nologin"
| "/sbin/nologin"
| "/usr/bin/nologin"
)
});
return res.contains("/bin/false") || res.contains("/usr/sbin/nologin");
}
false
}
@@ -1550,9 +1535,6 @@ where
}
pub fn get_pa_monitor() -> String {
if let Some(monitor) = get_default_pa_monitor() {
return monitor;
}
get_pa_sources()
.drain(..)
.map(|x| x.0)
@@ -1561,49 +1543,6 @@ pub fn get_pa_monitor() -> String {
.unwrap_or("".to_owned())
}
// The first monitor in the source list can belong to an output the desktop does not play to.
fn get_default_pa_monitor() -> Option<String> {
use pulsectl::controllers::*;
// The audio service retries about every second while PulseAudio is unavailable.
const LOG_INTERVAL: std::time::Duration = std::time::Duration::from_secs(60);
let mut handler = SinkController::create()
.map_err(|err| {
hbb_common::throttled_log!(
LOG_INTERVAL,
warn,
"Failed to create SinkController: {:?}",
err
)
})
.ok()?;
let sink = handler
.get_server_info()
.map_err(|err| {
hbb_common::throttled_log!(
LOG_INTERVAL,
warn,
"Failed to get the PulseAudio server info: {:?}",
err
)
})
.ok()?
.default_sink_name?;
handler
.get_device_by_name(&sink)
.map_err(|err| {
hbb_common::throttled_log!(
LOG_INTERVAL,
warn,
"Failed to get the default sink {}: {:?}",
sink,
err
)
})
.ok()?
.monitor_name
.filter(|name| !name.is_empty())
}
pub fn get_pa_source_name(desc: &str) -> String {
get_pa_sources()
.drain(..)
@@ -2001,12 +1940,8 @@ fn get_xrandr_conn_pat(name: &str) -> String {
)
}
// The mode lines below an output. A mode name can have a suffix after its size, like the "i" of
// "1920x1080i", so a TV's interlaced mode does not end the list.
const XRANDR_MODES_PAT: &str = r"(?P<resolutions>(\s*\d+x\d+\S*\s+\d+.*\n)+)";
pub fn resolutions(name: &str) -> Vec<Resolution> {
let resolutions_pat = XRANDR_MODES_PAT;
let resolutions_pat = r"(?P<resolutions>(\s*\d+x\d+\s+\d+.*\n)+)";
let connected_pat = get_xrandr_conn_pat(name);
let mut v = vec![];
if let Ok(re) = Regex::new(&format!("{}{}", connected_pat, resolutions_pat)) {
@@ -2100,28 +2035,6 @@ DP-1 connected 2560x1440+1920+0 (normal left inverted right x axis y axis) 597mm
let caps = re.captures(xrandr_output).unwrap();
assert_eq!(get_width_height_from_captures(&caps), Some((2560, 1440)));
}
#[test]
fn interlaced_mode_does_not_end_the_mode_list() {
let xrandr_output =
"Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 16384 x 16384
HDMI-0 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 1600mm x 900mm
1920x1080 60.00*+ 59.94 50.00
1920x1080i 60.00 59.94 50.00
1280x720 60.00 59.94 50.00
640x480 75.00 59.94
DP-0 disconnected (normal left inverted right x axis y axis)
";
let re = Regex::new(&format!(
"{}{}",
get_xrandr_conn_pat("HDMI-0"),
XRANDR_MODES_PAT
))
.unwrap();
let caps = re.captures(xrandr_output).unwrap();
assert!(caps["resolutions"].contains(" 1280x720 "));
assert!(caps["resolutions"].contains(" 640x480 "));
}
}
pub fn change_resolution_directly(name: &str, width: usize, height: usize) -> ResultType<()> {
+2 -2
View File
@@ -497,8 +497,8 @@ impl<T: InvokeUiSession> Session<T> {
self.send(Data::Message(msg));
}
if value != "custom" {
let custom_fps = *self.lc.read().unwrap().custom_fps.lock().unwrap();
if custom_fps.unwrap_or(30) != 30 {
let last_auto_fps = self.lc.read().unwrap().last_auto_fps;
if last_auto_fps.unwrap_or(usize::MAX) >= 30 {
// non custom quality use 30 fps
let msg = self.lc.write().unwrap().set_custom_fps(30, false);
self.send(Data::Message(msg));