Compare commits

..

No commits in common. "d9b02065a2ebe2f4864c69061512817f391d66fc" and "6d5fb27c999c4a7e98b6febee8f9c9476dfbe930" have entirely different histories.

2 changed files with 3 additions and 23 deletions

View File

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

View File

@ -679,8 +679,6 @@ class MegaDebridClient {
private static cachedApiTokenAt = 0; private static cachedApiTokenAt = 0;
private static pendingConnect: Promise<string | null> | null = null;
public constructor(login: string, password: string, preferApi: boolean, megaWebUnrestrict?: MegaWebUnrestrictor) { public constructor(login: string, password: string, preferApi: boolean, megaWebUnrestrict?: MegaWebUnrestrictor) {
this.login = login; this.login = login;
this.password = password; this.password = password;
@ -694,18 +692,6 @@ class MegaDebridClient {
return MegaDebridClient.cachedApiToken; return MegaDebridClient.cachedApiToken;
} }
// Deduplicate parallel connectUser calls — only one in-flight request at a time
if (MegaDebridClient.pendingConnect) {
return MegaDebridClient.pendingConnect;
}
MegaDebridClient.pendingConnect = this.doConnectApi(signal).finally(() => {
MegaDebridClient.pendingConnect = null;
});
return MegaDebridClient.pendingConnect;
}
private async doConnectApi(signal?: AbortSignal): Promise<string | null> {
const url = `${MEGA_DEBRID_API_BASE}?action=connectUser&login=${encodeURIComponent(this.login)}&password=${encodeURIComponent(this.password)}`; const url = `${MEGA_DEBRID_API_BASE}?action=connectUser&login=${encodeURIComponent(this.login)}&password=${encodeURIComponent(this.password)}`;
const response = await fetch(url, { const response = await fetch(url, {
headers: { "User-Agent": DEBRID_USER_AGENT }, headers: { "User-Agent": DEBRID_USER_AGENT },
@ -1728,12 +1714,9 @@ export class DebridService {
if (!result) { if (!result) {
throw new Error("Real-Debrid-Web-Fallback nicht verfügbar"); throw new Error("Real-Debrid-Web-Fallback nicht verfügbar");
} }
result.sourceLabel = "Web";
return result; return result;
} }
const result = await new RealDebridClient(settings.token).unrestrictLink(link, signal); return new RealDebridClient(settings.token).unrestrictLink(link, signal);
result.sourceLabel = "API";
return result;
} }
if (provider === "megadebrid") { if (provider === "megadebrid") {
return new MegaDebridClient(settings.megaLogin, settings.megaPassword, settings.megaDebridPreferApi, this.options.megaWebUnrestrict).unrestrictLink(link, signal); return new MegaDebridClient(settings.megaLogin, settings.megaPassword, settings.megaDebridPreferApi, this.options.megaWebUnrestrict).unrestrictLink(link, signal);
@ -1744,12 +1727,9 @@ export class DebridService {
if (!result) { if (!result) {
throw new Error("AllDebrid-Web-Fallback nicht verfügbar"); throw new Error("AllDebrid-Web-Fallback nicht verfügbar");
} }
result.sourceLabel = "Web";
return result; return result;
} }
const adResult = await new AllDebridClient(settings.allDebridToken).unrestrictLink(link, signal); return new AllDebridClient(settings.allDebridToken).unrestrictLink(link, signal);
adResult.sourceLabel = "API";
return adResult;
} }
if (provider === "ddownload") { if (provider === "ddownload") {
return this.getDdownloadClient(settings.ddownloadLogin, settings.ddownloadPassword).unrestrictLink(link, signal); return this.getDdownloadClient(settings.ddownloadLogin, settings.ddownloadPassword).unrestrictLink(link, signal);