Merge branch 'master' into master

This commit is contained in:
yuluo
2024-04-23 03:03:45 +08:00
committed by GitHub
157 changed files with 6056 additions and 2087 deletions

View File

@@ -409,9 +409,7 @@ fn patch(path: PathBuf) -> PathBuf {
if let Ok(user) = crate::platform::linux::run_cmds_trim_newline("whoami") {
if user != "root" {
let cmd = format!("getent passwd '{}' | awk -F':' '{{print $6}}'", user);
if let Ok(output) =
crate::platform::linux::run_cmds_trim_newline(&cmd)
{
if let Ok(output) = crate::platform::linux::run_cmds_trim_newline(&cmd) {
return output.into();
}
return format!("/home/{user}").into();
@@ -505,7 +503,7 @@ impl Config {
fn store_<T: serde::Serialize>(config: &T, suffix: &str) {
let file = Self::file_(suffix);
if let Err(err) = store_path(file, config) {
log::error!("Failed to store config: {}", err);
log::error!("Failed to store {suffix} config: {err}");
}
}
@@ -1495,8 +1493,10 @@ impl LanPeers {
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
pub struct HwCodecConfig {
#[serde(default, deserialize_with = "deserialize_hashmap_string_string")]
pub options: HashMap<String, String>,
#[serde(default, deserialize_with = "deserialize_string")]
pub ram: String,
#[serde(default, deserialize_with = "deserialize_string")]
pub vram: String,
}
impl HwCodecConfig {
@@ -1511,25 +1511,17 @@ impl HwCodecConfig {
pub fn clear() {
HwCodecConfig::default().store();
}
}
#[derive(Debug, Default, Serialize, Deserialize, Clone)]
pub struct GpucodecConfig {
#[serde(default, deserialize_with = "deserialize_string")]
pub available: String,
}
impl GpucodecConfig {
pub fn load() -> GpucodecConfig {
Config::load_::<GpucodecConfig>("_gpucodec")
pub fn clear_ram() {
let mut c = Self::load();
c.ram = Default::default();
c.store();
}
pub fn store(&self) {
Config::store_(self, "_gpucodec");
}
pub fn clear() {
GpucodecConfig::default().store();
pub fn clear_vram() {
let mut c = Self::load();
c.vram = Default::default();
c.store();
}
}
@@ -1569,6 +1561,7 @@ impl UserDefaultConfig {
}
"custom_image_quality" => self.get_double_string(key, 50.0, 10.0, 0xFFF as f64),
"custom-fps" => self.get_double_string(key, 30.0, 5.0, 120.0),
"enable_file_transfer" => self.get_string(key, "Y", vec![""]),
_ => self
.get_after(key)
.map(|v| v.to_string())

View File

@@ -47,10 +47,13 @@ pub mod keyboard;
pub use dlopen;
#[cfg(not(any(target_os = "android", target_os = "ios")))]
pub use machine_uid;
pub use serde_derive;
pub use serde_json;
pub use sysinfo;
pub use toml;
pub use uuid;
pub use base64;
pub use thiserror;
#[cfg(feature = "quic")]
pub type Stream = quic::Connection;