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…",
"no_backups": "You haven't created any backups for this game yet",
"backup_uploaded": "Backup uploaded",
"backup_failed": "Backup failed",
"backup_deleted": "Backup deleted",
"backup_restored": "Backup restored",
"see_all_achievements": "See all achievements",

View File

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

View File

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

View File

@@ -80,7 +80,7 @@ export class CloudSync {
try {
await fs.promises.rm(backupPath, { recursive: true });
} 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 {
await fs.promises.unlink(bundleLocation);
} 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 =
localGame.lastTimePlayed == null ||
(game.lastTimePlayed &&
new Date(game.lastTimePlayed) > localGame.lastTimePlayed)
new Date(game.lastTimePlayed) >
new Date(localGame.lastTimePlayed))
? game.lastTimePlayed
: localGame.lastTimePlayed;

View File

@@ -19,7 +19,12 @@ export interface SteamAppDetailsResponse {
export const getSteamLocation = async () => {
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") {
@@ -76,7 +81,11 @@ export const getSteamAppDetails = async (
return null;
})
.catch((err) => {
logger.error(err, { method: "getSteamAppDetails" });
logger.error("Error on getSteamAppDetails", {
message: err?.message,
code: err?.code,
name: err?.name,
});
return null;
});
};

View File

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

View File

@@ -87,7 +87,7 @@ export function CloudSyncContextProvider({
const [loadingPreview, setLoadingPreview] = useState(false);
const [freezingArtifact, setFreezingArtifact] = useState(false);
const { showSuccessToast } = useToast();
const { showSuccessToast, showErrorToast } = useToast();
const downloadGameArtifact = useCallback(
async (gameArtifactId: string) => {
@@ -122,9 +122,15 @@ export function CloudSyncContextProvider({
const uploadSaveGame = useCallback(
async (downloadOptionTitle: string | null) => {
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(

View File

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

View File

@@ -69,14 +69,32 @@ export function HeroPanelActions() {
updateGame();
};
window.addEventListener("hydra:game-favorite-toggled", onFavoriteToggled as EventListener);
window.addEventListener("hydra:game-removed-from-library", onGameRemoved as EventListener);
window.addEventListener("hydra:game-files-removed", onFilesRemoved as EventListener);
window.addEventListener(
"hydra:game-favorite-toggled",
onFavoriteToggled as EventListener
);
window.addEventListener(
"hydra:game-removed-from-library",
onGameRemoved as EventListener
);
window.addEventListener(
"hydra:game-files-removed",
onFilesRemoved as EventListener
);
return () => {
window.removeEventListener("hydra:game-favorite-toggled", onFavoriteToggled as EventListener);
window.removeEventListener("hydra:game-removed-from-library", onGameRemoved as EventListener);
window.removeEventListener("hydra:game-files-removed", onFilesRemoved as EventListener);
window.removeEventListener(
"hydra:game-favorite-toggled",
onFavoriteToggled as EventListener
);
window.removeEventListener(
"hydra:game-removed-from-library",
onGameRemoved as EventListener
);
window.removeEventListener(
"hydra:game-files-removed",
onFilesRemoved as EventListener
);
};
}, [updateLibrary, updateGame]);
@@ -226,7 +244,7 @@ export function HeroPanelActions() {
onClick={() => setShowRepacksModal(true)}
theme="outline"
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 />
{t("download")}

View File

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