mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
fix: added the @globals back and removed some merge leftovers
This commit is contained in:
parent
c8fe984171
commit
6d36db5446
8 changed files with 535 additions and 367 deletions
|
@ -10,17 +10,17 @@ export enum GameStatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace GameStatus {
|
export namespace GameStatus {
|
||||||
export const isDownloading = (status: GameStatus | "") =>
|
export const isDownloading = (status: GameStatus | null) =>
|
||||||
status === GameStatus.Downloading ||
|
status === GameStatus.Downloading ||
|
||||||
status === GameStatus.DownloadingMetadata ||
|
status === GameStatus.DownloadingMetadata ||
|
||||||
status === GameStatus.CheckingFiles;
|
status === GameStatus.CheckingFiles;
|
||||||
|
|
||||||
export const isVerifying = (status: GameStatus | "") =>
|
export const isVerifying = (status: GameStatus | null) =>
|
||||||
GameStatus.DownloadingMetadata == status ||
|
GameStatus.DownloadingMetadata == status ||
|
||||||
GameStatus.CheckingFiles == status ||
|
GameStatus.CheckingFiles == status ||
|
||||||
GameStatus.Decompressing == status;
|
GameStatus.Decompressing == status;
|
||||||
|
|
||||||
export const isReady = (status: GameStatus | "") =>
|
export const isReady = (status: GameStatus | null) =>
|
||||||
status === GameStatus.Finished ||
|
status === GameStatus.Finished ||
|
||||||
status === GameStatus.Seeding;
|
status === GameStatus.Seeding;
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import { stateManager } from "./state-manager";
|
import { stateManager } from "./state-manager";
|
||||||
import { GameStatus, repackers } from "./constants";
|
import { repackers } from "./constants";
|
||||||
import {
|
import {
|
||||||
getNewGOGGames,
|
getNewGOGGames,
|
||||||
getNewRepacksFromCPG,
|
getNewRepacksFromCPG,
|
||||||
|
@ -17,11 +17,13 @@ import {
|
||||||
steamGameRepository,
|
steamGameRepository,
|
||||||
userPreferencesRepository,
|
userPreferencesRepository,
|
||||||
} from "./repository";
|
} from "./repository";
|
||||||
import { TorrentClient } from "./services/torrent-client";
|
import { TorrentClient } from "./services/donwloaders/torrent-client";
|
||||||
import { Repack } from "./entity";
|
import { Repack } from "./entity";
|
||||||
import { Notification } from "electron";
|
import { Notification } from "electron";
|
||||||
import { t } from "i18next";
|
import { t } from "i18next";
|
||||||
import { In } from "typeorm";
|
import { In } from "typeorm";
|
||||||
|
import { Downloader } from "./services/donwloaders/downloader";
|
||||||
|
import { GameStatus } from "@globals";
|
||||||
|
|
||||||
startProcessWatcher();
|
startProcessWatcher();
|
||||||
|
|
||||||
|
@ -40,12 +42,7 @@ Promise.all([writePipe.createPipe(), readPipe.createPipe()]).then(async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (game) {
|
if (game) {
|
||||||
writePipe.write({
|
Downloader.downloadGame(game, game.repack);
|
||||||
action: "start",
|
|
||||||
game_id: game.id,
|
|
||||||
magnet: game.repack.magnet,
|
|
||||||
save_path: game.downloadPath,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
readPipe.socket?.on("data", (data) => {
|
readPipe.socket?.on("data", (data) => {
|
||||||
|
@ -126,4 +123,4 @@ const loadState = async () => {
|
||||||
import("./events");
|
import("./events");
|
||||||
};
|
};
|
||||||
|
|
||||||
loadState().then(() => checkForNewRepacks());
|
loadState().then(() => checkForNewRepacks());
|
|
@ -90,7 +90,7 @@ export class TorrentClient {
|
||||||
return GameStatus.DownloadingMetadata;
|
return GameStatus.DownloadingMetadata;
|
||||||
if (state === TorrentState.Finished) return GameStatus.Finished;
|
if (state === TorrentState.Finished) return GameStatus.Finished;
|
||||||
if (state === TorrentState.Seeding) return GameStatus.Seeding;
|
if (state === TorrentState.Seeding) return GameStatus.Seeding;
|
||||||
return "";
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async onSocketData(data: Buffer) {
|
public static async onSocketData(data: Buffer) {
|
||||||
|
|
|
@ -7,7 +7,6 @@ export class Unrar {
|
||||||
private constructor(private extractor: Extractor<Uint8Array>) { }
|
private constructor(private extractor: Extractor<Uint8Array>) { }
|
||||||
|
|
||||||
static async fromFilePath(filePath: string, targetFolder: string) {
|
static async fromFilePath(filePath: string, targetFolder: string) {
|
||||||
console.log(filePath, targetFolder);
|
|
||||||
const extractor = await createExtractorFromFile({
|
const extractor = await createExtractorFromFile({
|
||||||
filepath: filePath,
|
filepath: filePath,
|
||||||
targetPath: targetFolder,
|
targetPath: targetFolder,
|
||||||
|
|
|
@ -77,7 +77,7 @@ export interface Game extends Omit<CatalogueEntry, "cover"> {
|
||||||
id: number;
|
id: number;
|
||||||
title: string;
|
title: string;
|
||||||
iconUrl: string;
|
iconUrl: string;
|
||||||
status: GameStatus | "";
|
status: GameStatus | null;
|
||||||
folderName: string;
|
folderName: string;
|
||||||
downloadPath: string | null;
|
downloadPath: string | null;
|
||||||
repacks: GameRepack[];
|
repacks: GameRepack[];
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"extends": "@electron-toolkit/tsconfig/tsconfig.node.json",
|
"extends": "@electron-toolkit/tsconfig/tsconfig.node.json",
|
||||||
"include": ["electron.vite.config.*", "src/main/**/*", "src/preload/**/*", "src/locales/index.ts"],
|
"include": ["electron.vite.config.*", "src/main/**/*", "src/preload/**/*", "src/locales/index.ts", "src/globals.ts"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"composite": true,
|
"composite": true,
|
||||||
|
@ -14,7 +14,8 @@
|
||||||
"@renderer/*": ["src/renderer/*"],
|
"@renderer/*": ["src/renderer/*"],
|
||||||
"@types": ["src/types/index.ts"],
|
"@types": ["src/types/index.ts"],
|
||||||
"@locales": ["src/locales/index.ts"],
|
"@locales": ["src/locales/index.ts"],
|
||||||
"@resources": ["src/resources/index.ts"]
|
"@resources": ["src/resources/index.ts"],
|
||||||
|
"@globals": ["src/globals.ts"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,7 +5,8 @@
|
||||||
"src/renderer/src/**/*",
|
"src/renderer/src/**/*",
|
||||||
"src/renderer/src/**/*.tsx",
|
"src/renderer/src/**/*.tsx",
|
||||||
"src/preload/*.d.ts",
|
"src/preload/*.d.ts",
|
||||||
"src/locales/index.ts"
|
"src/locales/index.ts",
|
||||||
|
"src/globals.ts"
|
||||||
],
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"composite": true,
|
"composite": true,
|
||||||
|
@ -16,7 +17,8 @@
|
||||||
"src/renderer/src/*"
|
"src/renderer/src/*"
|
||||||
],
|
],
|
||||||
"@types": ["src/types/index.ts"],
|
"@types": ["src/types/index.ts"],
|
||||||
"@locales": ["src/locales/index.ts"]
|
"@locales": ["src/locales/index.ts"],
|
||||||
|
"@globals": ["src/globals.ts"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue