This commit is contained in:
mircea32000 2025-02-11 00:59:01 +02:00
parent 9e6143ebc9
commit 94a6c14bd9
2 changed files with 15 additions and 7 deletions

View file

@ -317,18 +317,24 @@ export class DownloadManager {
};
}
case Downloader.AllDebrid: {
const downloadUrls = await AllDebridClient.getDownloadUrls(download.uri);
const downloadUrls = await AllDebridClient.getDownloadUrls(
download.uri
);
if (!downloadUrls.length) throw new Error(DownloadError.NotCachedInAllDebrid);
if (!downloadUrls.length)
throw new Error(DownloadError.NotCachedInAllDebrid);
const totalSize = downloadUrls.reduce((total, url) => total + (url.size || 0), 0);
const totalSize = downloadUrls.reduce(
(total, url) => total + (url.size || 0),
0
);
return {
action: "start",
game_id: downloadId,
url: downloadUrls.map(d => d.link),
url: downloadUrls.map((d) => d.link),
save_path: download.downloadPath,
total_size: totalSize
total_size: totalSize,
};
}
case Downloader.Torrent:
@ -370,4 +376,4 @@ export class DownloadManager {
await PythonRPC.rpc.post("/action", payload);
this.downloadingGameId = levelKeys.game(download.shop, download.objectId);
}
}
}

View file

@ -151,7 +151,9 @@ declare global {
minimized: boolean;
}) => Promise<void>;
authenticateRealDebrid: (apiToken: string) => Promise<RealDebridUser>;
authenticateAllDebrid: (apiKey: string) => Promise<AllDebridUser | { error_code: string }>;
authenticateAllDebrid: (
apiKey: string
) => Promise<AllDebridUser | { error_code: string }>;
authenticateTorBox: (apiToken: string) => Promise<TorBoxUser>;
onAchievementUnlocked: (cb: () => void) => () => Electron.IpcRenderer;