Merge branch 'main' of github.com:hydralauncher/hydra into fix/adding-sorting-to-repacks-modal

This commit is contained in:
Chubby Granny Chaser 2024-07-04 18:36:15 +01:00
commit d8158bb80e
No known key found for this signature in database
47 changed files with 584 additions and 464 deletions

View file

@ -1,4 +1,9 @@
import { DownloadManager, RepacksManager, startMainLoop } from "./services";
import {
DownloadManager,
RepacksManager,
PythonInstance,
startMainLoop,
} from "./services";
import {
downloadQueueRepository,
repackRepository,
@ -12,8 +17,6 @@ import { MoreThan } from "typeorm";
import { HydraApi } from "./services/hydra-api";
import { uploadGamesBatch } from "./services/library-sync";
startMainLoop();
const loadState = async (userPreferences: UserPreferences | null) => {
RepacksManager.updateRepacks();
@ -22,8 +25,8 @@ const loadState = async (userPreferences: UserPreferences | null) => {
if (userPreferences?.realDebridApiToken)
RealDebridClient.authorize(userPreferences?.realDebridApiToken);
HydraApi.setupApi().then(async () => {
if (HydraApi.isLoggedIn()) uploadGamesBatch();
HydraApi.setupApi().then(() => {
uploadGamesBatch();
});
const [nextQueueItem] = await downloadQueueRepository.find({
@ -35,8 +38,13 @@ const loadState = async (userPreferences: UserPreferences | null) => {
},
});
if (nextQueueItem?.game.status === "active")
if (nextQueueItem?.game.status === "active") {
DownloadManager.startDownload(nextQueueItem.game);
} else {
PythonInstance.spawn();
}
startMainLoop();
const now = new Date();