commit
6157889bb0
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -2623,6 +2623,7 @@ dependencies = [
|
|||||||
"serde_json 1.0.89",
|
"serde_json 1.0.89",
|
||||||
"socket2 0.3.19",
|
"socket2 0.3.19",
|
||||||
"sodiumoxide",
|
"sodiumoxide",
|
||||||
|
"sysinfo",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-socks",
|
"tokio-socks",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
@ -4887,7 +4888,6 @@ dependencies = [
|
|||||||
"shutdown_hooks",
|
"shutdown_hooks",
|
||||||
"simple_rc",
|
"simple_rc",
|
||||||
"sys-locale",
|
"sys-locale",
|
||||||
"sysinfo",
|
|
||||||
"system_shutdown",
|
"system_shutdown",
|
||||||
"tao",
|
"tao",
|
||||||
"tray-icon",
|
"tray-icon",
|
||||||
|
@ -55,7 +55,6 @@ uuid = { version = "1.0", features = ["v4"] }
|
|||||||
clap = "3.0"
|
clap = "3.0"
|
||||||
rpassword = "7.0"
|
rpassword = "7.0"
|
||||||
base64 = "0.13"
|
base64 = "0.13"
|
||||||
sysinfo = "0.24"
|
|
||||||
num_cpus = "1.13"
|
num_cpus = "1.13"
|
||||||
bytes = { version = "1.2", features = ["serde"] }
|
bytes = { version = "1.2", features = ["serde"] }
|
||||||
default-net = "0.12.0"
|
default-net = "0.12.0"
|
||||||
|
@ -43,11 +43,8 @@ class _AddressBookState extends State<AddressBook> {
|
|||||||
return Obx(() {
|
return Obx(() {
|
||||||
if (gFFI.userModel.userName.value.isEmpty) {
|
if (gFFI.userModel.userName.value.isEmpty) {
|
||||||
return Center(
|
return Center(
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: loginDialog,
|
onPressed: loginDialog, child: Text(translate("Login"))));
|
||||||
child: Text(translate("Login"))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
if (gFFI.abModel.abLoading.value) {
|
if (gFFI.abModel.abLoading.value) {
|
||||||
return const Center(
|
return const Center(
|
||||||
@ -153,13 +150,13 @@ class _AddressBookState extends State<AddressBook> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(translate('Tags')),
|
Text(translate('Tags')),
|
||||||
GestureDetector(
|
Listener(
|
||||||
onTapDown: (e) {
|
onPointerDown: (e) {
|
||||||
final x = e.globalPosition.dx;
|
final x = e.position.dx;
|
||||||
final y = e.globalPosition.dy;
|
final y = e.position.dy;
|
||||||
menuPos = RelativeRect.fromLTRB(x, y, x, y);
|
menuPos = RelativeRect.fromLTRB(x, y, x, y);
|
||||||
},
|
},
|
||||||
onTap: () => _showMenu(menuPos),
|
onPointerUp: (_) => _showMenu(menuPos),
|
||||||
child: ActionMore()),
|
child: ActionMore()),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@ -33,6 +33,7 @@ tokio-socks = { git = "https://github.com/open-trade/tokio-socks" }
|
|||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
backtrace = "0.3"
|
backtrace = "0.3"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
|
sysinfo = "0.24"
|
||||||
|
|
||||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||||
mac_address = "1.1"
|
mac_address = "1.1"
|
||||||
|
@ -42,6 +42,7 @@ pub use chrono;
|
|||||||
pub use libc;
|
pub use libc;
|
||||||
pub use directories_next;
|
pub use directories_next;
|
||||||
pub mod keyboard;
|
pub mod keyboard;
|
||||||
|
pub use sysinfo;
|
||||||
|
|
||||||
#[cfg(feature = "quic")]
|
#[cfg(feature = "quic")]
|
||||||
pub type Stream = quic::Connection;
|
pub type Stream = quic::Connection;
|
||||||
|
@ -317,16 +317,30 @@ pub fn check_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn check_config_process(force_reset: bool) {
|
pub fn check_config_process(force_reset: bool) {
|
||||||
if force_reset {
|
use hbb_common::sysinfo::{ProcessExt, System, SystemExt};
|
||||||
HwCodecConfig::remove();
|
|
||||||
}
|
std::thread::spawn(move || {
|
||||||
if let Ok(exe) = std::env::current_exe() {
|
if force_reset {
|
||||||
std::thread::spawn(move || {
|
HwCodecConfig::remove();
|
||||||
std::process::Command::new(exe)
|
}
|
||||||
.arg("--check-hwcodec-config")
|
if let Ok(exe) = std::env::current_exe() {
|
||||||
.status()
|
if let Some(file_name) = exe.file_name().to_owned() {
|
||||||
.ok();
|
let s = System::new_all();
|
||||||
HwCodecConfig::refresh();
|
let arg = "--check-hwcodec-config";
|
||||||
});
|
for process in s.processes_by_name(&file_name.to_string_lossy().to_string()) {
|
||||||
};
|
if process.cmd().iter().any(|cmd| cmd.contains(arg)) {
|
||||||
|
log::warn!("already have process {}", arg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Ok(mut child) = std::process::Command::new(exe).arg(arg).spawn() {
|
||||||
|
let second = 3;
|
||||||
|
std::thread::sleep(std::time::Duration::from_secs(second));
|
||||||
|
// kill: Different platforms have different results
|
||||||
|
child.kill().ok();
|
||||||
|
HwCodecConfig::refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -549,7 +549,7 @@ async fn check_pid(postfix: &str) {
|
|||||||
file.read_to_string(&mut content).ok();
|
file.read_to_string(&mut content).ok();
|
||||||
let pid = content.parse::<i32>().unwrap_or(0);
|
let pid = content.parse::<i32>().unwrap_or(0);
|
||||||
if pid > 0 {
|
if pid > 0 {
|
||||||
use sysinfo::{ProcessExt, System, SystemExt};
|
use hbb_common::sysinfo::{ProcessExt, System, SystemExt};
|
||||||
let mut sys = System::new();
|
let mut sys = System::new();
|
||||||
sys.refresh_processes();
|
sys.refresh_processes();
|
||||||
if let Some(p) = sys.process(pid.into()) {
|
if let Some(p) = sys.process(pid.into()) {
|
||||||
|
@ -558,7 +558,7 @@ pub fn hide_dock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn check_main_window() -> bool {
|
fn check_main_window() -> bool {
|
||||||
use sysinfo::{ProcessExt, System, SystemExt};
|
use hbb_common::sysinfo::{ProcessExt, System, SystemExt};
|
||||||
let mut sys = System::new();
|
let mut sys = System::new();
|
||||||
sys.refresh_processes();
|
sys.refresh_processes();
|
||||||
let app = format!("/Applications/{}.app", crate::get_app_name());
|
let app = format!("/Applications/{}.app", crate::get_app_name());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user