mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-31 06:41:03 +00:00
refactor: enhance download management by validating URLs and adding file size handling
This commit is contained in:
@@ -69,10 +69,16 @@ export function useDownload() {
|
||||
};
|
||||
|
||||
const cancelDownload = async (shop: GameShop, objectId: string) => {
|
||||
await window.electron.cancelGameDownload(shop, objectId);
|
||||
dispatch(clearDownload());
|
||||
updateLibrary();
|
||||
const gameId = `${shop}:${objectId}`;
|
||||
const isActiveDownload = lastPacket?.gameId === gameId;
|
||||
|
||||
await window.electron.cancelGameDownload(shop, objectId);
|
||||
|
||||
if (isActiveDownload) {
|
||||
dispatch(clearDownload());
|
||||
}
|
||||
|
||||
updateLibrary();
|
||||
removeGameInstaller(shop, objectId);
|
||||
};
|
||||
|
||||
|
||||
@@ -112,6 +112,7 @@ export default function GameDetails() {
|
||||
downloadPath,
|
||||
uri: selectRepackUri(repack, downloader),
|
||||
automaticallyExtract: automaticallyExtract,
|
||||
fileSize: repack.fileSize,
|
||||
})
|
||||
: await startDownload({
|
||||
objectId: objectId!,
|
||||
@@ -121,6 +122,7 @@ export default function GameDetails() {
|
||||
downloadPath,
|
||||
uri: selectRepackUri(repack, downloader),
|
||||
automaticallyExtract: automaticallyExtract,
|
||||
fileSize: repack.fileSize,
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
|
||||
Reference in New Issue
Block a user