mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-20 17:53:55 +00:00
refactor: clean up code
This commit is contained in:
@@ -2,6 +2,7 @@ import { registerEvent } from "../register-event";
|
||||
import { DownloadManager, HydraApi, gamesPlaytime } from "@main/services";
|
||||
import { dataSource } from "@main/data-source";
|
||||
import { DownloadQueue, Game, UserAuth, UserSubscription } from "@main/entity";
|
||||
import { PythonRPC } from "@main/services/python-rpc";
|
||||
|
||||
const signOut = async (_event: Electron.IpcMainInvokeEvent) => {
|
||||
const databaseOperations = dataSource
|
||||
@@ -27,8 +28,7 @@ const signOut = async (_event: Electron.IpcMainInvokeEvent) => {
|
||||
DownloadManager.cancelDownload();
|
||||
|
||||
/* Disconnects libtorrent */
|
||||
// TODO
|
||||
// TorrentDownloader.killTorrent();
|
||||
PythonRPC.kill();
|
||||
|
||||
HydraApi.handleSignOut();
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import { registerEvent } from "../register-event";
|
||||
import { PythonRPC } from "@main/services/python-rpc";
|
||||
|
||||
const processProfileImage = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
path: string
|
||||
) => {
|
||||
return path;
|
||||
// return PythonInstance.processProfileImage(path);
|
||||
return PythonRPC.rpc.post<{ imagePath: string; mimeType: string }>(
|
||||
"/profile_image_processor/process_image",
|
||||
{ path },
|
||||
);
|
||||
};
|
||||
|
||||
registerEvent("processProfileImage", processProfileImage);
|
||||
|
||||
@@ -8,11 +8,9 @@ const pauseGameSeed = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
gameId: number
|
||||
) => {
|
||||
await dataSource.transaction(async (transactionalEntityManager) => {
|
||||
await transactionalEntityManager
|
||||
.getRepository(Game)
|
||||
.update({ id: gameId }, { status: "complete", shouldSeed: false });
|
||||
});
|
||||
await dataSource
|
||||
.getRepository(Game)
|
||||
.update({ id: gameId }, { status: "complete", shouldSeed: false });
|
||||
|
||||
await DownloadManager.cancelDownload(gameId);
|
||||
};
|
||||
|
||||
@@ -20,11 +20,9 @@ const resumeGameSeed = async (
|
||||
|
||||
if (!game) return;
|
||||
|
||||
await dataSource.transaction(async (transactionalEntityManager) => {
|
||||
await transactionalEntityManager
|
||||
.getRepository(Game)
|
||||
.update({ id: gameId }, { status: "seeding", shouldSeed: true });
|
||||
});
|
||||
await dataSource
|
||||
.getRepository(Game)
|
||||
.update({ id: gameId }, { status: "seeding", shouldSeed: true });
|
||||
|
||||
await DownloadManager.startDownload(game);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user