Auto-route DDownload URLs to DDownload provider before debrid chain

DDownload is a direct file hoster, not a debrid service. DDownload URLs
are now automatically handled by the DDownload provider when configured,
before trying any debrid providers. Remove DDownload from the
primary/secondary/tertiary provider dropdowns since it only handles its
own URLs and doesn't belong in the debrid fallback chain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe 2026-03-05 02:25:34 +01:00
parent 4b824b2d9f
commit 068da94e2a
4 changed files with 36 additions and 9 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "real-debrid-downloader", "name": "real-debrid-downloader",
"version": "1.6.36", "version": "1.6.37",
"description": "Desktop downloader", "description": "Desktop downloader",
"main": "build/main/main/main.js", "main": "build/main/main/main.js",
"author": "Sucukdeluxe", "author": "Sucukdeluxe",

View File

@ -1212,6 +1212,27 @@ export class DebridService {
public async unrestrictLink(link: string, signal?: AbortSignal, settingsSnapshot?: AppSettings): Promise<ProviderUnrestrictedLink> { public async unrestrictLink(link: string, signal?: AbortSignal, settingsSnapshot?: AppSettings): Promise<ProviderUnrestrictedLink> {
const settings = settingsSnapshot ? cloneSettings(settingsSnapshot) : cloneSettings(this.settings); const settings = settingsSnapshot ? cloneSettings(settingsSnapshot) : cloneSettings(this.settings);
// DDownload is a direct file hoster, not a debrid service.
// If the link is a ddownload.com/ddl.to URL and the account is configured,
// use DDownload directly before trying any debrid providers.
if (DDOWNLOAD_URL_RE.test(link) && this.isProviderConfiguredFor(settings, "ddownload")) {
try {
const result = await this.unrestrictViaProvider(settings, "ddownload", link, signal);
return {
...result,
provider: "ddownload",
providerLabel: PROVIDER_LABELS["ddownload"]
};
} catch (error) {
const errorText = compactErrorText(error);
if (signal?.aborted || (/aborted/i.test(errorText) && !/timeout/i.test(errorText))) {
throw error;
}
// Fall through to normal provider chain (debrid services may also support ddownload links)
}
}
const order = toProviderOrder( const order = toProviderOrder(
settings.providerPrimary, settings.providerPrimary,
settings.providerSecondary, settings.providerSecondary,

View File

@ -5,8 +5,8 @@ import { AppSettings, BandwidthScheduleEntry, DebridProvider, DownloadItem, Down
import { defaultSettings } from "./constants"; import { defaultSettings } from "./constants";
import { logger } from "./logger"; import { logger } from "./logger";
const VALID_PRIMARY_PROVIDERS = new Set(["realdebrid", "megadebrid", "bestdebrid", "alldebrid", "ddownload"]); const VALID_PRIMARY_PROVIDERS = new Set(["realdebrid", "megadebrid", "bestdebrid", "alldebrid"]);
const VALID_FALLBACK_PROVIDERS = new Set(["none", "realdebrid", "megadebrid", "bestdebrid", "alldebrid", "ddownload"]); const VALID_FALLBACK_PROVIDERS = new Set(["none", "realdebrid", "megadebrid", "bestdebrid", "alldebrid"]);
const VALID_CLEANUP_MODES = new Set(["none", "trash", "delete"]); const VALID_CLEANUP_MODES = new Set(["none", "trash", "delete"]);
const VALID_CONFLICT_MODES = new Set(["overwrite", "skip", "rename", "ask"]); const VALID_CONFLICT_MODES = new Set(["overwrite", "skip", "rename", "ask"]);
const VALID_FINISHED_POLICIES = new Set(["never", "immediate", "on_start", "package_done"]); const VALID_FINISHED_POLICIES = new Set(["never", "immediate", "on_start", "package_done"]);

View File

@ -928,11 +928,17 @@ export function App(): ReactElement {
if (settingsDraft.allDebridToken.trim()) { if (settingsDraft.allDebridToken.trim()) {
list.push("alldebrid"); list.push("alldebrid");
} }
if ((settingsDraft.ddownloadLogin || "").trim() && (settingsDraft.ddownloadPassword || "").trim()) {
list.push("ddownload");
}
return list; return list;
}, [settingsDraft.token, settingsDraft.megaLogin, settingsDraft.megaPassword, settingsDraft.bestToken, settingsDraft.allDebridToken, settingsDraft.ddownloadLogin, settingsDraft.ddownloadPassword]); }, [settingsDraft.token, settingsDraft.megaLogin, settingsDraft.megaPassword, settingsDraft.bestToken, settingsDraft.allDebridToken]);
// DDownload is a direct file hoster (not a debrid service) and is used automatically
// for ddownload.com/ddl.to URLs. It counts as a configured account but does not
// appear in the primary/secondary/tertiary provider dropdowns.
const hasDdownloadAccount = useMemo(() =>
Boolean((settingsDraft.ddownloadLogin || "").trim() && (settingsDraft.ddownloadPassword || "").trim()),
[settingsDraft.ddownloadLogin, settingsDraft.ddownloadPassword]);
const totalConfiguredAccounts = configuredProviders.length + (hasDdownloadAccount ? 1 : 0);
const primaryProviderValue: DebridProvider = useMemo(() => { const primaryProviderValue: DebridProvider = useMemo(() => {
if (configuredProviders.includes(settingsDraft.providerPrimary)) { if (configuredProviders.includes(settingsDraft.providerPrimary)) {
@ -1112,7 +1118,7 @@ export function App(): ReactElement {
const onStartDownloads = async (): Promise<void> => { const onStartDownloads = async (): Promise<void> => {
await performQuickAction(async () => { await performQuickAction(async () => {
if (configuredProviders.length === 0) { if (totalConfiguredAccounts === 0) {
setTab("settings"); setTab("settings");
showToast("Bitte zuerst mindestens einen Hoster-Account eintragen", 3000); showToast("Bitte zuerst mindestens einen Hoster-Account eintragen", 3000);
return; return;
@ -2956,7 +2962,7 @@ export function App(): ReactElement {
<span>Links: {Object.keys(snapshot.session.items).length}</span> <span>Links: {Object.keys(snapshot.session.items).length}</span>
<span>Session: {humanSize(snapshot.stats.totalDownloaded)}</span> <span>Session: {humanSize(snapshot.stats.totalDownloaded)}</span>
<span>Gesamt: {humanSize(snapshot.stats.totalDownloadedAllTime)}</span> <span>Gesamt: {humanSize(snapshot.stats.totalDownloadedAllTime)}</span>
<span>Hoster: {configuredProviders.length}</span> <span>Hoster: {totalConfiguredAccounts}</span>
<span>{snapshot.speedText}</span> <span>{snapshot.speedText}</span>
<span>{snapshot.etaText}</span> <span>{snapshot.etaText}</span>
<span className="footer-spacer" /> <span className="footer-spacer" />