mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
Merge branch 'feat/migration-to-leveldb' into feature/torbox-integration
# Conflicts: # src/locales/en/translation.json # src/locales/pt-BR/translation.json # src/main/entity/user-preferences.entity.ts # src/main/events/auth/sign-out.ts # src/main/knex-client.ts # src/main/main.ts # src/main/services/download/download-manager.ts # src/main/services/process-watcher.ts # src/renderer/src/pages/downloads/download-group.tsx # src/types/index.ts # src/types/torbox.types.ts
This commit is contained in:
commit
3d571edccb
161 changed files with 2590 additions and 2802 deletions
176
src/types/download.types.ts
Normal file
176
src/types/download.types.ts
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
import type { Download } from "./level.types";
|
||||
|
||||
export type DownloadStatus =
|
||||
| "active"
|
||||
| "waiting"
|
||||
| "paused"
|
||||
| "error"
|
||||
| "complete"
|
||||
| "seeding"
|
||||
| "removed";
|
||||
|
||||
export interface DownloadProgress {
|
||||
downloadSpeed: number;
|
||||
timeRemaining: number;
|
||||
numPeers: number;
|
||||
numSeeds: number;
|
||||
isDownloadingMetadata: boolean;
|
||||
isCheckingFiles: boolean;
|
||||
progress: number;
|
||||
gameId: string;
|
||||
download: Download;
|
||||
}
|
||||
|
||||
/* Torbox */
|
||||
export interface TorBoxUser {
|
||||
id: number;
|
||||
email: string;
|
||||
plan: string;
|
||||
expiration: string;
|
||||
}
|
||||
|
||||
export interface TorBoxUserRequest {
|
||||
success: boolean;
|
||||
detail: string;
|
||||
error: string;
|
||||
data: TorBoxUser;
|
||||
}
|
||||
|
||||
export interface TorBoxFile {
|
||||
id: number;
|
||||
md5: string;
|
||||
s3_path: string;
|
||||
name: string;
|
||||
size: number;
|
||||
mimetype: string;
|
||||
short_name: string;
|
||||
}
|
||||
|
||||
export interface TorBoxTorrentInfo {
|
||||
id: number;
|
||||
hash: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
magnet: string;
|
||||
size: number;
|
||||
active: boolean;
|
||||
cached: boolean;
|
||||
auth_id: string;
|
||||
download_state:
|
||||
| "downloading"
|
||||
| "uploading"
|
||||
| "stalled (no seeds)"
|
||||
| "paused"
|
||||
| "completed"
|
||||
| "cached"
|
||||
| "metaDL"
|
||||
| "checkingResumeData";
|
||||
seeds: number;
|
||||
ratio: number;
|
||||
progress: number;
|
||||
download_speed: number;
|
||||
upload_speed: number;
|
||||
name: string;
|
||||
eta: number;
|
||||
files: TorBoxFile[];
|
||||
}
|
||||
|
||||
export interface TorBoxTorrentInfoRequest {
|
||||
success: boolean;
|
||||
detail: string;
|
||||
error: string;
|
||||
data: TorBoxTorrentInfo[];
|
||||
}
|
||||
|
||||
export interface TorBoxAddTorrentRequest {
|
||||
success: boolean;
|
||||
detail: string;
|
||||
error: string;
|
||||
data: {
|
||||
torrent_id: number;
|
||||
name: string;
|
||||
hash: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface TorBoxRequestLinkRequest {
|
||||
success: boolean;
|
||||
detail: string;
|
||||
error: string;
|
||||
data: string;
|
||||
}
|
||||
|
||||
/* Real-Debrid */
|
||||
export interface RealDebridUnrestrictLink {
|
||||
id: string;
|
||||
filename: string;
|
||||
mimeType: string;
|
||||
filesize: number;
|
||||
link: string;
|
||||
host: string;
|
||||
host_icon: string;
|
||||
chunks: number;
|
||||
crc: number;
|
||||
download: string;
|
||||
streamable: number;
|
||||
}
|
||||
|
||||
export interface RealDebridAddMagnet {
|
||||
id: string;
|
||||
// URL of the created resource
|
||||
uri: string;
|
||||
}
|
||||
|
||||
export interface RealDebridTorrentInfo {
|
||||
id: string;
|
||||
filename: string;
|
||||
original_filename: string;
|
||||
hash: string;
|
||||
bytes: number;
|
||||
original_bytes: number;
|
||||
host: string;
|
||||
split: number;
|
||||
progress: number;
|
||||
status:
|
||||
| "magnet_error"
|
||||
| "magnet_conversion"
|
||||
| "waiting_files_selection"
|
||||
| "queued"
|
||||
| "downloading"
|
||||
| "downloaded"
|
||||
| "error"
|
||||
| "virus"
|
||||
| "compressing"
|
||||
| "uploading"
|
||||
| "dead";
|
||||
added: string;
|
||||
files: {
|
||||
id: number;
|
||||
path: string;
|
||||
bytes: number;
|
||||
selected: number;
|
||||
}[];
|
||||
links: string[];
|
||||
ended: string;
|
||||
speed: number;
|
||||
seeders: number;
|
||||
}
|
||||
|
||||
export interface RealDebridUser {
|
||||
id: number;
|
||||
username: string;
|
||||
email: string;
|
||||
points: number;
|
||||
locale: string;
|
||||
avatar: string;
|
||||
type: string;
|
||||
premium: number;
|
||||
expiration: string;
|
||||
}
|
||||
|
||||
/* Torrent */
|
||||
export interface SeedingStatus {
|
||||
gameId: string;
|
||||
status: DownloadStatus;
|
||||
uploadSpeed: number;
|
||||
}
|
||||
21
src/types/game.types.ts
Normal file
21
src/types/game.types.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
export type GameShop = "steam" | "epic";
|
||||
|
||||
export interface UnlockedAchievement {
|
||||
name: string;
|
||||
unlockTime: number;
|
||||
}
|
||||
|
||||
export interface SteamAchievement {
|
||||
name: string;
|
||||
displayName: string;
|
||||
description?: string;
|
||||
icon: string;
|
||||
icongray: string;
|
||||
hidden: boolean;
|
||||
points?: number;
|
||||
}
|
||||
|
||||
export interface UserAchievement extends SteamAchievement {
|
||||
unlocked: boolean;
|
||||
unlockTime: number | null;
|
||||
}
|
||||
|
|
@ -1,16 +1,7 @@
|
|||
import type { Cracker, DownloadSourceStatus, Downloader } from "@shared";
|
||||
import type { SteamAppDetails } from "./steam.types";
|
||||
|
||||
export type GameStatus =
|
||||
| "active"
|
||||
| "waiting"
|
||||
| "paused"
|
||||
| "error"
|
||||
| "complete"
|
||||
| "seeding"
|
||||
| "removed";
|
||||
|
||||
export type GameShop = "steam" | "epic";
|
||||
import type { Download, Game, Subscription } from "./level.types";
|
||||
import type { GameShop } from "./game.types";
|
||||
|
||||
export type FriendRequestAction = "ACCEPTED" | "REFUSED" | "CANCEL";
|
||||
|
||||
|
|
@ -33,48 +24,6 @@ export interface GameRepack {
|
|||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export interface AchievementData {
|
||||
name: string;
|
||||
displayName: string;
|
||||
description?: string;
|
||||
icon: string;
|
||||
icongray: string;
|
||||
hidden: boolean;
|
||||
points?: number;
|
||||
}
|
||||
|
||||
export interface UserAchievement {
|
||||
name: string;
|
||||
hidden: boolean;
|
||||
displayName: string;
|
||||
points?: number;
|
||||
description?: string;
|
||||
unlocked: boolean;
|
||||
unlockTime: number | null;
|
||||
icon: string;
|
||||
icongray: string;
|
||||
}
|
||||
|
||||
export interface RemoteUnlockedAchievement {
|
||||
name: string;
|
||||
hidden: boolean;
|
||||
icon: string;
|
||||
displayName: string;
|
||||
description?: string;
|
||||
unlockTime: number;
|
||||
}
|
||||
|
||||
export interface GameAchievement {
|
||||
name: string;
|
||||
hidden: boolean;
|
||||
displayName: string;
|
||||
description?: string;
|
||||
unlocked: boolean;
|
||||
unlockTime: number | null;
|
||||
icon: string;
|
||||
icongray: string;
|
||||
}
|
||||
|
||||
export type ShopDetails = SteamAppDetails & {
|
||||
objectId: string;
|
||||
};
|
||||
|
|
@ -97,45 +46,11 @@ export interface UserGame {
|
|||
achievementsPointsEarnedSum: number;
|
||||
}
|
||||
|
||||
export interface DownloadQueue {
|
||||
id: number;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
/* Used by the library */
|
||||
export interface Game {
|
||||
id: number;
|
||||
title: string;
|
||||
iconUrl: string;
|
||||
status: GameStatus | null;
|
||||
folderName: string;
|
||||
downloadPath: string | null;
|
||||
progress: number;
|
||||
bytesDownloaded: number;
|
||||
playTimeInMilliseconds: number;
|
||||
downloader: Downloader;
|
||||
winePrefixPath: string | null;
|
||||
executablePath: string | null;
|
||||
launchOptions: string | null;
|
||||
lastTimePlayed: Date | null;
|
||||
uri: string | null;
|
||||
fileSize: number;
|
||||
objectID: string;
|
||||
shop: GameShop;
|
||||
downloadQueue: DownloadQueue | null;
|
||||
shouldSeed: boolean;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export type LibraryGame = Omit<Game, "repacks">;
|
||||
|
||||
export interface GameRunning {
|
||||
id?: number;
|
||||
id: string;
|
||||
title: string;
|
||||
iconUrl: string | null;
|
||||
objectID: string;
|
||||
objectId: string;
|
||||
shop: GameShop;
|
||||
sessionDurationInMillis: number;
|
||||
}
|
||||
|
|
@ -251,16 +166,6 @@ export interface UserProfileCurrentGame extends Omit<GameRunning, "objectId"> {
|
|||
|
||||
export type ProfileVisibility = "PUBLIC" | "PRIVATE" | "FRIENDS";
|
||||
|
||||
export type SubscriptionStatus = "active" | "pending" | "cancelled";
|
||||
|
||||
export interface Subscription {
|
||||
id: string;
|
||||
status: SubscriptionStatus;
|
||||
plan: { id: string; name: string };
|
||||
expiresAt: string | null;
|
||||
paymentMethod: "pix" | "paypal";
|
||||
}
|
||||
|
||||
export interface UserDetails {
|
||||
id: string;
|
||||
username: string;
|
||||
|
|
@ -270,6 +175,7 @@ export interface UserDetails {
|
|||
backgroundImageUrl: string | null;
|
||||
profileVisibility: ProfileVisibility;
|
||||
bio: string;
|
||||
featurebaseJwt: string;
|
||||
subscription: Subscription | null;
|
||||
quirks?: {
|
||||
backupsPerGameLimit: number;
|
||||
|
|
@ -302,6 +208,7 @@ export interface UpdateProfileRequest {
|
|||
profileImageUrl?: string | null;
|
||||
backgroundImageUrl?: string | null;
|
||||
bio?: string;
|
||||
language?: string;
|
||||
}
|
||||
|
||||
export interface DownloadSourceDownload {
|
||||
|
|
@ -356,11 +263,6 @@ export interface UserStats {
|
|||
unlockedAchievementSum?: number;
|
||||
}
|
||||
|
||||
export interface UnlockedAchievement {
|
||||
name: string;
|
||||
unlockTime: number;
|
||||
}
|
||||
|
||||
export interface AchievementFile {
|
||||
type: Cracker;
|
||||
filePath: string;
|
||||
|
|
@ -419,8 +321,14 @@ export interface CatalogueSearchPayload {
|
|||
developers: string[];
|
||||
}
|
||||
|
||||
export interface LibraryGame extends Game {
|
||||
id: string;
|
||||
download: Download | null;
|
||||
}
|
||||
|
||||
export * from "./game.types";
|
||||
export * from "./steam.types";
|
||||
export * from "./real-debrid.types";
|
||||
export * from "./download.types";
|
||||
export * from "./ludusavi.types";
|
||||
export * from "./how-long-to-beat.types";
|
||||
export * from "./torbox.types";
|
||||
export * from "./level.types";
|
||||
|
|
|
|||
81
src/types/level.types.ts
Normal file
81
src/types/level.types.ts
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
import type { Downloader } from "@shared";
|
||||
import type {
|
||||
GameShop,
|
||||
SteamAchievement,
|
||||
UnlockedAchievement,
|
||||
} from "./game.types";
|
||||
import type { DownloadStatus } from "./download.types";
|
||||
|
||||
export type SubscriptionStatus = "active" | "pending" | "cancelled";
|
||||
|
||||
export interface Subscription {
|
||||
id: string;
|
||||
status: SubscriptionStatus;
|
||||
plan: { id: string; name: string };
|
||||
expiresAt: string | null;
|
||||
paymentMethod: "pix" | "paypal";
|
||||
}
|
||||
|
||||
export interface Auth {
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
tokenExpirationTimestamp: number;
|
||||
}
|
||||
|
||||
export interface User {
|
||||
id: string;
|
||||
displayName: string;
|
||||
profileImageUrl: string | null;
|
||||
backgroundImageUrl: string | null;
|
||||
subscription: Subscription | null;
|
||||
}
|
||||
|
||||
export interface Game {
|
||||
title: string;
|
||||
iconUrl: string | null;
|
||||
playTimeInMilliseconds: number;
|
||||
lastTimePlayed: Date | null;
|
||||
objectId: string;
|
||||
shop: GameShop;
|
||||
remoteId: string | null;
|
||||
isDeleted: boolean;
|
||||
winePrefixPath?: string | null;
|
||||
executablePath?: string | null;
|
||||
launchOptions?: string | null;
|
||||
}
|
||||
|
||||
export interface Download {
|
||||
shop: GameShop;
|
||||
objectId: string;
|
||||
uri: string;
|
||||
folderName: string | null;
|
||||
downloadPath: string;
|
||||
progress: number;
|
||||
downloader: Downloader;
|
||||
bytesDownloaded: number;
|
||||
fileSize: number | null;
|
||||
shouldSeed: boolean;
|
||||
status: DownloadStatus | null;
|
||||
queued: boolean;
|
||||
timestamp: number;
|
||||
}
|
||||
|
||||
export interface GameAchievement {
|
||||
achievements: SteamAchievement[];
|
||||
unlockedAchievements: UnlockedAchievement[];
|
||||
}
|
||||
|
||||
export interface UserPreferences {
|
||||
downloadsPath: string | null;
|
||||
language: string;
|
||||
realDebridApiToken: string | null;
|
||||
preferQuitInsteadOfHiding: boolean;
|
||||
runAtStartup: boolean;
|
||||
startMinimized: boolean;
|
||||
disableNsfwAlert: boolean;
|
||||
seedAfterDownloadComplete: boolean;
|
||||
showHiddenAchievementsDescription: boolean;
|
||||
downloadNotificationsEnabled: boolean;
|
||||
repackUpdatesNotificationsEnabled: boolean;
|
||||
achievementNotificationsEnabled: boolean;
|
||||
}
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
export interface RealDebridUnrestrictLink {
|
||||
id: string;
|
||||
filename: string;
|
||||
mimeType: string;
|
||||
filesize: number;
|
||||
link: string;
|
||||
host: string;
|
||||
host_icon: string;
|
||||
chunks: number;
|
||||
crc: number;
|
||||
download: string;
|
||||
streamable: number;
|
||||
}
|
||||
|
||||
export interface RealDebridAddMagnet {
|
||||
id: string;
|
||||
// URL of the created resource
|
||||
uri: string;
|
||||
}
|
||||
|
||||
export interface RealDebridTorrentInfo {
|
||||
id: string;
|
||||
filename: string;
|
||||
original_filename: string;
|
||||
hash: string;
|
||||
bytes: number;
|
||||
original_bytes: number;
|
||||
host: string;
|
||||
split: number;
|
||||
progress: number;
|
||||
status:
|
||||
| "magnet_error"
|
||||
| "magnet_conversion"
|
||||
| "waiting_files_selection"
|
||||
| "queued"
|
||||
| "downloading"
|
||||
| "downloaded"
|
||||
| "error"
|
||||
| "virus"
|
||||
| "compressing"
|
||||
| "uploading"
|
||||
| "dead";
|
||||
added: string;
|
||||
files: {
|
||||
id: number;
|
||||
path: string;
|
||||
bytes: number;
|
||||
selected: number;
|
||||
}[];
|
||||
links: string[];
|
||||
ended: string;
|
||||
speed: number;
|
||||
seeders: number;
|
||||
}
|
||||
|
||||
export interface RealDebridUser {
|
||||
id: number;
|
||||
username: string;
|
||||
email: string;
|
||||
points: number;
|
||||
locale: string;
|
||||
avatar: string;
|
||||
type: string;
|
||||
premium: number;
|
||||
expiration: string;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue