mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 22:06:17 +00:00
Compare commits
8 Commits
feat/setti
...
fix/custom
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad588b5600 | ||
|
|
c24ad34bc7 | ||
|
|
4f2c3105ce | ||
|
|
feedcb1dc7 | ||
|
|
4b8d64c72b | ||
|
|
dff68a3e26 | ||
|
|
58bdbdab71 | ||
|
|
574a012d8c |
@@ -6,6 +6,10 @@ import { gamesShopAssetsSublevel, levelKeys } from "@main/level";
|
||||
const LOCAL_CACHE_EXPIRATION = 1000 * 60 * 60 * 8; // 8 hours
|
||||
|
||||
export const getGameAssets = async (objectId: string, shop: GameShop) => {
|
||||
if (shop === "custom") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const cachedAssets = await gamesShopAssetsSublevel.get(
|
||||
levelKeys.game(shop, objectId)
|
||||
);
|
||||
|
||||
@@ -26,6 +26,8 @@ const getGameShopDetails = async (
|
||||
shop: GameShop,
|
||||
language: string
|
||||
): Promise<ShopDetailsWithAssets | null> => {
|
||||
if (shop === "custom") return null;
|
||||
|
||||
if (shop === "steam") {
|
||||
const [cachedData, cachedAssets] = await Promise.all([
|
||||
gamesShopCacheSublevel.get(
|
||||
|
||||
@@ -10,6 +10,10 @@ const getGameStats = async (
|
||||
objectId: string,
|
||||
shop: GameShop
|
||||
) => {
|
||||
if (shop === "custom") {
|
||||
return null;
|
||||
}
|
||||
|
||||
const cachedStats = await gamesStatsCacheSublevel.get(
|
||||
levelKeys.game(shop, objectId)
|
||||
);
|
||||
|
||||
@@ -13,7 +13,9 @@ const addGameToFavorites = async (
|
||||
const game = await gamesSublevel.get(gameKey);
|
||||
if (!game) return;
|
||||
|
||||
HydraApi.put(`/profile/games/${shop}/${objectId}/favorite`).catch(() => {});
|
||||
if (shop !== "custom") {
|
||||
HydraApi.put(`/profile/games/${shop}/${objectId}/favorite`).catch(() => {});
|
||||
}
|
||||
|
||||
try {
|
||||
await gamesSublevel.put(gameKey, {
|
||||
|
||||
@@ -13,7 +13,11 @@ const removeGameFromFavorites = async (
|
||||
const game = await gamesSublevel.get(gameKey);
|
||||
if (!game) return;
|
||||
|
||||
HydraApi.put(`/profile/games/${shop}/${objectId}/unfavorite`).catch(() => {});
|
||||
if (shop !== "custom") {
|
||||
HydraApi.put(`/profile/games/${shop}/${objectId}/unfavorite`).catch(
|
||||
() => {}
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
await gamesSublevel.put(gameKey, {
|
||||
|
||||
@@ -84,7 +84,7 @@ const removeGameFromLibrary = async (
|
||||
await resetShopAssets(gameKey);
|
||||
}
|
||||
|
||||
if (game?.remoteId) {
|
||||
if (game.remoteId) {
|
||||
HydraApi.delete(`/profile/games/${game.remoteId}`).catch(() => {});
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,10 @@ export const getGameAchievementData = async (
|
||||
shop: GameShop,
|
||||
useCachedData: boolean
|
||||
) => {
|
||||
if (shop === "custom") {
|
||||
return [];
|
||||
}
|
||||
|
||||
const gameKey = levelKeys.game(shop, objectId);
|
||||
|
||||
const cachedAchievements = await gameAchievementsSublevel.get(gameKey);
|
||||
|
||||
@@ -98,6 +98,11 @@ export function CloudSyncContextProvider({
|
||||
);
|
||||
|
||||
const getGameArtifacts = useCallback(async () => {
|
||||
if (shop === "custom") {
|
||||
setArtifacts([]);
|
||||
return;
|
||||
}
|
||||
|
||||
const params = new URLSearchParams({
|
||||
objectId,
|
||||
shop,
|
||||
|
||||
@@ -142,10 +142,12 @@ export function GameDetailsContextProvider({
|
||||
}
|
||||
});
|
||||
|
||||
window.electron.getGameStats(objectId, shop).then((result) => {
|
||||
if (abortController.signal.aborted) return;
|
||||
setStats(result);
|
||||
});
|
||||
if (shop !== "custom") {
|
||||
window.electron.getGameStats(objectId, shop).then((result) => {
|
||||
if (abortController.signal.aborted) return;
|
||||
setStats(result);
|
||||
});
|
||||
}
|
||||
|
||||
const assetsPromise = window.electron.getGameAssets(objectId, shop);
|
||||
|
||||
@@ -167,7 +169,7 @@ export function GameDetailsContextProvider({
|
||||
setIsLoading(false);
|
||||
});
|
||||
|
||||
if (userDetails) {
|
||||
if (userDetails && shop !== "custom") {
|
||||
window.electron
|
||||
.getUnlockedAchievements(objectId, shop)
|
||||
.then((achievements) => {
|
||||
|
||||
@@ -228,7 +228,7 @@ export function GameDetailsContent() {
|
||||
</button>
|
||||
)}
|
||||
|
||||
{game?.shop !== "custom" && shop && objectId && (
|
||||
{shop !== "custom" && shop && objectId && (
|
||||
<GameReviews
|
||||
shop={shop}
|
||||
objectId={objectId}
|
||||
@@ -241,7 +241,7 @@ export function GameDetailsContent() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
{game?.shop !== "custom" && <Sidebar />}
|
||||
{shop !== "custom" && <Sidebar />}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ export function GameReviews({
|
||||
});
|
||||
|
||||
const checkUserReview = useCallback(async () => {
|
||||
if (!objectId || !userDetailsId) return;
|
||||
if (!objectId || !userDetailsId || shop === "custom") return;
|
||||
|
||||
try {
|
||||
const response = await window.electron.hydraApi.get<{
|
||||
@@ -147,7 +147,7 @@ export function GameReviews({
|
||||
|
||||
const loadReviews = useCallback(
|
||||
async (reset = false) => {
|
||||
if (!objectId) return;
|
||||
if (!objectId || shop === "custom") return;
|
||||
|
||||
if (abortControllerRef.current) {
|
||||
abortControllerRef.current.abort();
|
||||
|
||||
@@ -146,6 +146,8 @@ $hero-height: 350px;
|
||||
&__game-logo {
|
||||
width: 200px;
|
||||
align-self: flex-end;
|
||||
object-fit: contain;
|
||||
object-position: left bottom;
|
||||
|
||||
@media (min-width: 768px) {
|
||||
width: 250px;
|
||||
@@ -153,6 +155,7 @@ $hero-height: 350px;
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
width: 300px;
|
||||
max-height: 150px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export type GameShop = "steam" | "epic" | "custom";
|
||||
export type GameShop = "steam" | "custom";
|
||||
|
||||
export type ShortcutLocation = "desktop" | "start_menu";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user