mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
feat: create game
This commit is contained in:
parent
b0bf33191b
commit
3a964dcf17
@ -1,6 +1,6 @@
|
|||||||
import { registerEvent } from "../register-event";
|
import { registerEvent } from "../register-event";
|
||||||
import type { StartGameDownloadPayload } from "@types";
|
import type { StartGameDownloadPayload } from "@types";
|
||||||
import { DownloadManager, HydraApi, logger } from "@main/services";
|
import { DownloadManager, HydraApi } from "@main/services";
|
||||||
|
|
||||||
import { Not } from "typeorm";
|
import { Not } from "typeorm";
|
||||||
import { steamGamesWorker } from "@main/workers";
|
import { steamGamesWorker } from "@main/workers";
|
||||||
@ -76,8 +76,14 @@ const startGameDownload = async (
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
createGame(updatedGame!).catch(() => {});
|
await DownloadManager.cancelDownload(updatedGame!.id);
|
||||||
|
await DownloadManager.startDownload(updatedGame!);
|
||||||
|
|
||||||
|
await downloadQueueRepository.delete({ game: { id: updatedGame!.id } });
|
||||||
|
await downloadQueueRepository.insert({ game: { id: updatedGame!.id } });
|
||||||
|
|
||||||
|
await Promise.all([
|
||||||
|
createGame(updatedGame!).catch(() => {}),
|
||||||
HydraApi.post(
|
HydraApi.post(
|
||||||
"/games/download",
|
"/games/download",
|
||||||
{
|
{
|
||||||
@ -85,15 +91,8 @@ const startGameDownload = async (
|
|||||||
shop: updatedGame!.shop,
|
shop: updatedGame!.shop,
|
||||||
},
|
},
|
||||||
{ needsAuth: false }
|
{ needsAuth: false }
|
||||||
).catch((err) => {
|
).catch(() => {}),
|
||||||
logger.error("Failed to create game download", err);
|
]);
|
||||||
});
|
|
||||||
|
|
||||||
await DownloadManager.cancelDownload(updatedGame!.id);
|
|
||||||
await DownloadManager.startDownload(updatedGame!);
|
|
||||||
|
|
||||||
await downloadQueueRepository.delete({ game: { id: updatedGame!.id } });
|
|
||||||
await downloadQueueRepository.insert({ game: { id: updatedGame!.id } });
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,10 +11,10 @@ import type {
|
|||||||
GameRunning,
|
GameRunning,
|
||||||
FriendRequestAction,
|
FriendRequestAction,
|
||||||
UpdateProfileRequest,
|
UpdateProfileRequest,
|
||||||
|
GameAchievement,
|
||||||
} from "@types";
|
} from "@types";
|
||||||
import type { CatalogueCategory } from "@shared";
|
import type { CatalogueCategory } from "@shared";
|
||||||
import type { AxiosProgressEvent } from "axios";
|
import type { AxiosProgressEvent } from "axios";
|
||||||
import { GameAchievement } from "@main/entity";
|
|
||||||
|
|
||||||
contextBridge.exposeInMainWorld("electron", {
|
contextBridge.exposeInMainWorld("electron", {
|
||||||
/* Torrenting */
|
/* Torrenting */
|
||||||
|
Loading…
Reference in New Issue
Block a user