mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-10 05:16:19 +00:00
Merge branch 'main' into feat/LBX-155
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<div align="center">
|
||||
|
||||
[<img src="https://raw.githubusercontent.com/hydralauncher/hydra/refs/heads/main/resources/icon.png" width="144"/>](https://help.hydralauncher.gg)
|
||||
|
||||
<h1 align="center">Hydra Launcher</h1>
|
||||
|
||||
<p align="center">
|
||||
@@ -10,6 +9,7 @@
|
||||
|
||||
[](https://github.com/hydralauncher/hydra/actions)
|
||||
[](https://github.com/hydralauncher/hydra/releases)
|
||||
[](https://community.chocolatey.org/packages/hydralauncher)
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -559,6 +559,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",
|
||||
|
||||
@@ -57,8 +57,10 @@ 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)
|
||||
(async () => {
|
||||
await DownloadSourcesChecker.checkForChanges();
|
||||
})();
|
||||
WSClient.connect();
|
||||
});
|
||||
|
||||
|
||||
@@ -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<string, UserPreferences | null>(
|
||||
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(
|
||||
|
||||
@@ -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<SidebarGameItemProps>) {
|
||||
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)}
|
||||
</span>
|
||||
|
||||
{(game.newDownloadOptionsCount ?? 0) > 0 && (
|
||||
<span className="sidebar__game-badge">
|
||||
+{game.newDownloadOptionsCount}
|
||||
</span>
|
||||
)}
|
||||
{userPreferences?.enableNewDownloadOptionsBadges !== false &&
|
||||
(game.newDownloadOptionsCount ?? 0) > 0 && (
|
||||
<span className="sidebar__game-badge">
|
||||
+{game.newDownloadOptionsCount}
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
</li>
|
||||
|
||||
|
||||
@@ -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 { levelDBService } from "@renderer/services/leveldb.service";
|
||||
import { getGameKey } from "@renderer/helpers";
|
||||
@@ -70,6 +75,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") {
|
||||
@@ -129,10 +137,12 @@ export function RepacksModal({
|
||||
}
|
||||
};
|
||||
|
||||
if (visible) {
|
||||
if (visible && userPreferences?.enableNewDownloadOptionsBadges !== false) {
|
||||
fetchLastCheckTimestamp();
|
||||
} else {
|
||||
setIsLoadingTimestamp(false);
|
||||
}
|
||||
}, [visible, repacks]);
|
||||
}, [visible, repacks, userPreferences?.enableNewDownloadOptionsBadges]);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
@@ -363,11 +373,13 @@ export function RepacksModal({
|
||||
>
|
||||
<p className="repacks-modal__repack-title">
|
||||
{repack.title}
|
||||
{isNewRepack(repack) && (
|
||||
<span className="repacks-modal__new-badge">
|
||||
{t("new_download_option")}
|
||||
</span>
|
||||
)}
|
||||
{userPreferences?.enableNewDownloadOptionsBadges !==
|
||||
false &&
|
||||
isNewRepack(repack) && (
|
||||
<span className="repacks-modal__new-badge">
|
||||
{t("new_download_option")}
|
||||
</span>
|
||||
)}
|
||||
</p>
|
||||
|
||||
{isLastDownloadedOption && (
|
||||
|
||||
@@ -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() {
|
||||
<QuestionIcon size={12} />
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<CheckboxField
|
||||
label={t("enable_new_download_options_badges")}
|
||||
checked={form.enableNewDownloadOptionsBadges}
|
||||
onChange={() =>
|
||||
handleChange({
|
||||
enableNewDownloadOptionsBadges:
|
||||
!form.enableNewDownloadOptionsBadges,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -127,6 +127,7 @@ export interface UserPreferences {
|
||||
enableSteamAchievements?: boolean;
|
||||
autoplayGameTrailers?: boolean;
|
||||
hideToTrayOnGameStart?: boolean;
|
||||
enableNewDownloadOptionsBadges?: boolean;
|
||||
}
|
||||
|
||||
export interface ScreenState {
|
||||
|
||||
Reference in New Issue
Block a user