Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions windSend-rs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions windSend-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ disable-systray-support = []
log = "0.4"
aes = "0.8.3"
hex = "0.4.3"
tokio = { version = "1.44", features = ["full"] }
tokio = { version = "1.45", features = ["full"] }
# x25519 依赖rand v0.8
rand = "0.8"
x25519-dalek = "2.0"
Expand All @@ -42,14 +42,14 @@ tracing-subscriber = { version = "0.3", features = [
"local-time",
] }
tracing-appender = "0.2"
sha2 = "0.10.8"
sha2 = "0.10.9"
anyhow = "1.0"
cbc = "0.1.2"
cipher = "0.4"
chrono = "0.4.31"
chrono = "0.4.41"
subslice = "0.2.3"
regex = "1.11"
arboard = { version = "3.5", features = [
arboard = { version = "3.6", features = [
"core-graphics",
"image",
"image-data",
Expand Down Expand Up @@ -91,8 +91,8 @@ urlencoding = "2.1.3"
openssl = { version = "*", features = ["vendored"] }

[target.'cfg(not(all(target_os = "linux", target_env = "musl")))'.dependencies]
tao = "0.33"
tray-icon = "0.20"
tao = "0.34"
tray-icon = "0.21"
reqwest = { version = "0.12", features = ["multipart", "cookies"] }
# rfd 0.14.0 在ubuntu上编译失败
rfd = "0.15"
Expand All @@ -106,13 +106,13 @@ win-toast-notify = "0.1.6"
notify-rust = "4.11"

[target.'cfg(target_os = "macos")'.dependencies]
cocoa = "0.26"
winit = "0.30.0"
cocoa = "0.26.1"
winit = "0.30.11"
objc = "0.2.7"

[build-dependencies]
windres = "*"


[dev-dependencies]
tao = "0.33"
tao = "0.34"
18 changes: 9 additions & 9 deletions windSend-rs/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ impl Config {
pub fn save(&self) -> Result<(), String> {
self.empty_check()?;
let file = std::fs::File::create(&*CONFIG_FILE_PATH)
.map_err(|err| format!("create config file error: {}", err))?;
.map_err(|err| format!("create config file error: {err}"))?;
serde_yaml::to_writer(file, self)
.map_err(|err| format!("write config file error: {}", err))?;
.map_err(|err| format!("write config file error: {err}"))?;
Ok(())
}
pub fn save_and_set(&self) -> Result<(), String> {
Expand All @@ -189,10 +189,10 @@ impl Config {
#[cfg(not(all(target_os = "linux", feature = "disable-systray-support")))]
if self.auto_start {
if let Err(e) = START_HELPER.set_auto_start() {
return Err(format!("set_auto_start error: {}", e));
return Err(format!("set_auto_start error: {e}"));
}
} else if let Err(e) = START_HELPER.unset_auto_start() {
return Err(format!("unset_auto_start error: {}", e));
return Err(format!("unset_auto_start error: {e}"));
}

crate::language::LANGUAGE_MANAGER
Expand Down Expand Up @@ -245,26 +245,26 @@ fn init_global_config() -> Config {
if let Some(parent_dir) = CONFIG_FILE_PATH.parent() {
if !parent_dir.exists() {
if let Err(err) = std::fs::create_dir_all(parent_dir) {
panic!("Failed to create config directory: {}", err);
panic!("Failed to create config directory: {err}");
}
}
}

if !CONFIG_FILE_PATH.exists() {
let cnf = Config::generate_default();
if let Err(err) = cnf.save_and_set() {
panic!("init_global_config error: {}", err);
panic!("init_global_config error: {err}");
}
return cnf;
}
let file = std::fs::File::open(&*CONFIG_FILE_PATH).unwrap();
let cnf = serde_yaml::from_reader(file);
if let Err(err) = cnf {
panic!("deserialize config file error: {}", err);
panic!("deserialize config file error: {err}");
}
let cnf: Config = cnf.unwrap();
if let Err(err) = cnf.set() {
panic!("init_global_config error: {}", err);
panic!("init_global_config error: {err}");
}

if cnf.allow_to_be_searched_once {
Expand Down Expand Up @@ -362,7 +362,7 @@ fn init_tls_config() {
{
let result = utils::tls::generate_ca_and_signed_certificate_pair();
if let Err(err) = result {
panic!("init_tls_config error: {}", err);
panic!("init_tls_config error: {err}");
}
let ([cert_pem, priv_pem], [ca_cert_pem, ca_key_pem]) = result.unwrap();
std::fs::write(cert_path, cert_pem).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions windSend-rs/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,13 +551,13 @@ impl FileReceiveSessionManager {
save_path
);
if failure_count > 0 {
msg = format!("{}\n{} files failed to save", msg, failure_count);
msg = format!("{msg}\n{failure_count} files failed to save");
}
crate::utils::inform(&msg, &op_info.requested_device_name, Some(save_path));
}
#[cfg(target_os = "windows")]
{
let progress_tag = format!("{}", op_id);
let progress_tag = format!("{op_id}");
let value_string = format!("{}/{} files", success_count, op_info.expected_count);
let _guard = self.notify_lock.lock().unwrap();
let _ = win_toast_notify::WinToastNotify::progress_complete(
Expand Down
2 changes: 1 addition & 1 deletion windSend-rs/src/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl std::str::FromStr for Language {
match s {
s if s.starts_with(&Language::ZH.to_str().to_lowercase()) => Ok(Language::ZH),
s if s.starts_with(&Language::EN.to_str().to_lowercase()) => Ok(Language::EN),
_ => Err(format!("unknown language: {}", s)),
_ => Err(format!("unknown language: {s}")),
}
}
}
Expand Down
9 changes: 4 additions & 5 deletions windSend-rs/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,23 @@ fn init() {
fn panic_hook(info: &std::panic::PanicHookInfo) {
error!("panic: {}", info);
let backtrace = backtrace::Backtrace::new();
let panic_message = format!("Panic: {}\n{:?}", info, info);
let panic_log_message = format!("{}\n\nBacktrace:\n{:?}", panic_message, backtrace);
let panic_message = format!("Panic: {info}\n{info:?}");
let panic_log_message = format!("{panic_message}\n\nBacktrace:\n{backtrace:?}");
if let Ok(mut f) = std::fs::OpenOptions::new()
.append(true)
.create(true)
.open(std::path::Path::new(&*config::DEFAULT_LOG_DIR).join("panic.log"))
{
use std::io::Write;
let _ = writeln!(f, "{}", panic_log_message);
let _ = writeln!(f, "{panic_log_message}");
}
#[cfg(not(feature = "disable-systray-support"))]
{
use rfd::{MessageDialog, MessageLevel::Error};
_ = MessageDialog::new()
.set_title("WindSend-S-Rust")
.set_description(format!(
"WindSend-S-Rust has crashed. Please check the log file for more information.\n\n{}",
panic_message
"WindSend-S-Rust has crashed. Please check the log file for more information.\n\n{panic_message}",
))
.set_level(Error)
.show();
Expand Down
2 changes: 1 addition & 1 deletion windSend-rs/src/relay/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl TryFrom<i32> for StatusCode {
-1 => Ok(StatusCode::Success),
1 => Ok(StatusCode::AuthFailed),
2 => Ok(StatusCode::KdfSaltMismatch),
_ => Err(format!("Invalid StatusCode value: {}", value)),
_ => Err(format!("Invalid StatusCode value: {value}")),
}
}
}
Expand Down
Loading