Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

style: format rust codebase with cargo fmt

IGECT70e434b814c8
diff --git a/src-tauri/plugins/courses/src/lib.rs b/src-tauri/plugins/courses/src/lib.rs
index b4106397..c66d94e7 100644
--- a/src-tauri/plugins/courses/src/lib.rs
+++ b/src-tauri/plugins/courses/src/lib.rs
@@ -173,11 +173,9 @@ impl OmnigetPlugin for CoursesPlugin {
} else {
return Err("missing 'cookie_json'".to_string());
};
- let res = commands::udemy_auth::udemy_login_cookies(
- wrap_state(&state),
- cookie_json,
- )
- .await?;
+ let res =
+ commands::udemy_auth::udemy_login_cookies(wrap_state(&state), cookie_json)
+ .await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"thinkific_login" => {
@@ -192,12 +190,9 @@ impl OmnigetPlugin for CoursesPlugin {
.ok_or("missing 'site_url'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::thinkific::thinkific_login(
- wrap_state(&state),
- cookies,
- site_url,
- )
- .await?;
+ let res =
+ commands::thinkific::thinkific_login(wrap_state(&state), cookies, site_url)
+ .await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"pluralsight_login_cookies" => {
@@ -229,11 +224,9 @@ impl OmnigetPlugin for CoursesPlugin {
args.get("cookies").cloned().ok_or("missing 'cookies'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::grancursos::grancursos_login_cookies(
- wrap_state(&state),
- cookies,
- )
- .await?;
+ let res =
+ commands::grancursos::grancursos_login_cookies(wrap_state(&state), cookies)
+ .await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"rocketseat_login_token" => {
@@ -241,11 +234,9 @@ impl OmnigetPlugin for CoursesPlugin {
args.get("token").cloned().ok_or("missing 'token'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::rocketseat::rocketseat_login_token(
- wrap_state(&state),
- token,
- )
- .await?;
+ let res =
+ commands::rocketseat::rocketseat_login_token(wrap_state(&state), token)
+ .await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"teachable_login_token" => {
@@ -253,11 +244,8 @@ impl OmnigetPlugin for CoursesPlugin {
args.get("token").cloned().ok_or("missing 'token'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::teachable::teachable_login_token(
- wrap_state(&state),
- token,
- )
- .await?;
+ let res = commands::teachable::teachable_login_token(wrap_state(&state), token)
+ .await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"kajabi_login_token" => {
@@ -265,11 +253,8 @@ impl OmnigetPlugin for CoursesPlugin {
args.get("token").cloned().ok_or("missing 'token'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::kajabi::kajabi_login_token(
- wrap_state(&state),
- token,
- )
- .await?;
+ let res =
+ commands::kajabi::kajabi_login_token(wrap_state(&state), token).await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"skool_login" => {
@@ -281,12 +266,8 @@ impl OmnigetPlugin for CoursesPlugin {
args.get("password").cloned().ok_or("missing 'password'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::skool::skool_login(
- wrap_state(&state),
- email,
- password,
- )
- .await?;
+ let res =
+ commands::skool::skool_login(wrap_state(&state), email, password).await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"skool_login_token" => {
@@ -294,11 +275,7 @@ impl OmnigetPlugin for CoursesPlugin {
args.get("token").cloned().ok_or("missing 'token'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::skool::skool_login_token(
- wrap_state(&state),
- token,
- )
- .await?;
+ let res = commands::skool::skool_login_token(wrap_state(&state), token).await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"kiwify_login" => {
@@ -310,12 +287,8 @@ impl OmnigetPlugin for CoursesPlugin {
args.get("password").cloned().ok_or("missing 'password'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::kiwify::kiwify_login(
- wrap_state(&state),
- email,
- password,
- )
- .await?;
+ let res =
+ commands::kiwify::kiwify_login(wrap_state(&state), email, password).await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"kiwify_login_token" => {
@@ -323,11 +296,8 @@ impl OmnigetPlugin for CoursesPlugin {
args.get("token").cloned().ok_or("missing 'token'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::kiwify::kiwify_login_token(
- wrap_state(&state),
- token,
- )
- .await?;
+ let res =
+ commands::kiwify::kiwify_login_token(wrap_state(&state), token).await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"gumroad_login" => {
@@ -339,12 +309,8 @@ impl OmnigetPlugin for CoursesPlugin {
args.get("password").cloned().ok_or("missing 'password'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::gumroad::gumroad_login(
- wrap_state(&state),
- email,
- password,
- )
- .await?;
+ let res = commands::gumroad::gumroad_login(wrap_state(&state), email, password)
+ .await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"gumroad_login_token" => {
@@ -352,11 +318,8 @@ impl OmnigetPlugin for CoursesPlugin {
args.get("token").cloned().ok_or("missing 'token'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::gumroad::gumroad_login_token(
- wrap_state(&state),
- token,
- )
- .await?;
+ let res =
+ commands::gumroad::gumroad_login_token(wrap_state(&state), token).await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"greenn_login_token" => {
@@ -364,11 +327,8 @@ impl OmnigetPlugin for CoursesPlugin {
args.get("token").cloned().ok_or("missing 'token'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::greenn::greenn_login_token(
- wrap_state(&state),
- token,
- )
- .await?;
+ let res =
+ commands::greenn::greenn_login_token(wrap_state(&state), token).await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"caktomembers_login_token" => {
@@ -376,11 +336,9 @@ impl OmnigetPlugin for CoursesPlugin {
args.get("token").cloned().ok_or("missing 'token'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::caktomembers::caktomembers_login_token(
- wrap_state(&state),
- token,
- )
- .await?;
+ let res =
+ commands::caktomembers::caktomembers_login_token(wrap_state(&state), token)
+ .await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"dsa_login_token" => {
@@ -388,11 +346,7 @@ impl OmnigetPlugin for CoursesPlugin {
args.get("token").cloned().ok_or("missing 'token'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::dsa::dsa_login_token(
- wrap_state(&state),
- token,
- )
- .await?;
+ let res = commands::dsa::dsa_login_token(wrap_state(&state), token).await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"entregadigital_login_token" => {
@@ -473,11 +427,8 @@ impl OmnigetPlugin for CoursesPlugin {
args.get("token").cloned().ok_or("missing 'token'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::medcof::medcof_login_token(
- wrap_state(&state),
- token,
- )
- .await?;
+ let res =
+ commands::medcof::medcof_login_token(wrap_state(&state), token).await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"medway_login_token" => {
@@ -485,11 +436,8 @@ impl OmnigetPlugin for CoursesPlugin {
args.get("token").cloned().ok_or("missing 'token'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::medway::medway_login_token(
- wrap_state(&state),
- token,
- )
- .await?;
+ let res =
+ commands::medway::medway_login_token(wrap_state(&state), token).await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"nutror_login_token" => {
@@ -514,11 +462,7 @@ impl OmnigetPlugin for CoursesPlugin {
args.get("token").cloned().ok_or("missing 'token'")?,
)
.map_err(|e| e.to_string())?;
- let res = commands::voomp::voomp_login_token(
- wrap_state(&state),
- token,
- )
- .await?;
+ let res = commands::voomp::voomp_login_token(wrap_state(&state), token).await?;
serde_json::to_value(res).map_err(|e| e.to_string())
}
"areademembros_login_token" => {
diff --git a/src-tauri/plugins/telegram/src/commands/telegram.rs b/src-tauri/plugins/telegram/src/commands/telegram.rs
index 9d81163f..1d2a2fe7 100644
--- a/src-tauri/plugins/telegram/src/commands/telegram.rs
+++ b/src-tauri/plugins/telegram/src/commands/telegram.rs
@@ -153,7 +153,13 @@ pub fn sanitize_folder_name(name: &str) -> String {
let forbidden = ['<', '>', ':', '"', '/', '\\', '|', '?', '*'];
let cleaned: String = name
.chars()
- .map(|c| if forbidden.contains(&c) || c.is_control() { '_' } else { c })
+ .map(|c| {
+ if forbidden.contains(&c) || c.is_control() {
+ '_'
+ } else {
+ c
+ }
+ })
.collect();
let trimmed = cleaned.trim().trim_matches('.').trim();
@@ -164,9 +170,28 @@ pub fn sanitize_folder_name(name: &str) -> String {
let upper = trimmed.to_ascii_uppercase();
let is_reserved = matches!(
upper.as_str(),
- "CON" | "PRN" | "AUX" | "NUL"
- | "COM1" | "COM2" | "COM3" | "COM4" | "COM5" | "COM6" | "COM7" | "COM8" | "COM9"
- | "LPT1" | "LPT2" | "LPT3" | "LPT4" | "LPT5" | "LPT6" | "LPT7" | "LPT8" | "LPT9"
+ "CON"
+ | "PRN"
+ | "AUX"
+ | "NUL"
+ | "COM1"
+ | "COM2"
+ | "COM3"
+ | "COM4"
+ | "COM5"
+ | "COM6"
+ | "COM7"
+ | "COM8"
+ | "COM9"
+ | "LPT1"
+ | "LPT2"
+ | "LPT3"
+ | "LPT4"
+ | "LPT5"
+ | "LPT6"
+ | "LPT7"
+ | "LPT8"
+ | "LPT9"
);
if is_reserved {
@@ -178,7 +203,10 @@ pub fn sanitize_folder_name(name: &str) -> String {
}
}
-pub fn resolve_telegram_download_dir(base_dir: &str, chat_title: Option<&str>) -> std::path::PathBuf {
+pub fn resolve_telegram_download_dir(
+ base_dir: &str,
+ chat_title: Option<&str>,
+) -> std::path::PathBuf {
let base = std::path::PathBuf::from(base_dir);
let is_already_omnigram = base
.file_name()
@@ -243,7 +271,11 @@ pub async fn telegram_download_media(
tokio::spawn(async move {
let target_dir = resolve_telegram_download_dir(&output_dir, chat_title.as_deref());
if let Err(e) = tokio::fs::create_dir_all(&target_dir).await {
- tracing::warn!("[tg-cmd] Failed to create target directory {:?}: {}", target_dir, e);
+ tracing::warn!(
+ "[tg-cmd] Failed to create target directory {:?}: {}",
+ target_dir,
+ e
+ );
}
let output_path = target_dir.join(&file_name_clone);
@@ -404,7 +436,11 @@ pub async fn telegram_download_batch(
let target_dir = resolve_telegram_download_dir(&output_dir, Some(&chat_title));
if let Err(e) = tokio::fs::create_dir_all(&target_dir).await {
- tracing::warn!("[tg-cmd] Failed to create target directory {:?}: {}", target_dir, e);
+ tracing::warn!(
+ "[tg-cmd] Failed to create target directory {:?}: {}",
+ target_dir,
+ e
+ );
}
let target_dir_str = target_dir.to_string_lossy().to_string();
diff --git a/src-tauri/plugins/telegram/src/lib.rs b/src-tauri/plugins/telegram/src/lib.rs
index 0b0c4ae7..99674544 100644
--- a/src-tauri/plugins/telegram/src/lib.rs
+++ b/src-tauri/plugins/telegram/src/lib.rs
@@ -334,13 +334,11 @@ impl OmnigetPlugin for TelegramPlugin {
commands::telegram::telegram_clear_thumbnail_cache().await?;
Ok(serde_json::Value::Null)
}
- "telegram_perf_get" => {
- Ok(serde_json::json!({
- "max_threads": 8,
- "max_part_size_kb": 512,
- "buckets": []
- }))
- }
+ "telegram_perf_get" => Ok(serde_json::json!({
+ "max_threads": 8,
+ "max_part_size_kb": 512,
+ "buckets": []
+ })),
"telegram_perf_set" => {
let max_threads: u32 = args
.get("maxThreads")
@@ -349,15 +347,13 @@ impl OmnigetPlugin for TelegramPlugin {
.unwrap_or(8);
Ok(serde_json::json!({ "max_threads": max_threads }))
}
- "telegram_bandwidth_stats" => {
- Ok(serde_json::json!({
- "used_today_bytes": 0,
- "total_used_bytes": 0,
- "quota_bytes": 0,
- "date": "",
- "percentage": 0.0
- }))
- }
+ "telegram_bandwidth_stats" => Ok(serde_json::json!({
+ "used_today_bytes": 0,
+ "total_used_bytes": 0,
+ "quota_bytes": 0,
+ "date": "",
+ "percentage": 0.0
+ })),
"telegram_bandwidth_set_quota" => {
let gb: u64 = args
.get("gb")
@@ -368,25 +364,19 @@ impl OmnigetPlugin for TelegramPlugin {
"used_today_bytes": 0
}))
}
- "telegram_bandwidth_reset" => {
- Ok(serde_json::json!({
- "used_today_bytes": 0,
- "date": ""
- }))
- }
- "telegram_sync_state" => {
- Ok(serde_json::json!({
- "enabled": false,
- "interval_min": 30,
- "last_success_at": 0,
- "last_duration_ms": 0,
- "last_updated_count": 0,
- "is_syncing": false
- }))
- }
- "telegram_sync_now" => {
- Ok(serde_json::json!({ "updated": 0 }))
- }
+ "telegram_bandwidth_reset" => Ok(serde_json::json!({
+ "used_today_bytes": 0,
+ "date": ""
+ })),
+ "telegram_sync_state" => Ok(serde_json::json!({
+ "enabled": false,
+ "interval_min": 30,
+ "last_success_at": 0,
+ "last_duration_ms": 0,
+ "last_updated_count": 0,
+ "is_syncing": false
+ })),
+ "telegram_sync_now" => Ok(serde_json::json!({ "updated": 0 })),
"telegram_sync_settings_set" => {
let enabled: bool = args
.get("enabled")
@@ -422,15 +412,11 @@ impl OmnigetPlugin for TelegramPlugin {
"participants_count": null
}))
}
- "telegram_cancel_op" => {
- Ok(serde_json::json!({ "cancelled": true }))
- }
+ "telegram_cancel_op" => Ok(serde_json::json!({ "cancelled": true })),
"telegram_set_mute"
| "telegram_toggle_pin"
| "telegram_set_archived"
- | "telegram_reorder_pinned" => {
- Ok(serde_json::Value::Null)
- }
+ | "telegram_reorder_pinned" => Ok(serde_json::Value::Null),
_ => Err(format!("Unknown command: {}", command)),
}
})
diff --git a/src-tauri/plugins/telegram/src/platforms/telegram/parallel_download.rs b/src-tauri/plugins/telegram/src/platforms/telegram/parallel_download.rs
index 18e915ec..5f5b43ed 100644
--- a/src-tauri/plugins/telegram/src/platforms/telegram/parallel_download.rs
+++ b/src-tauri/plugins/telegram/src/platforms/telegram/parallel_download.rs
@@ -171,7 +171,9 @@ async fn ensure_auth_on_dc(client: &Client, target_dc_id: i32) -> anyhow::Result
},
)
.await
- .map_err(|e| anyhow::anyhow!("ImportAuthorization on DC {}: {}", target_dc_id, e))?;
+ .map_err(|e| {
+ anyhow::anyhow!("ImportAuthorization on DC {}: {}", target_dc_id, e)
+ })?;
let mut copied = auth_copied_dcs().lock().await;
if !copied.contains(&target_dc_id) {
@@ -195,7 +197,11 @@ async fn ensure_auth_on_dc(client: &Client, target_dc_id: i32) -> anyhow::Result
}
Ok(())
} else {
- Err(anyhow::anyhow!("ExportAuthorization to DC {}: {}", target_dc_id, e))
+ Err(anyhow::anyhow!(
+ "ExportAuthorization to DC {}: {}",
+ target_dc_id,
+ e
+ ))
}
}
}