mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
fix: fixing sonar issues
This commit is contained in:
parent
71cb4cd240
commit
2aff983dec
4 changed files with 7 additions and 8 deletions
|
@ -30,7 +30,7 @@ const openGameInstaller = async (
|
||||||
const downloadKey = levelKeys.game(shop, objectId);
|
const downloadKey = levelKeys.game(shop, objectId);
|
||||||
const download = await downloadsSublevel.get(downloadKey);
|
const download = await downloadsSublevel.get(downloadKey);
|
||||||
|
|
||||||
if (!download || !download.folderName) return true;
|
if (!download?.folderName) return true;
|
||||||
|
|
||||||
const gamePath = path.join(
|
const gamePath = path.join(
|
||||||
download.downloadPath ?? (await getDownloadsPath()),
|
download.downloadPath ?? (await getDownloadsPath()),
|
||||||
|
|
|
@ -29,8 +29,8 @@ export class DownloadManager {
|
||||||
: undefined,
|
: undefined,
|
||||||
downloadsToSeed?.map((download) => ({
|
downloadsToSeed?.map((download) => ({
|
||||||
game_id: `${download.shop}-${download.objectId}`,
|
game_id: `${download.shop}-${download.objectId}`,
|
||||||
url: download.uri!,
|
url: download.uri,
|
||||||
save_path: download.downloadPath!,
|
save_path: download.downloadPath,
|
||||||
}))
|
}))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ export class DownloadManager {
|
||||||
if (!download) return;
|
if (!download) return;
|
||||||
|
|
||||||
const totalSize = await getDirSize(
|
const totalSize = await getDirSize(
|
||||||
path.join(download.downloadPath!, status.folderName)
|
path.join(download.downloadPath, status.folderName)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (totalSize < status.fileSize) {
|
if (totalSize < status.fileSize) {
|
||||||
|
@ -223,7 +223,7 @@ export class DownloadManager {
|
||||||
return this.startDownload(download);
|
return this.startDownload(download);
|
||||||
}
|
}
|
||||||
|
|
||||||
static async cancelDownload(downloadKey = this.downloadingGameId!) {
|
static async cancelDownload(downloadKey = this.downloadingGameId) {
|
||||||
await PythonRPC.rpc.post("/action", {
|
await PythonRPC.rpc.post("/action", {
|
||||||
action: "cancel",
|
action: "cancel",
|
||||||
game_id: downloadKey,
|
game_id: downloadKey,
|
||||||
|
|
|
@ -10,8 +10,7 @@ import icon from "@resources/icon.png?asset";
|
||||||
import { NotificationOptions, toXmlString } from "./xml";
|
import { NotificationOptions, toXmlString } from "./xml";
|
||||||
import { logger } from "../logger";
|
import { logger } from "../logger";
|
||||||
import type { Game, UserPreferences } from "@types";
|
import type { Game, UserPreferences } from "@types";
|
||||||
import { levelKeys } from "@main/level";
|
import { db, levelKeys } from "@main/level";
|
||||||
import { db } from "@main/level";
|
|
||||||
|
|
||||||
async function downloadImage(url: string | null) {
|
async function downloadImage(url: string | null) {
|
||||||
if (!url) return undefined;
|
if (!url) return undefined;
|
||||||
|
|
|
@ -67,7 +67,7 @@ export function RepacksModal({
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkIfLastDownloadedOption = (repack: GameRepack) => {
|
const checkIfLastDownloadedOption = (repack: GameRepack) => {
|
||||||
if (!game || !game.download) return false;
|
if (!game?.download) return false;
|
||||||
return repack.uris.some((uri) => uri.includes(game.download!.uri));
|
return repack.uris.some((uri) => uri.includes(game.download!.uri));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue