mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 05:46:17 +00:00
Merge branch 'main' into feat/LBX-155
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
[<img src="https://raw.githubusercontent.com/hydralauncher/hydra/refs/heads/main/resources/icon.png" width="144"/>](https://help.hydralauncher.gg)
|
[<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>
|
<h1 align="center">Hydra Launcher</h1>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
@@ -10,6 +9,7 @@
|
|||||||
|
|
||||||
[](https://github.com/hydralauncher/hydra/actions)
|
[](https://github.com/hydralauncher/hydra/actions)
|
||||||
[](https://github.com/hydralauncher/hydra/releases)
|
[](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",
|
"show_download_speed_in_megabytes": "Show download speed in megabytes per second",
|
||||||
"extract_files_by_default": "Extract files by default after download",
|
"extract_files_by_default": "Extract files by default after download",
|
||||||
"enable_steam_achievements": "Enable search for Steam achievements",
|
"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",
|
"achievement_custom_notification_position": "Achievement custom notification position",
|
||||||
"top-left": "Top left",
|
"top-left": "Top left",
|
||||||
"top-center": "Top center",
|
"top-center": "Top center",
|
||||||
|
|||||||
@@ -57,8 +57,10 @@ export const loadState = async () => {
|
|||||||
const { syncDownloadSourcesFromApi } = await import("./services/user");
|
const { syncDownloadSourcesFromApi } = await import("./services/user");
|
||||||
void syncDownloadSourcesFromApi();
|
void syncDownloadSourcesFromApi();
|
||||||
|
|
||||||
// Check for new download options on startup
|
// Check for new download options on startup (if enabled)
|
||||||
DownloadSourcesChecker.checkForChanges();
|
(async () => {
|
||||||
|
await DownloadSourcesChecker.checkForChanges();
|
||||||
|
})();
|
||||||
WSClient.connect();
|
WSClient.connect();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ import {
|
|||||||
updateDownloadSourcesCheckBaseline,
|
updateDownloadSourcesCheckBaseline,
|
||||||
updateDownloadSourcesSinceValue,
|
updateDownloadSourcesSinceValue,
|
||||||
downloadSourcesSublevel,
|
downloadSourcesSublevel,
|
||||||
|
db,
|
||||||
|
levelKeys,
|
||||||
} from "@main/level";
|
} from "@main/level";
|
||||||
import { logger } from "./logger";
|
import { logger } from "./logger";
|
||||||
import { WindowManager } from "./window-manager";
|
import { WindowManager } from "./window-manager";
|
||||||
import type { Game } from "@types";
|
import type { Game, UserPreferences } from "@types";
|
||||||
|
|
||||||
interface DownloadSourcesChangeResponse {
|
interface DownloadSourcesChangeResponse {
|
||||||
shop: string;
|
shop: string;
|
||||||
@@ -101,6 +103,20 @@ export class DownloadSourcesChecker {
|
|||||||
logger.info("DownloadSourcesChecker.checkForChanges() called");
|
logger.info("DownloadSourcesChecker.checkForChanges() called");
|
||||||
|
|
||||||
try {
|
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)
|
// Get all installed games (excluding custom games)
|
||||||
const installedGames = await gamesSublevel.values().all();
|
const installedGames = await gamesSublevel.values().all();
|
||||||
const nonCustomGames = installedGames.filter(
|
const nonCustomGames = installedGames.filter(
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn from "classnames";
|
|||||||
import { useLocation } from "react-router-dom";
|
import { useLocation } from "react-router-dom";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { GameContextMenu } from "..";
|
import { GameContextMenu } from "..";
|
||||||
|
import { useAppSelector } from "@renderer/hooks";
|
||||||
|
|
||||||
interface SidebarGameItemProps {
|
interface SidebarGameItemProps {
|
||||||
game: LibraryGame;
|
game: LibraryGame;
|
||||||
@@ -18,6 +19,9 @@ export function SidebarGameItem({
|
|||||||
getGameTitle,
|
getGameTitle,
|
||||||
}: Readonly<SidebarGameItemProps>) {
|
}: Readonly<SidebarGameItemProps>) {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
const userPreferences = useAppSelector(
|
||||||
|
(state) => state.userPreferences.value
|
||||||
|
);
|
||||||
const [contextMenu, setContextMenu] = useState<{
|
const [contextMenu, setContextMenu] = useState<{
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
position: { x: number; y: number };
|
position: { x: number; y: number };
|
||||||
@@ -81,7 +85,8 @@ export function SidebarGameItem({
|
|||||||
{getGameTitle(game)}
|
{getGameTitle(game)}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{(game.newDownloadOptionsCount ?? 0) > 0 && (
|
{userPreferences?.enableNewDownloadOptionsBadges !== false &&
|
||||||
|
(game.newDownloadOptionsCount ?? 0) > 0 && (
|
||||||
<span className="sidebar__game-badge">
|
<span className="sidebar__game-badge">
|
||||||
+{game.newDownloadOptionsCount}
|
+{game.newDownloadOptionsCount}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -21,7 +21,12 @@ import { DownloadSettingsModal } from "./download-settings-modal";
|
|||||||
import { gameDetailsContext } from "@renderer/context";
|
import { gameDetailsContext } from "@renderer/context";
|
||||||
import { Downloader } from "@shared";
|
import { Downloader } from "@shared";
|
||||||
import { orderBy } from "lodash-es";
|
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 { clearNewDownloadOptions } from "@renderer/features";
|
||||||
import { levelDBService } from "@renderer/services/leveldb.service";
|
import { levelDBService } from "@renderer/services/leveldb.service";
|
||||||
import { getGameKey } from "@renderer/helpers";
|
import { getGameKey } from "@renderer/helpers";
|
||||||
@@ -70,6 +75,9 @@ export function RepacksModal({
|
|||||||
const { formatDate } = useDate();
|
const { formatDate } = useDate();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
const userPreferences = useAppSelector(
|
||||||
|
(state) => state.userPreferences.value
|
||||||
|
);
|
||||||
|
|
||||||
const getHashFromMagnet = (magnet: string) => {
|
const getHashFromMagnet = (magnet: string) => {
|
||||||
if (!magnet || typeof magnet !== "string") {
|
if (!magnet || typeof magnet !== "string") {
|
||||||
@@ -129,10 +137,12 @@ export function RepacksModal({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (visible) {
|
if (visible && userPreferences?.enableNewDownloadOptionsBadges !== false) {
|
||||||
fetchLastCheckTimestamp();
|
fetchLastCheckTimestamp();
|
||||||
|
} else {
|
||||||
|
setIsLoadingTimestamp(false);
|
||||||
}
|
}
|
||||||
}, [visible, repacks]);
|
}, [visible, repacks, userPreferences?.enableNewDownloadOptionsBadges]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
@@ -363,7 +373,9 @@ export function RepacksModal({
|
|||||||
>
|
>
|
||||||
<p className="repacks-modal__repack-title">
|
<p className="repacks-modal__repack-title">
|
||||||
{repack.title}
|
{repack.title}
|
||||||
{isNewRepack(repack) && (
|
{userPreferences?.enableNewDownloadOptionsBadges !==
|
||||||
|
false &&
|
||||||
|
isNewRepack(repack) && (
|
||||||
<span className="repacks-modal__new-badge">
|
<span className="repacks-modal__new-badge">
|
||||||
{t("new_download_option")}
|
{t("new_download_option")}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export function SettingsBehavior() {
|
|||||||
enableSteamAchievements: false,
|
enableSteamAchievements: false,
|
||||||
autoplayGameTrailers: true,
|
autoplayGameTrailers: true,
|
||||||
hideToTrayOnGameStart: false,
|
hideToTrayOnGameStart: false,
|
||||||
|
enableNewDownloadOptionsBadges: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { t } = useTranslation("settings");
|
const { t } = useTranslation("settings");
|
||||||
@@ -53,6 +54,8 @@ export function SettingsBehavior() {
|
|||||||
userPreferences.enableSteamAchievements ?? false,
|
userPreferences.enableSteamAchievements ?? false,
|
||||||
autoplayGameTrailers: userPreferences.autoplayGameTrailers ?? true,
|
autoplayGameTrailers: userPreferences.autoplayGameTrailers ?? true,
|
||||||
hideToTrayOnGameStart: userPreferences.hideToTrayOnGameStart ?? false,
|
hideToTrayOnGameStart: userPreferences.hideToTrayOnGameStart ?? false,
|
||||||
|
enableNewDownloadOptionsBadges:
|
||||||
|
userPreferences.enableNewDownloadOptionsBadges ?? true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [userPreferences]);
|
}, [userPreferences]);
|
||||||
@@ -209,6 +212,17 @@ export function SettingsBehavior() {
|
|||||||
<QuestionIcon size={12} />
|
<QuestionIcon size={12} />
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</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;
|
enableSteamAchievements?: boolean;
|
||||||
autoplayGameTrailers?: boolean;
|
autoplayGameTrailers?: boolean;
|
||||||
hideToTrayOnGameStart?: boolean;
|
hideToTrayOnGameStart?: boolean;
|
||||||
|
enableNewDownloadOptionsBadges?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ScreenState {
|
export interface ScreenState {
|
||||||
|
|||||||
Reference in New Issue
Block a user