From c4852b89f159a99e6961420cd9b54db2fb284660 Mon Sep 17 00:00:00 2001 From: Moyasee Date: Sat, 15 Nov 2025 16:46:02 +0200 Subject: [PATCH 1/3] feat: checkbox to disable new game update badges --- src/locales/en/translation.json | 1 + src/main/main.ts | 4 +-- src/main/services/download-sources-checker.ts | 18 +++++++++++- .../components/sidebar/sidebar-game-item.tsx | 15 ++++++---- .../game-details/modals/repacks-modal.tsx | 28 +++++++++++++------ .../src/pages/settings/settings-behavior.tsx | 14 ++++++++++ src/types/level.types.ts | 1 + 7 files changed, 65 insertions(+), 16 deletions(-) diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 5084a4a0..fc786be8 100755 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -544,6 +544,7 @@ "show_download_speed_in_megabytes": "Show download speed in megabytes per second", "extract_files_by_default": "Extract files by default after download", "enable_steam_achievements": "Enable search for Steam achievements", + "enable_new_download_options_badges": "Show new download options badges", "achievement_custom_notification_position": "Achievement custom notification position", "top-left": "Top left", "top-center": "Top center", diff --git a/src/main/main.ts b/src/main/main.ts index 1cadcebd..81d4f53f 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -59,8 +59,8 @@ export const loadState = async () => { const { syncDownloadSourcesFromApi } = await import("./services/user"); void syncDownloadSourcesFromApi(); - // Check for new download options on startup - DownloadSourcesChecker.checkForChanges(); + // Check for new download options on startup (if enabled) + void DownloadSourcesChecker.checkForChanges(); WSClient.connect(); }); diff --git a/src/main/services/download-sources-checker.ts b/src/main/services/download-sources-checker.ts index 928e3d52..169c199e 100644 --- a/src/main/services/download-sources-checker.ts +++ b/src/main/services/download-sources-checker.ts @@ -5,10 +5,12 @@ import { updateDownloadSourcesCheckBaseline, updateDownloadSourcesSinceValue, downloadSourcesSublevel, + db, + levelKeys, } from "@main/level"; import { logger } from "./logger"; import { WindowManager } from "./window-manager"; -import type { Game } from "@types"; +import type { Game, UserPreferences } from "@types"; interface DownloadSourcesChangeResponse { shop: string; @@ -101,6 +103,20 @@ export class DownloadSourcesChecker { logger.info("DownloadSourcesChecker.checkForChanges() called"); try { + const userPreferences = await db.get( + levelKeys.userPreferences, + { + valueEncoding: "json", + } + ); + + if (userPreferences?.enableNewDownloadOptionsBadges === false) { + logger.info( + "New download options badges are disabled, skipping download sources check" + ); + return; + } + // Get all installed games (excluding custom games) const installedGames = await gamesSublevel.values().all(); const nonCustomGames = installedGames.filter( diff --git a/src/renderer/src/components/sidebar/sidebar-game-item.tsx b/src/renderer/src/components/sidebar/sidebar-game-item.tsx index 23223fc5..3414688d 100644 --- a/src/renderer/src/components/sidebar/sidebar-game-item.tsx +++ b/src/renderer/src/components/sidebar/sidebar-game-item.tsx @@ -5,6 +5,7 @@ import cn from "classnames"; import { useLocation } from "react-router-dom"; import { useState } from "react"; import { GameContextMenu } from ".."; +import { useAppSelector } from "@renderer/hooks"; interface SidebarGameItemProps { game: LibraryGame; @@ -18,6 +19,9 @@ export function SidebarGameItem({ getGameTitle, }: Readonly) { const location = useLocation(); + const userPreferences = useAppSelector( + (state) => state.userPreferences.value + ); const [contextMenu, setContextMenu] = useState<{ visible: boolean; position: { x: number; y: number }; @@ -81,11 +85,12 @@ export function SidebarGameItem({ {getGameTitle(game)} - {(game.newDownloadOptionsCount ?? 0) > 0 && ( - - +{game.newDownloadOptionsCount} - - )} + {userPreferences?.enableNewDownloadOptionsBadges !== false && + (game.newDownloadOptionsCount ?? 0) > 0 && ( + + +{game.newDownloadOptionsCount} + + )} diff --git a/src/renderer/src/pages/game-details/modals/repacks-modal.tsx b/src/renderer/src/pages/game-details/modals/repacks-modal.tsx index 91013da0..3754ef83 100644 --- a/src/renderer/src/pages/game-details/modals/repacks-modal.tsx +++ b/src/renderer/src/pages/game-details/modals/repacks-modal.tsx @@ -21,7 +21,12 @@ import { DownloadSettingsModal } from "./download-settings-modal"; import { gameDetailsContext } from "@renderer/context"; import { Downloader } from "@shared"; import { orderBy } from "lodash-es"; -import { useDate, useFeature, useAppDispatch } from "@renderer/hooks"; +import { + useDate, + useFeature, + useAppDispatch, + useAppSelector, +} from "@renderer/hooks"; import { clearNewDownloadOptions } from "@renderer/features"; import "./repacks-modal.scss"; @@ -68,6 +73,9 @@ export function RepacksModal({ const { formatDate } = useDate(); const navigate = useNavigate(); const dispatch = useAppDispatch(); + const userPreferences = useAppSelector( + (state) => state.userPreferences.value + ); const getHashFromMagnet = (magnet: string) => { if (!magnet || typeof magnet !== "string") { @@ -115,10 +123,12 @@ export function RepacksModal({ setIsLoadingTimestamp(false); }; - if (visible) { + if (visible && userPreferences?.enableNewDownloadOptionsBadges !== false) { fetchLastCheckTimestamp(); + } else { + setIsLoadingTimestamp(false); } - }, [visible, repacks]); + }, [visible, repacks, userPreferences?.enableNewDownloadOptionsBadges]); useEffect(() => { if ( @@ -326,11 +336,13 @@ export function RepacksModal({ >

{repack.title} - {isNewRepack(repack) && ( - - {t("new_download_option")} - - )} + {userPreferences?.enableNewDownloadOptionsBadges !== + false && + isNewRepack(repack) && ( + + {t("new_download_option")} + + )}

{isLastDownloadedOption && ( diff --git a/src/renderer/src/pages/settings/settings-behavior.tsx b/src/renderer/src/pages/settings/settings-behavior.tsx index c5698ef7..0efbcb64 100644 --- a/src/renderer/src/pages/settings/settings-behavior.tsx +++ b/src/renderer/src/pages/settings/settings-behavior.tsx @@ -29,6 +29,7 @@ export function SettingsBehavior() { enableSteamAchievements: false, autoplayGameTrailers: true, hideToTrayOnGameStart: false, + enableNewDownloadOptionsBadges: true, }); const { t } = useTranslation("settings"); @@ -53,6 +54,8 @@ export function SettingsBehavior() { userPreferences.enableSteamAchievements ?? false, autoplayGameTrailers: userPreferences.autoplayGameTrailers ?? true, hideToTrayOnGameStart: userPreferences.hideToTrayOnGameStart ?? false, + enableNewDownloadOptionsBadges: + userPreferences.enableNewDownloadOptionsBadges ?? true, }); } }, [userPreferences]); @@ -209,6 +212,17 @@ export function SettingsBehavior() { + + + handleChange({ + enableNewDownloadOptionsBadges: + !form.enableNewDownloadOptionsBadges, + }) + } + /> ); } diff --git a/src/types/level.types.ts b/src/types/level.types.ts index fd930a12..98ae0eb2 100644 --- a/src/types/level.types.ts +++ b/src/types/level.types.ts @@ -124,6 +124,7 @@ export interface UserPreferences { enableSteamAchievements?: boolean; autoplayGameTrailers?: boolean; hideToTrayOnGameStart?: boolean; + enableNewDownloadOptionsBadges?: boolean; } export interface ScreenState { From 2adc132c335a834f55c10a433003418d465fada2 Mon Sep 17 00:00:00 2001 From: Moyasee Date: Sat, 15 Nov 2025 16:57:44 +0200 Subject: [PATCH 2/3] fix: removed void from main.ts --- src/main/main.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/main.ts b/src/main/main.ts index 81d4f53f..147ed7dd 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -60,7 +60,9 @@ export const loadState = async () => { void syncDownloadSourcesFromApi(); // Check for new download options on startup (if enabled) - void DownloadSourcesChecker.checkForChanges(); + (async () => { + await DownloadSourcesChecker.checkForChanges(); + })(); WSClient.connect(); }); From 1545f42d17d0bf7f46030691bf4cf9cc60a8aeef Mon Sep 17 00:00:00 2001 From: Nikolay Rovdo Date: Sun, 30 Nov 2025 14:51:24 +0100 Subject: [PATCH 3/3] Adding chocolatey publishing --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c086cb2e..d360dde4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@
[](https://help.hydralauncher.gg) -

Hydra Launcher

@@ -10,6 +9,7 @@ [![build](https://img.shields.io/github/actions/workflow/status/hydralauncher/hydra/build.yml)](https://github.com/hydralauncher/hydra/actions) [![release](https://img.shields.io/github/package-json/v/hydralauncher/hydra)](https://github.com/hydralauncher/hydra/releases) +[![chocolatey](https://img.shields.io/chocolatey/v/hydralauncher.svg)](https://community.chocolatey.org/packages/hydralauncher) ![Hydra Launcher Home Page](./docs/screenshot.png)