Merge branch 'main' into patch-4

This commit is contained in:
Chubby Granny Chaser
2025-10-12 12:16:21 +01:00
committed by GitHub
11 changed files with 66 additions and 19 deletions

View File

@@ -219,6 +219,7 @@
"uploading_backup": "Uploading backup…", "uploading_backup": "Uploading backup…",
"no_backups": "You haven't created any backups for this game yet", "no_backups": "You haven't created any backups for this game yet",
"backup_uploaded": "Backup uploaded", "backup_uploaded": "Backup uploaded",
"backup_failed": "Backup failed",
"backup_deleted": "Backup deleted", "backup_deleted": "Backup deleted",
"backup_restored": "Backup restored", "backup_restored": "Backup restored",
"see_all_achievements": "See all achievements", "see_all_achievements": "See all achievements",

View File

@@ -204,6 +204,7 @@
"uploading_backup": "Subiendo copia de seguridad…", "uploading_backup": "Subiendo copia de seguridad…",
"no_backups": "No has creado ninguna copia de seguridad para este juego todavía", "no_backups": "No has creado ninguna copia de seguridad para este juego todavía",
"backup_uploaded": "Copia de seguridad subida", "backup_uploaded": "Copia de seguridad subida",
"backup_failed": "Copia de seguridad fallida",
"backup_deleted": "Copia de seguridad eliminada", "backup_deleted": "Copia de seguridad eliminada",
"backup_restored": "Copia de seguridad restaurada", "backup_restored": "Copia de seguridad restaurada",
"see_all_achievements": "Ver todos los logros", "see_all_achievements": "Ver todos los logros",

View File

@@ -142,6 +142,7 @@
"uploading_backup": "A criar backup…", "uploading_backup": "A criar backup…",
"no_backups": "Ainda não fizeste nenhum backup deste jogo", "no_backups": "Ainda não fizeste nenhum backup deste jogo",
"backup_uploaded": "Backup criado", "backup_uploaded": "Backup criado",
"backup_failed": "Falha ao criar backup",
"backup_deleted": "Backup apagado", "backup_deleted": "Backup apagado",
"backup_restored": "Backup restaurado", "backup_restored": "Backup restaurado",
"see_all_achievements": "Ver todas as conquistas", "see_all_achievements": "Ver todas as conquistas",

View File

@@ -80,7 +80,7 @@ export class CloudSync {
try { try {
await fs.promises.rm(backupPath, { recursive: true }); await fs.promises.rm(backupPath, { recursive: true });
} catch (error) { } catch (error) {
logger.error("Failed to remove backup path", error); logger.error("Failed to remove backup path", { backupPath, error });
} }
} }
@@ -163,7 +163,7 @@ export class CloudSync {
try { try {
await fs.promises.unlink(bundleLocation); await fs.promises.unlink(bundleLocation);
} catch (error) { } catch (error) {
logger.error("Failed to remove tar file", error); logger.error("Failed to remove tar file", { bundleLocation, error });
} }
} }
} }

View File

@@ -22,7 +22,8 @@ export const mergeWithRemoteGames = async () => {
const updatedLastTimePlayed = const updatedLastTimePlayed =
localGame.lastTimePlayed == null || localGame.lastTimePlayed == null ||
(game.lastTimePlayed && (game.lastTimePlayed &&
new Date(game.lastTimePlayed) > localGame.lastTimePlayed) new Date(game.lastTimePlayed) >
new Date(localGame.lastTimePlayed))
? game.lastTimePlayed ? game.lastTimePlayed
: localGame.lastTimePlayed; : localGame.lastTimePlayed;

View File

@@ -19,7 +19,12 @@ export interface SteamAppDetailsResponse {
export const getSteamLocation = async () => { export const getSteamLocation = async () => {
if (process.platform === "linux") { if (process.platform === "linux") {
return path.join(SystemPath.getPath("home"), ".local", "share", "Steam"); const possiblePaths = [
path.join(SystemPath.getPath("home"), ".steam", "steam"),
path.join(SystemPath.getPath("home"), ".local", "share", "Steam"),
];
return possiblePaths.find((p) => fs.existsSync(p)) || possiblePaths[0];
} }
if (process.platform === "darwin") { if (process.platform === "darwin") {
@@ -76,7 +81,11 @@ export const getSteamAppDetails = async (
return null; return null;
}) })
.catch((err) => { .catch((err) => {
logger.error(err, { method: "getSteamAppDetails" }); logger.error("Error on getSteamAppDetails", {
message: err?.message,
code: err?.code,
name: err?.name,
});
return null; return null;
}); });
}; };

View File

@@ -33,9 +33,18 @@ export function ConfirmModal({
}; };
return ( return (
<Modal visible={visible} title={title} description={description} onClose={onClose}> <Modal
visible={visible}
title={title}
description={description}
onClose={onClose}
>
<div className="confirm-modal__actions"> <div className="confirm-modal__actions">
<Button onClick={handleConfirm} theme={confirmTheme} disabled={confirmDisabled}> <Button
onClick={handleConfirm}
theme={confirmTheme}
disabled={confirmDisabled}
>
{confirmLabel || t("confirm")} {confirmLabel || t("confirm")}
</Button> </Button>

View File

@@ -87,7 +87,7 @@ export function CloudSyncContextProvider({
const [loadingPreview, setLoadingPreview] = useState(false); const [loadingPreview, setLoadingPreview] = useState(false);
const [freezingArtifact, setFreezingArtifact] = useState(false); const [freezingArtifact, setFreezingArtifact] = useState(false);
const { showSuccessToast } = useToast(); const { showSuccessToast, showErrorToast } = useToast();
const downloadGameArtifact = useCallback( const downloadGameArtifact = useCallback(
async (gameArtifactId: string) => { async (gameArtifactId: string) => {
@@ -122,9 +122,15 @@ export function CloudSyncContextProvider({
const uploadSaveGame = useCallback( const uploadSaveGame = useCallback(
async (downloadOptionTitle: string | null) => { async (downloadOptionTitle: string | null) => {
setUploadingBackup(true); setUploadingBackup(true);
window.electron.uploadSaveGame(objectId, shop, downloadOptionTitle); window.electron
.uploadSaveGame(objectId, shop, downloadOptionTitle)
.catch((err) => {
setUploadingBackup(false);
logger.error("Failed to upload save game", { objectId, shop, err });
showErrorToast(t("backup_failed"));
});
}, },
[objectId, shop] [objectId, shop, t, showErrorToast]
); );
const toggleArtifactFreeze = useCallback( const toggleArtifactFreeze = useCallback(

View File

@@ -201,7 +201,8 @@ export function GameDetailsContextProvider({
}, [objectId, gameTitle, dispatch]); }, [objectId, gameTitle, dispatch]);
useEffect(() => { useEffect(() => {
const state = (location && (location.state as Record<string, unknown>)) || {}; const state =
(location && (location.state as Record<string, unknown>)) || {};
if (state.openRepacks) { if (state.openRepacks) {
setShowRepacksModal(true); setShowRepacksModal(true);
try { try {

View File

@@ -69,14 +69,32 @@ export function HeroPanelActions() {
updateGame(); updateGame();
}; };
window.addEventListener("hydra:game-favorite-toggled", onFavoriteToggled as EventListener); window.addEventListener(
window.addEventListener("hydra:game-removed-from-library", onGameRemoved as EventListener); "hydra:game-favorite-toggled",
window.addEventListener("hydra:game-files-removed", onFilesRemoved as EventListener); onFavoriteToggled as EventListener
);
window.addEventListener(
"hydra:game-removed-from-library",
onGameRemoved as EventListener
);
window.addEventListener(
"hydra:game-files-removed",
onFilesRemoved as EventListener
);
return () => { return () => {
window.removeEventListener("hydra:game-favorite-toggled", onFavoriteToggled as EventListener); window.removeEventListener(
window.removeEventListener("hydra:game-removed-from-library", onGameRemoved as EventListener); "hydra:game-favorite-toggled",
window.removeEventListener("hydra:game-files-removed", onFilesRemoved as EventListener); onFavoriteToggled as EventListener
);
window.removeEventListener(
"hydra:game-removed-from-library",
onGameRemoved as EventListener
);
window.removeEventListener(
"hydra:game-files-removed",
onFilesRemoved as EventListener
);
}; };
}, [updateLibrary, updateGame]); }, [updateLibrary, updateGame]);
@@ -226,7 +244,7 @@ export function HeroPanelActions() {
onClick={() => setShowRepacksModal(true)} onClick={() => setShowRepacksModal(true)}
theme="outline" theme="outline"
disabled={isGameDownloading} disabled={isGameDownloading}
className={`hero-panel-actions__action ${!repacks.length ? 'hero-panel-actions__action--disabled' : ''}`} className={`hero-panel-actions__action ${!repacks.length ? "hero-panel-actions__action--disabled" : ""}`}
> >
<DownloadIcon /> <DownloadIcon />
{t("download")} {t("download")}

View File

@@ -277,4 +277,4 @@ export function RepacksModal({
</Modal> </Modal>
</> </>
); );
} }