diff --git a/package.json b/package.json
index abfaf6b7..8f6612fe 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "hydralauncher",
- "version": "3.0.8",
+ "version": "3.1.0",
"description": "Hydra",
"main": "./out/main/index.js",
"author": "Los Broxas",
diff --git a/python_rpc/http_downloader.py b/python_rpc/http_downloader.py
index 855d5ef4..40e30ccd 100644
--- a/python_rpc/http_downloader.py
+++ b/python_rpc/http_downloader.py
@@ -34,7 +34,7 @@ class HttpDownloader:
download = self.aria2.get_download(self.download.gid)
response = {
- 'folderName': str(download.dir) + "/" + download.name,
+ 'folderName': download.name,
'fileSize': download.total_length,
'progress': download.completed_length / download.total_length if download.total_length else 0,
'downloadSpeed': download.download_speed,
diff --git a/python_rpc/main.py b/python_rpc/main.py
index 54e5038f..36c0a922 100644
--- a/python_rpc/main.py
+++ b/python_rpc/main.py
@@ -124,8 +124,6 @@ def action():
action = data.get('action')
game_id = data.get('game_id')
- print(data)
-
if action == 'start':
url = data.get('url')
diff --git a/resources/tray-icon.png b/resources/tray-icon.png
index ee90c026..b3b53789 100644
Binary files a/resources/tray-icon.png and b/resources/tray-icon.png differ
diff --git a/src/main/events/cloud-save/get-game-artifacts.ts b/src/main/events/cloud-save/get-game-artifacts.ts
index fc47076a..dbdcb853 100644
--- a/src/main/events/cloud-save/get-game-artifacts.ts
+++ b/src/main/events/cloud-save/get-game-artifacts.ts
@@ -1,6 +1,7 @@
import { HydraApi } from "@main/services";
import { registerEvent } from "../register-event";
import type { GameArtifact, GameShop } from "@types";
+import { SubscriptionRequiredError } from "@shared";
const getGameArtifacts = async (
_event: Electron.IpcMainInvokeEvent,
@@ -13,8 +14,16 @@ const getGameArtifacts = async (
});
return HydraApi.get(
- `/profile/games/artifacts?${params.toString()}`
- );
+ `/profile/games/artifacts?${params.toString()}`,
+ {},
+ { needsSubscription: true }
+ ).catch((err) => {
+ if (err instanceof SubscriptionRequiredError) {
+ return [];
+ }
+
+ throw err;
+ });
};
registerEvent("getGameArtifacts", getGameArtifacts);
diff --git a/src/main/main.ts b/src/main/main.ts
index 8c566123..5522becb 100644
--- a/src/main/main.ts
+++ b/src/main/main.ts
@@ -9,7 +9,6 @@ import { RealDebridClient } from "./services/download/real-debrid";
import { HydraApi } from "./services/hydra-api";
import { uploadGamesBatch } from "./services/library-sync";
import { Aria2 } from "./services/aria2";
-import { PythonRPC } from "./services/python-rpc";
const loadState = async (userPreferences: UserPreferences | null) => {
import("./events");
@@ -43,11 +42,7 @@ const loadState = async (userPreferences: UserPreferences | null) => {
},
});
- if (nextQueueItem?.game.status === "active") {
- DownloadManager.startRPC(nextQueueItem.game, seedList);
- } else {
- PythonRPC.spawn();
- }
+ await DownloadManager.startRPC(nextQueueItem?.game, seedList);
startMainLoop();
};
diff --git a/src/main/services/download/download-manager.ts b/src/main/services/download/download-manager.ts
index 3a8da5b4..29b117fd 100644
--- a/src/main/services/download/download-manager.ts
+++ b/src/main/services/download/download-manager.ts
@@ -24,23 +24,19 @@ import { logger } from "../logger";
export class DownloadManager {
private static downloadingGameId: number | null = null;
- public static startRPC(game: Game, initialSeeding?: Game[]) {
- if (game && game.status === "active") {
- PythonRPC.spawn(
- {
- game_id: game.id,
- url: game.uri!,
- save_path: game.downloadPath!,
- },
- initialSeeding?.map((game) => ({
- game_id: game.id,
- url: game.uri!,
- save_path: game.downloadPath!,
- }))
- );
+ public static async startRPC(game?: Game, initialSeeding?: Game[]) {
+ PythonRPC.spawn(
+ game?.status === "active"
+ ? await this.getDownloadPayload(game).catch(() => undefined)
+ : undefined,
+ initialSeeding?.map((game) => ({
+ game_id: game.id,
+ url: game.uri!,
+ save_path: game.downloadPath!,
+ }))
+ );
- this.downloadingGameId = game.id;
- }
+ this.downloadingGameId = game?.id ?? null;
}
private static async getDownloadStatus() {
@@ -226,7 +222,9 @@ export class DownloadManager {
WindowManager.mainWindow?.setProgressBar(-1);
- this.downloadingGameId = null;
+ if (gameId === this.downloadingGameId) {
+ this.downloadingGameId = null;
+ }
}
static async resumeSeeding(game: Game) {
@@ -245,7 +243,7 @@ export class DownloadManager {
});
}
- static async startDownload(game: Game) {
+ private static async getDownloadPayload(game: Game) {
switch (game.downloader) {
case Downloader.Gofile: {
const id = game!.uri!.split("/").pop();
@@ -253,56 +251,58 @@ export class DownloadManager {
const token = await GofileApi.authorize();
const downloadLink = await GofileApi.getDownloadLink(id!);
- await PythonRPC.rpc.post("/action", {
+ return {
action: "start",
game_id: game.id,
url: downloadLink,
- save_path: game.downloadPath,
+ save_path: game.downloadPath!,
header: `Cookie: accountToken=${token}`,
- });
- break;
+ };
}
case Downloader.PixelDrain: {
const id = game!.uri!.split("/").pop();
- await PythonRPC.rpc.post("/action", {
+ return {
action: "start",
game_id: game.id,
url: `https://pixeldrain.com/api/file/${id}?download`,
- save_path: game.downloadPath,
- });
- break;
+ save_path: game.downloadPath!,
+ };
}
case Downloader.Qiwi: {
const downloadUrl = await QiwiApi.getDownloadUrl(game.uri!);
- await PythonRPC.rpc.post("/action", {
+ return {
action: "start",
game_id: game.id,
url: downloadUrl,
- save_path: game.downloadPath,
- });
- break;
+ save_path: game.downloadPath!,
+ };
}
case Downloader.Torrent:
- await PythonRPC.rpc.post("/action", {
+ return {
action: "start",
game_id: game.id,
- url: game.uri,
- save_path: game.downloadPath,
- });
- break;
+ url: game.uri!,
+ save_path: game.downloadPath!,
+ };
case Downloader.RealDebrid: {
const downloadUrl = await RealDebridClient.getDownloadUrl(game.uri!);
- await PythonRPC.rpc.post("/action", {
+ return {
action: "start",
game_id: game.id,
- url: downloadUrl,
- save_path: game.downloadPath,
- });
+ url: downloadUrl!,
+ save_path: game.downloadPath!,
+ };
}
}
+ }
+
+ static async startDownload(game: Game) {
+ const payload = await this.getDownloadPayload(game);
+
+ await PythonRPC.rpc.post("/action", payload);
this.downloadingGameId = game.id;
}
diff --git a/src/renderer/src/pages/achievements/achievement-list.tsx b/src/renderer/src/pages/achievements/achievement-list.tsx
index 6e6944de..ef178b50 100644
--- a/src/renderer/src/pages/achievements/achievement-list.tsx
+++ b/src/renderer/src/pages/achievements/achievement-list.tsx
@@ -18,8 +18,12 @@ export function AchievementList({ achievements }: AchievementListProps) {
return (
- {achievements.map((achievement, index) => (
- -
+ {achievements.map((achievement) => (
+
-
???
)}
- {achievement.unlockTime && (
+ {achievement.unlockTime != null && (
{achievement.displayName}
- {achievement.unlockTime &&
+ {achievement.unlockTime != null &&
formatDateTime(achievement.unlockTime)}
@@ -203,7 +203,7 @@ export function Sidebar() {
{achievement.displayName}
- {achievement.unlockTime &&
+ {achievement.unlockTime != null &&
formatDateTime(achievement.unlockTime)}
diff --git a/src/renderer/src/pages/settings/settings-download-sources.tsx b/src/renderer/src/pages/settings/settings-download-sources.tsx
index 96fb6f9f..cacd1910 100644
--- a/src/renderer/src/pages/settings/settings-download-sources.tsx
+++ b/src/renderer/src/pages/settings/settings-download-sources.tsx
@@ -13,8 +13,7 @@ import { settingsContext } from "@renderer/context";
import { downloadSourcesTable } from "@renderer/dexie";
import { downloadSourcesWorker } from "@renderer/workers";
import { useNavigate } from "react-router-dom";
-import { clearFilters } from "@renderer/features";
-import { setFilters } from "@renderer/features";
+import { setFilters, clearFilters } from "@renderer/features";
export function SettingsDownloadSources() {
const [showAddDownloadSourceModal, setShowAddDownloadSourceModal] =
diff --git a/src/renderer/src/pages/shared-modals/hydra-cloud/hydra-cloud-modal.css.ts b/src/renderer/src/pages/shared-modals/hydra-cloud/hydra-cloud-modal.css.ts
deleted file mode 100644
index a164c900..00000000
--- a/src/renderer/src/pages/shared-modals/hydra-cloud/hydra-cloud-modal.css.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import { SPACING_UNIT, vars } from "../../../theme.css";
-import { style } from "@vanilla-extract/css";
-
-export const friendListDisplayName = style({
- fontWeight: "bold",
- fontSize: vars.size.body,
- textAlign: "left",
- overflow: "hidden",
- textOverflow: "ellipsis",
- whiteSpace: "nowrap",
-});
-
-export const friendListContainer = style({
- display: "flex",
- gap: `${SPACING_UNIT * 3}px`,
- alignItems: "center",
- borderRadius: "4px",
- border: `solid 1px ${vars.color.border}`,
- width: "100%",
- height: "54px",
- minHeight: "54px",
- transition: "all ease 0.2s",
- position: "relative",
- ":hover": {
- backgroundColor: "rgba(255, 255, 255, 0.15)",
- },
-});
-
-export const friendListButton = style({
- display: "flex",
- alignItems: "center",
- position: "absolute",
- cursor: "pointer",
- height: "100%",
- width: "100%",
- flexDirection: "row",
- color: vars.color.body,
- gap: `${SPACING_UNIT + SPACING_UNIT / 2}px`,
- padding: `0 ${SPACING_UNIT}px`,
-});
-
-export const friendRequestItem = style({
- color: vars.color.body,
- ":hover": {
- backgroundColor: "rgba(255, 255, 255, 0.15)",
- },
-});
-
-export const acceptRequestButton = style({
- cursor: "pointer",
- color: vars.color.body,
- width: "28px",
- height: "28px",
- ":hover": {
- color: vars.color.success,
- },
-});
-
-export const cancelRequestButton = style({
- cursor: "pointer",
- color: vars.color.body,
- width: "28px",
- height: "28px",
- ":hover": {
- color: vars.color.danger,
- },
-});
-
-export const friendCodeButton = style({
- color: vars.color.body,
- cursor: "pointer",
- display: "flex",
- gap: `${SPACING_UNIT / 2}px`,
- alignItems: "center",
- transition: "all ease 0.2s",
- ":hover": {
- color: vars.color.muted,
- },
-});
diff --git a/src/shared/index.ts b/src/shared/index.ts
index 699cc4d8..85868391 100644
--- a/src/shared/index.ts
+++ b/src/shared/index.ts
@@ -13,7 +13,7 @@ export class UserNotLoggedInError extends Error {
export class SubscriptionRequiredError extends Error {
constructor() {
super("user does not have hydra cloud subscription");
- this.name = "UserWithoutCloudSubscriptionError";
+ this.name = "SubscriptionRequiredError";
}
}