mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: adding aria2
This commit is contained in:
parent
a89e6760da
commit
4941709296
58 changed files with 895 additions and 1329 deletions
|
@ -13,17 +13,15 @@ import {
|
|||
repackRepository,
|
||||
userPreferencesRepository,
|
||||
} from "./repository";
|
||||
import { TorrentDownloader } from "./services";
|
||||
import { Repack, UserPreferences } from "./entity";
|
||||
import { Notification } from "electron";
|
||||
import { t } from "i18next";
|
||||
import { GameStatus } from "@shared";
|
||||
import { In } from "typeorm";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { RealDebridClient } from "./services/real-debrid";
|
||||
import { orderBy } from "lodash-es";
|
||||
import { SteamGame } from "@types";
|
||||
import { Not } from "typeorm";
|
||||
|
||||
startProcessWatcher();
|
||||
|
||||
|
@ -72,7 +70,7 @@ const checkForNewRepacks = async (userPreferences: UserPreferences | null) => {
|
|||
};
|
||||
|
||||
const loadState = async (userPreferences: UserPreferences | null) => {
|
||||
const repacks = await repackRepository.find({
|
||||
const repacks = repackRepository.find({
|
||||
order: {
|
||||
createdAt: "desc",
|
||||
},
|
||||
|
@ -82,7 +80,7 @@ const loadState = async (userPreferences: UserPreferences | null) => {
|
|||
fs.readFileSync(path.join(seedsPath, "steam-games.json"), "utf-8")
|
||||
) as SteamGame[];
|
||||
|
||||
stateManager.setValue("repacks", repacks);
|
||||
stateManager.setValue("repacks", await repacks);
|
||||
stateManager.setValue("steamGames", orderBy(steamGames, ["name"], "asc"));
|
||||
|
||||
import("./events");
|
||||
|
@ -90,22 +88,19 @@ const loadState = async (userPreferences: UserPreferences | null) => {
|
|||
if (userPreferences?.realDebridApiToken)
|
||||
await RealDebridClient.authorize(userPreferences?.realDebridApiToken);
|
||||
|
||||
await DownloadManager.connect();
|
||||
|
||||
const game = await gameRepository.findOne({
|
||||
where: {
|
||||
status: In([
|
||||
GameStatus.Downloading,
|
||||
GameStatus.DownloadingMetadata,
|
||||
GameStatus.CheckingFiles,
|
||||
]),
|
||||
status: "active",
|
||||
progress: Not(1),
|
||||
isDeleted: false,
|
||||
},
|
||||
relations: { repack: true },
|
||||
});
|
||||
|
||||
await TorrentDownloader.startClient();
|
||||
|
||||
if (game) {
|
||||
DownloadManager.resumeDownload(game.id);
|
||||
DownloadManager.startDownload(game.id);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue