fix(proxy): add robust system proxy fallback and log redaction

- Fallback to reading Windows Registry for ProxyServer if sysproxy crate fails parsing.
- Fallback to reading HTTP_PROXY and related environment variables.
- Redact user home directory in tauri_plugin_log to protect privacy.
- Improves yt-dlp compatibility for domains blocked by local ISPs.

Resolves #5
This commit is contained in:
NimBold
2026-07-05 20:31:34 +03:30
parent 757e313f71
commit 3da73c623f
2 changed files with 107 additions and 1 deletions
+24
View File
@@ -5303,6 +5303,30 @@ pub fn run() {
.max_file_size(10_000_000)
.rotation_strategy(tauri_plugin_log::RotationStrategy::KeepSome(3))
.timezone_strategy(tauri_plugin_log::TimezoneStrategy::UseLocal)
.format({
let home_dir = std::env::var("USERPROFILE").or_else(|_| std::env::var("HOME")).unwrap_or_default();
let home_dir = if home_dir.len() > 3 { home_dir } else { String::new() };
let escaped_home_dir = home_dir.replace("\\", "\\\\");
move |out, message, record| {
let msg = message.to_string();
let redacted = if !home_dir.is_empty() {
let mut s = msg.replace(&home_dir, "<HOME>");
if !escaped_home_dir.is_empty() && escaped_home_dir != home_dir {
s = s.replace(&escaped_home_dir, "<HOME>");
}
s
} else {
msg
};
out.finish(format_args!(
"[{}][{}][{}] {}",
chrono::Local::now().format("%Y-%m-%d][%H:%M:%S"),
record.level(),
record.target(),
redacted
))
}
})
.build(),
)
.plugin(tauri_plugin_dialog::init())