Compare commits

..

8 Commits

Author SHA1 Message Date
Moyasee
ad588b5600 fix: images with big height breaking layout 2025-10-29 19:51:09 +02:00
Zamitto
c24ad34bc7 fix: hltb and achievements being called for custom games
Some checks failed
Build Renderer / build (push) Has been cancelled
Release / build (ubuntu-latest) (push) Has been cancelled
Release / build (windows-2022) (push) Has been cancelled
2025-10-29 12:42:39 -03:00
Zamitto
4f2c3105ce Merge pull request #1834 from hydralauncher/fix/custom-games-unnecessary-requests
fix: disabling unnecessary api calls when game is custom
2025-10-29 12:07:40 -03:00
Moyasee
feedcb1dc7 feat: disabled assets request for custom games 2025-10-29 16:49:51 +02:00
Moyasee
4b8d64c72b feat: disabled favorite/unfavorite get request for custom games 2025-10-29 16:44:48 +02:00
Moyasee
dff68a3e26 fix: removed comments 2025-10-29 16:22:12 +02:00
Moyasee
58bdbdab71 fix: disabling unnecessary api calls if game is custom 2025-10-29 16:16:11 +02:00
Chubby Granny Chaser
574a012d8c Merge pull request #1833 from hydralauncher/feat/settings-trailer-and-launch
Some checks failed
Build Renderer / build (push) Has been cancelled
Release / build (ubuntu-latest) (push) Has been cancelled
Release / build (windows-2022) (push) Has been cancelled
Feat: New behavior settings: Trailers Auto-play and Hide on game launch
2025-10-28 23:11:57 +00:00
13 changed files with 43 additions and 13 deletions

View File

