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.

fix: honor system proxy when host is empty, reliable proxy saves, DRM merge errors (#180, #179)

tonhowtf1a0c5103f7b9
diff --git a/src-tauri/omniget-core/src/core/ytdlp.rs b/src-tauri/omniget-core/src/core/ytdlp.rs
index e60201fd..5d6404e1 100644
--- a/src-tauri/omniget-core/src/core/ytdlp.rs
+++ b/src-tauri/omniget-core/src/core/ytdlp.rs
@@ -498,10 +498,10 @@ pub async fn check_ytdlp_update(ytdlp: &Path) -> anyhow::Result<bool> {
}
fn proxy_args() -> Vec<String> {
- vec![
- "--proxy".to_string(),
- crate::core::http_client::proxy_url().unwrap_or_default(),
- ]
+ match crate::core::http_client::proxy_url() {
+ Some(url) => vec!["--proxy".to_string(), url],
+ None => Vec::new(),
+ }
}
fn redacted_proxy_url(url: &str) -> String {
@@ -519,11 +519,11 @@ fn proxy_log_label(proxy_url: Option<&str>) -> String {
None => {
let proxy = crate::core::http_client::get_proxy_snapshot();
if proxy.enabled && proxy.host.trim().is_empty() {
- "proxy=disabled (enabled but host is empty)".to_string()
+ "proxy=system/env fallback (enabled but host is empty)".to_string()
} else if proxy.enabled {
- "proxy=disabled (invalid proxy settings)".to_string()
+ "proxy=system/env fallback (invalid proxy settings)".to_string()
} else {
- "proxy=disabled".to_string()
+ "proxy=none (system/env honored if set)".to_string()
}
}
}
@@ -1328,8 +1328,10 @@ pub async fn get_video_info(
log_hook::emit_log(dl_id, &line);
}
}
- args.push("--proxy".to_string());
- args.push(proxy.unwrap_or_default());
+ if let Some(proxy_url) = proxy {
+ args.push("--proxy".to_string());
+ args.push(proxy_url);
+ }
args.extend(extra_flags.iter().cloned());
args.push(url.to_string());
@@ -3089,6 +3091,11 @@ fn translate_ytdlp_error(stderr: &str) -> anyhow::Error {
"This video requires login. Import cookies for this site in Settings → Cookies, then retry."
);
}
+ if lower.contains("invalid data found when processing input") {
+ return anyhow!(
+ "Downloaded streams are DRM-protected and cannot be merged. This content is not supported."
+ );
+ }
if lower.contains("nsig extraction failed") || lower.contains("nsig") {
return anyhow!("Video extraction failed. Update yt-dlp or try again.");
}
diff --git a/src-tauri/omniget-core/src/models/settings.rs b/src-tauri/omniget-core/src/models/settings.rs
index dce6c2a2..4b4abcb2 100644
--- a/src-tauri/omniget-core/src/models/settings.rs
+++ b/src-tauri/omniget-core/src/models/settings.rs
@@ -330,7 +330,7 @@ impl Default for TelegramSettings {
}
}
-#[derive(Debug, Clone, Serialize, Deserialize, Default)]
+#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ProxySettings {
#[serde(default)]
pub enabled: bool,
@@ -346,6 +346,19 @@ pub struct ProxySettings {
pub password: String,
}
+impl Default for ProxySettings {
+ fn default() -> Self {
+ Self {
+ enabled: false,
+ proxy_type: default_proxy_type(),
+ host: String::new(),
+ port: default_proxy_port(),
+ username: String::new(),
+ password: String::new(),
+ }
+ }
+}
+
fn default_proxy_type() -> String {
"http".into()
}
diff --git a/src-tauri/src/platforms/bilibili/legacy.rs b/src-tauri/src/platforms/bilibili/legacy.rs
index 4a3bcd38..de4c2403 100644
--- a/src-tauri/src/platforms/bilibili/legacy.rs
+++ b/src-tauri/src/platforms/bilibili/legacy.rs
@@ -222,6 +222,8 @@ async fn download_playlist(
ytdlp_path: &std::path::Path,
) -> anyhow::Result<DownloadResult> {
let total = info.available_qualities.len().max(1);
+ let mut succeeded = 0usize;
+ let mut last_error: Option<anyhow::Error> = None;
let mut last_result = DownloadResult {
file_path: opts.output_dir.clone(),
file_size_bytes: 0,
@@ -270,16 +272,24 @@ async fn download_playlist(
.await
{
Ok(result) => {
+ succeeded += 1;
last_result.file_size_bytes += result.file_size_bytes;
last_result.duration_seconds += result.duration_seconds;
last_result.file_path = result.file_path;
}
Err(e) => {
tracing::error!("[bilibili] playlist item {} failed: {}", i + 1, e);
+ last_error = Some(e);
}
}
}
+ if succeeded == 0 {
+ if let Some(e) = last_error {
+ return Err(e);
+ }
+ }
+
let _ = progress.send(ProgressUpdate::percent(100.0)).await;
Ok(last_result)
}
diff --git a/src/components/settings/SettingsNetwork.svelte b/src/components/settings/SettingsNetwork.svelte
index 21ce6e2d..203758a9 100644
--- a/src/components/settings/SettingsNetwork.svelte
+++ b/src/components/settings/SettingsNetwork.svelte
@@ -1,4 +1,5 @@
<script lang="ts">
+ import { onDestroy } from "svelte";
import { t } from "$lib/i18n";
import { getSettings, updateSettings, toggleBool, changeNumber } from "./settings-helpers";
@@ -7,14 +8,50 @@
let proxyHost = $state("");
let proxyUsername = $state("");
let proxyPassword = $state("");
- let proxyTimer: ReturnType<typeof setTimeout> | null = null;
+
+ type ProxyField = "host" | "username" | "password";
+ const proxyTimers: Partial<Record<ProxyField, ReturnType<typeof setTimeout>>> = {};
+ const pendingProxy: Partial<Record<ProxyField, string>> = {};
$effect(() => {
if (settings) {
- proxyHost = settings.proxy?.host ?? "";
- proxyUsername = settings.proxy?.username ?? "";
- proxyPassword = settings.proxy?.password ?? "";
+ if (!("host" in pendingProxy)) proxyHost = settings.proxy?.host ?? "";
+ if (!("username" in pendingProxy)) proxyUsername = settings.proxy?.username ?? "";
+ if (!("password" in pendingProxy)) proxyPassword = settings.proxy?.password ?? "";
+ }
+ });
+
+ function proxyPatch(field: ProxyField, value: string) {
+ if (field === "host") return { proxy: { host: value } };
+ if (field === "username") return { proxy: { username: value } };
+ return { proxy: { password: value } };
+ }
+
+ function flushProxyField(field: ProxyField) {
+ const timer = proxyTimers[field];
+ if (timer) {
+ clearTimeout(timer);
+ delete proxyTimers[field];
}
+ const value = pendingProxy[field];
+ if (value === undefined) return;
+ delete pendingProxy[field];
+ updateSettings(proxyPatch(field, value)).catch(() => {
+ pendingProxy[field] = value;
+ });
+ }
+
+ function queueProxyField(field: ProxyField, value: string) {
+ pendingProxy[field] = value;
+ const timer = proxyTimers[field];
+ if (timer) clearTimeout(timer);
+ proxyTimers[field] = setTimeout(() => flushProxyField(field), 800);
+ }
+
+ onDestroy(() => {
+ flushProxyField("host");
+ flushProxyField("username");
+ flushProxyField("password");
});
async function changeProxyType(e: Event) {
@@ -25,28 +62,19 @@
function handleProxyHost(e: Event) {
const value = (e.target as HTMLInputElement).value;
proxyHost = value;
- if (proxyTimer) clearTimeout(proxyTimer);
- proxyTimer = setTimeout(async () => {
- await updateSettings({ proxy: { host: value } });
- }, 800);
+ queueProxyField("host", value);
}
function handleProxyUsername(e: Event) {
const value = (e.target as HTMLInputElement).value;
proxyUsername = value;
- if (proxyTimer) clearTimeout(proxyTimer);
- proxyTimer = setTimeout(async () => {
- await updateSettings({ proxy: { username: value } });
- }, 800);
+ queueProxyField("username", value);
}
function handleProxyPassword(e: Event) {
const value = (e.target as HTMLInputElement).value;
proxyPassword = value;
- if (proxyTimer) clearTimeout(proxyTimer);
- proxyTimer = setTimeout(async () => {
- await updateSettings({ proxy: { password: value } });
- }, 800);
+ queueProxyField("password", value);
}
</script>
@@ -82,7 +110,7 @@
<div class="divider"></div>
<div class="setting-row">
<span class="setting-label">{$t('settings.proxy.host')}</span>
- <input type="text" class="input-text" value={proxyHost} oninput={handleProxyHost} placeholder="127.0.0.1" spellcheck="false" />
+ <input type="text" class="input-text" value={proxyHost} oninput={handleProxyHost} onchange={() => flushProxyField("host")} placeholder="127.0.0.1" spellcheck="false" />
</div>
<div class="divider"></div>
<div class="setting-row">
@@ -92,12 +120,12 @@
<div class="divider"></div>
<div class="setting-row">
<span class="setting-label">{$t('settings.proxy.username')}</span>
- <input type="text" class="input-text" value={proxyUsername} oninput={handleProxyUsername} placeholder="" spellcheck="false" />
+ <input type="text" class="input-text" value={proxyUsername} oninput={handleProxyUsername} onchange={() => flushProxyField("username")} placeholder="" spellcheck="false" />
</div>
<div class="divider"></div>
<div class="setting-row">
<span class="setting-label">{$t('settings.proxy.password')}</span>
- <input type="password" class="input-text" value={proxyPassword} oninput={handleProxyPassword} placeholder="" />
+ <input type="password" class="input-text" value={proxyPassword} oninput={handleProxyPassword} onchange={() => flushProxyField("password")} placeholder="" />
</div>
{/if}
</div>
diff --git a/src/lib/error-translate.ts b/src/lib/error-translate.ts
index c1745a65..8c27d1ab 100644
--- a/src/lib/error-translate.ts
+++ b/src/lib/error-translate.ts
@@ -39,6 +39,8 @@ const BACKEND_ERROR_MAP: Record<string, string> = {
"errors.extractor_broken",
"Download reported success but the file is missing or empty. Check disk space and antivirus exclusions, then retry.":
"errors.output_missing",
+ "Downloaded streams are DRM-protected and cannot be merged. This content is not supported.":
+ "errors.drm_protected",
"Course platforms can't be downloaded from a URL. Open the Courses page (requires the Courses plugin and a logged-in account).":
"errors.course_platform_url",
};
@@ -79,6 +81,8 @@ export function translateBackendError(
if (lower.includes("tiktok") && lower.includes("blocking")) return t("errors.tiktok_blocked");
if (lower.includes("download reported success but no matching file"))
return t("errors.console_encoding");
+ if (lower.includes("invalid data found when processing input") || lower.includes("drm-protected"))
+ return t("errors.drm_protected");
return stripped || msg;
}
diff --git a/src/lib/i18n/el.json b/src/lib/i18n/el.json
index c0064afd..f29f439f 100644
--- a/src/lib/i18n/el.json
+++ b/src/lib/i18n/el.json
@@ -1279,6 +1279,7 @@
"path_too_long": "Η διαδρομή του φακέλου λήψης είναι πολύ μεγάλη ({{current}}/{{limit}} χαρακτήρες). Επιλέξτε συντομότερο φάκελο.",
"console_encoding": "Console encoding issue (non-UTF-8 locale). Update yt-dlp in Settings → Dependencies, or run \"chcp 65001\" in a terminal and reopen the app.",
"extractor_broken": "The site extractor is broken. Update yt-dlp in Settings → Dependencies, then retry.",
+ "drm_protected": "Οι ροές που κατέβηκαν προστατεύονται από DRM και δεν μπορούν να συγχωνευθούν. Αυτό το περιεχόμενο δεν υποστηρίζεται.",
"output_missing": "Η λήψη ολοκληρώθηκε, αλλά δεν εμφανίστηκε αρχείο στον φάκελο (ή είναι κενό). Ελέγξτε τον χώρο στον δίσκο και το antivirus και δοκιμάστε ξανά.",
"course_platform_url": "Οι πλατφόρμες μαθημάτων δεν μπορούν να ληφθούν από URL. Ανοίξτε τη σελίδα «Μαθήματα» (απαιτείται το πρόσθετο μαθημάτων και συνδεδεμένος λογαριασμός)."
},
diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json
index dc66eb32..e1925e1c 100644
--- a/src/lib/i18n/en.json
+++ b/src/lib/i18n/en.json
@@ -1279,6 +1279,7 @@
"path_too_long": "Download folder path is too long ({{current}}/{{limit}} chars). Choose a shorter folder.",
"console_encoding": "Console encoding issue (non-UTF-8 locale). Update yt-dlp in Settings → Dependencies, or run \"chcp 65001\" in a terminal and reopen the app.",
"extractor_broken": "The site extractor is broken. Update yt-dlp in Settings → Dependencies, then retry.",
+ "drm_protected": "The streams are DRM-protected and cannot be merged. This content is not supported.",
"output_missing": "Download finished, but no file appeared in the folder (or it's empty). Check disk space and antivirus exclusions, then try again.",
"course_platform_url": "Course platforms can't be downloaded from a URL. Open the Courses page (requires the Courses plugin and a logged-in account)."
},
diff --git a/src/lib/i18n/es.json b/src/lib/i18n/es.json
index 69544e58..6d2125b0 100644
--- a/src/lib/i18n/es.json
+++ b/src/lib/i18n/es.json
@@ -1279,6 +1279,7 @@
"path_too_long": "La ruta de la carpeta de descargas es demasiado larga ({{current}}/{{limit}} caracteres). Elige una más corta.",
"console_encoding": "Problema de codificación de consola (locale no UTF-8). Actualiza yt-dlp en Configuración → Dependencias, o ejecuta \"chcp 65001\" en una terminal y reabre la app.",
"extractor_broken": "El extractor del sitio está roto. Actualiza yt-dlp en Configuración → Dependencias y reintenta.",
+ "drm_protected": "Los streams descargados están protegidos por DRM y no se pueden combinar. Este contenido no es compatible.",
"output_missing": "La descarga terminó, pero no apareció ningún archivo en la carpeta (o está vacío). Revisa el espacio en disco y el antivirus, y reintenta.",
"course_platform_url": "Las plataformas de cursos no se pueden descargar desde una URL. Abre la página Cursos (requiere el plugin de Cursos y una cuenta con sesión iniciada)."
},
diff --git a/src/lib/i18n/fr.json b/src/lib/i18n/fr.json
index cede07f4..51b3d7f6 100644
--- a/src/lib/i18n/fr.json
+++ b/src/lib/i18n/fr.json
@@ -1279,6 +1279,7 @@
"path_too_long": "Le chemin du dossier est trop long ({{current}}/{{limit}} caractères). Choisissez un dossier plus court.",
"console_encoding": "Console encoding issue (non-UTF-8 locale). Update yt-dlp in Settings → Dependencies, or run \"chcp 65001\" in a terminal and reopen the app.",
"extractor_broken": "The site extractor is broken. Update yt-dlp in Settings → Dependencies, then retry.",
+ "drm_protected": "Les flux téléchargés sont protégés par DRM et ne peuvent pas être fusionnés. Ce contenu n'est pas pris en charge.",
"output_missing": "Le téléchargement est terminé, mais aucun fichier n'est apparu dans le dossier (ou il est vide). Vérifiez l'espace disque et l'antivirus, puis réessayez.",
"course_platform_url": "Les plateformes de cours ne peuvent pas être téléchargées depuis une URL. Ouvrez la page Cours (nécessite le plugin Cours et un compte connecté)."
},
diff --git a/src/lib/i18n/it.json b/src/lib/i18n/it.json
index 679a1fef..5410aadb 100644
--- a/src/lib/i18n/it.json
+++ b/src/lib/i18n/it.json
@@ -1279,6 +1279,7 @@
"path_too_long": "Il percorso della cartella è troppo lungo ({{current}}/{{limit}} caratteri). Scegli una cartella più corta.",
"console_encoding": "Console encoding issue (non-UTF-8 locale). Update yt-dlp in Settings → Dependencies, or run \"chcp 65001\" in a terminal and reopen the app.",
"extractor_broken": "The site extractor is broken. Update yt-dlp in Settings → Dependencies, then retry.",
+ "drm_protected": "I flussi scaricati sono protetti da DRM e non possono essere uniti. Questo contenuto non è supportato.",
"output_missing": "Il download è terminato, ma nessun file è apparso nella cartella (o è vuoto). Controlla lo spazio su disco e l'antivirus, poi riprova.",
"course_platform_url": "Le piattaforme di corsi non possono essere scaricate da un URL. Apri la pagina Corsi (richiede il plugin Corsi e un account connesso)."
},
diff --git a/src/lib/i18n/ja.json b/src/lib/i18n/ja.json
index bfcb8137..f2ad0a03 100644
--- a/src/lib/i18n/ja.json
+++ b/src/lib/i18n/ja.json
@@ -1279,6 +1279,7 @@
"path_too_long": "ダウンロードフォルダのパスが長すぎます ({{current}}/{{limit}} 文字)。より短いフォルダを選択してください。",
"console_encoding": "Console encoding issue (non-UTF-8 locale). Update yt-dlp in Settings → Dependencies, or run \"chcp 65001\" in a terminal and reopen the app.",
"extractor_broken": "The site extractor is broken. Update yt-dlp in Settings → Dependencies, then retry.",
+ "drm_protected": "ダウンロードしたストリームはDRMで保護されているため結合できません。このコンテンツはサポートされていません。",
"output_missing": "ダウンロードは完了しましたが、フォルダにファイルが見つからないか空です。ディスク容量とウイルス対策ソフトの設定を確認して、もう一度お試しください。",
"course_platform_url": "コースプラットフォームはURLからダウンロードできません。コースページを開いてください(コースプラグインとログイン済みアカウントが必要です)。"
},
diff --git a/src/lib/i18n/keys.ts b/src/lib/i18n/keys.ts
index 38a5b768..4ba39f30 100644
--- a/src/lib/i18n/keys.ts
+++ b/src/lib/i18n/keys.ts
@@ -303,6 +303,7 @@ export type TranslationKeys =
| 'errors.course_platform_url'
| 'errors.disk_full'
| 'errors.download_timeout'
+ | 'errors.drm_protected'
| 'errors.extraction_failed'
| 'errors.extractor_broken'
| 'errors.ffmpeg_missing'
diff --git a/src/lib/i18n/pt.json b/src/lib/i18n/pt.json
index c4439c58..b03e76e4 100644
--- a/src/lib/i18n/pt.json
+++ b/src/lib/i18n/pt.json
@@ -1279,6 +1279,7 @@
"path_too_long": "Caminho da pasta é muito longo ({{current}}/{{limit}} caracteres). Escolha uma pasta mais curta.",
"console_encoding": "Console encoding issue (non-UTF-8 locale). Update yt-dlp in Settings → Dependencies, or run \"chcp 65001\" in a terminal and reopen the app.",
"extractor_broken": "The site extractor is broken. Update yt-dlp in Settings → Dependencies, then retry.",
+ "drm_protected": "Os streams baixados são protegidos por DRM e não podem ser mesclados. Este conteúdo não é suportado.",
"output_missing": "O download terminou, mas nenhum arquivo apareceu na pasta (ou está vazio). Verifique o espaço em disco e o antivírus e tente novamente.",
"course_platform_url": "Plataformas de cursos não podem ser baixadas por URL. Abra a página Cursos (requer o plugin de Cursos e uma conta conectada)."
},
diff --git a/src/lib/i18n/ru.json b/src/lib/i18n/ru.json
index 05b61662..86e8b8ab 100644
--- a/src/lib/i18n/ru.json
+++ b/src/lib/i18n/ru.json
@@ -1279,6 +1279,7 @@
"path_too_long": "Путь к папке загрузок слишком длинный ({{current}}/{{limit}} символов). Выберите более короткую папку.",
"console_encoding": "Проблема с кодировкой консоли (локаль не UTF-8). Обновите yt-dlp в Настройках → Зависимости или выполните \"chcp 65001\" в терминале и перезапустите приложение.",
"extractor_broken": "Экстрактор сайта не работает. Обновите yt-dlp в Настройках → Зависимости, затем повторите попытку.",
+ "drm_protected": "Загруженные потоки защищены DRM и не могут быть объединены. Этот контент не поддерживается.",
"output_missing": "Скачивание завершилось, но файл не появился в папке (или он пуст). Проверьте место на диске и исключения антивируса, затем попробуйте снова.",
"course_platform_url": "Платформы курсов нельзя скачивать по URL. Откройте страницу «Курсы» (требуется плагин курсов и вход в аккаунт)."
},
diff --git a/src/lib/i18n/zh-TW.json b/src/lib/i18n/zh-TW.json
index 7579fdca..c5b953f4 100644
--- a/src/lib/i18n/zh-TW.json
+++ b/src/lib/i18n/zh-TW.json
@@ -1279,6 +1279,7 @@
"path_too_long": "下載資料夾路徑過長 ({{current}}/{{limit}} 字元)。請選擇更短的資料夾。",
"console_encoding": "Console encoding issue (non-UTF-8 locale). Update yt-dlp in Settings → Dependencies, or run \"chcp 65001\" in a terminal and reopen the app.",
"extractor_broken": "The site extractor is broken. Update yt-dlp in Settings → Dependencies, then retry.",
+ "drm_protected": "下載的串流受 DRM 保護,無法合併。不支援此內容。",
"output_missing": "下載已完成,但資料夾中沒有出現檔案(或檔案為空)。請檢查磁碟空間與防毒軟體設定後重試。",
"course_platform_url": "課程平台無法透過 URL 下載。請開啟課程頁面(需要課程外掛並登入帳號)。"
},
diff --git a/src/lib/i18n/zh.json b/src/lib/i18n/zh.json
index fa37754d..650da81e 100644
--- a/src/lib/i18n/zh.json
+++ b/src/lib/i18n/zh.json
@@ -1279,6 +1279,7 @@
"path_too_long": "下载文件夹路径过长 ({{current}}/{{limit}} 字符)。请选择更短的文件夹。",
"console_encoding": "Console encoding issue (non-UTF-8 locale). Update yt-dlp in Settings → Dependencies, or run \"chcp 65001\" in a terminal and reopen the app.",
"extractor_broken": "The site extractor is broken. Update yt-dlp in Settings → Dependencies, then retry.",
+ "drm_protected": "下载的流受 DRM 保护,无法合并。不支持此内容。",
"output_missing": "下载已完成,但文件夹中没有出现文件(或文件为空)。请检查磁盘空间和杀毒软件设置后重试。",
"course_platform_url": "课程平台无法通过 URL 下载。请打开课程页面(需要课程插件并登录账号)。"
},