@@ -6,6 +6,10 @@ import { gamesShopAssetsSublevel, levelKeys } from "@main/level";
const LOCAL_CACHE_EXPIRATION = 1000 * 60 * 60 * 8; // 8 hours const LOCAL_CACHE_EXPIRATION = 1000 * 60 * 60 * 8; // 8 hours
export const getGameAssets = async (objectId: string, shop: GameShop) => { export const getGameAssets = async (objectId: string, shop: GameShop) => {
if (shop === "custom") {
return null;
}
const cachedAssets = await gamesShopAssetsSublevel.get( const cachedAssets = await gamesShopAssetsSublevel.get(
levelKeys.game(shop, objectId) levelKeys.game(shop, objectId)
); );

View File

@@ -26,6 +26,8 @@ const getGameShopDetails = async (
shop: GameShop, shop: GameShop,
language: string language: string
): Promise<ShopDetailsWithAssets | null> => { ): Promise<ShopDetailsWithAssets | null> => {
if (shop === "custom") return null;
if (shop === "steam") { if (shop === "steam") {
const [cachedData, cachedAssets] = await Promise.all([ const [cachedData, cachedAssets] = await Promise.all([
gamesShopCacheSublevel.get( gamesShopCacheSublevel.get(

View File

@@ -10,6 +10,10 @@ const getGameStats = async (
objectId: string, objectId: string,
shop: GameShop shop: GameShop
) => { ) => {
if (shop === "custom") {
return null;
}
const cachedStats = await gamesStatsCacheSublevel.get( const cachedStats = await gamesStatsCacheSublevel.get(
levelKeys.game(shop, objectId) levelKeys.game(shop, objectId)
); );

View File

@@ -13,7 +13,9 @@ const addGameToFavorites = async (
const game = await gamesSublevel.get(gameKey); const game = await gamesSublevel.get(gameKey);
if (!game) return; if (!game) return;
HydraApi.put(`/profile/games/${shop}/${objectId}/favorite`).catch(() => {}); if (shop !== "custom") {
HydraApi.put(`/profile/games/${shop}/${objectId}/favorite`).catch(() => {});
}
try { try {
await gamesSublevel.put(gameKey, { await gamesSublevel.put(gameKey, {

View File

@@ -13,7 +13,11 @@ const removeGameFromFavorites = async (
const game = await gamesSublevel.get(gameKey); const game = await gamesSublevel.get(gameKey);
if (!game) return; if (!game) return;
HydraApi.put(`/profile/games/${shop}/${objectId}/unfavorite`).catch(() => {}); if (shop !== "custom") {
HydraApi.put(`/profile/games/${shop}/${objectId}/unfavorite`).catch(
() => {}
);
}
try { try {
await gamesSublevel.put(gameKey, { await gamesSublevel.put(gameKey, {

View File

@@ -84,7 +84,7 @@ const removeGameFromLibrary = async (
await resetShopAssets(gameKey); await resetShopAssets(gameKey);
} }
if (game?.remoteId) { if (game.remoteId) {
HydraApi.delete(`/profile/games/${game.remoteId}`).catch(() => {}); HydraApi.delete(`/profile/games/${game.remoteId}`).catch(() => {});
} }

View File

@@ -27,6 +27,10 @@ export const getGameAchievementData = async (
shop: GameShop, shop: GameShop,
useCachedData: boolean useCachedData: boolean
) => { ) => {
if (shop === "custom") {
return [];
}
const gameKey = levelKeys.game(shop, objectId); const gameKey = levelKeys.game(shop, objectId);
const cachedAchievements = await gameAchievementsSublevel.get(gameKey); const cachedAchievements = await gameAchievementsSublevel.get(gameKey);

View File

@@ -98,6 +98,11 @@ export function CloudSyncContextProvider({
); );
const getGameArtifacts = useCallback(async () => { const getGameArtifacts = useCallback(async () => {
if (shop === "custom") {
setArtifacts([]);
return;
}
const params = new URLSearchParams({ const params = new URLSearchParams({
objectId, objectId,
shop, shop,

View File

@@ -142,10 +142,12 @@ export function GameDetailsContextProvider({
} }
}); });
window.electron.getGameStats(objectId, shop).then((result) => { if (shop !== "custom") {
if (abortController.signal.aborted) return; window.electron.getGameStats(objectId, shop).then((result) => {
setStats(result); if (abortController.signal.aborted) return;
}); setStats(result);
});
}
const assetsPromise = window.electron.getGameAssets(objectId, shop); const assetsPromise = window.electron.getGameAssets(objectId, shop);
@@ -167,7 +169,7 @@ export function GameDetailsContextProvider({
setIsLoading(false); setIsLoading(false);
}); });
if (userDetails) { if (userDetails && shop !== "custom") {
window.electron window.electron
.getUnlockedAchievements(objectId, shop) .getUnlockedAchievements(objectId, shop)
.then((achievements) => { .then((achievements) => {

View File

@@ -228,7 +228,7 @@ export function GameDetailsContent() {
</button> </button>
)} )}
{game?.shop !== "custom" && shop && objectId && ( {shop !== "custom" && shop && objectId && (
<GameReviews <GameReviews
shop={shop} shop={shop}
objectId={objectId} objectId={objectId}
@@ -241,7 +241,7 @@ export function GameDetailsContent() {
)} )}
</div> </div>
{game?.shop !== "custom" && <Sidebar />} {shop !== "custom" && <Sidebar />}
</div> </div>
</section> </section>

View File

@@ -117,7 +117,7 @@ export function GameReviews({
}); });
const checkUserReview = useCallback(async () => { const checkUserReview = useCallback(async () => {
if (!objectId || !userDetailsId) return; if (!objectId || !userDetailsId || shop === "custom") return;
try { try {
const response = await window.electron.hydraApi.get<{ const response = await window.electron.hydraApi.get<{
@@ -147,7 +147,7 @@ export function GameReviews({
const loadReviews = useCallback( const loadReviews = useCallback(
async (reset = false) => { async (reset = false) => {
if (!objectId) return; if (!objectId || shop === "custom") return;
if (abortControllerRef.current) { if (abortControllerRef.current) {
abortControllerRef.current.abort(); abortControllerRef.current.abort();

View File

@@ -146,6 +146,8 @@ $hero-height: 350px;
&__game-logo { &__game-logo {
width: 200px; width: 200px;
align-self: flex-end; align-self: flex-end;
object-fit: contain;
object-position: left bottom;
@media (min-width: 768px) { @media (min-width: 768px) {
width: 250px; width: 250px;
@@ -153,6 +155,7 @@ $hero-height: 350px;
@media (min-width: 1024px) { @media (min-width: 1024px) {
width: 300px; width: 300px;
max-height: 150px;
} }
} }

View File

@@ -1,4 +1,4 @@
export type GameShop = "steam" | "epic" | "custom"; export type GameShop = "steam" | "custom";
export type ShortcutLocation = "desktop" | "start_menu"; export type ShortcutLocation = "desktop" | "start_menu";