mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-02 16:23:48 +03:00
feat: adding automatic backup on game close
This commit is contained in:
parent
91b1c349e7
commit
c9ae543d3e
@ -40,8 +40,7 @@ const bundleBackup = async (
|
||||
return tarLocation;
|
||||
};
|
||||
|
||||
const uploadSaveGame = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
export const createBackup = async (
|
||||
objectId: string,
|
||||
shop: GameShop,
|
||||
downloadOptionTitle: string | null
|
||||
@ -108,4 +107,13 @@ const uploadSaveGame = async (
|
||||
});
|
||||
};
|
||||
|
||||
const uploadSaveGame = async (
|
||||
_event: Electron.IpcMainInvokeEvent,
|
||||
objectId: string,
|
||||
shop: GameShop,
|
||||
downloadOptionTitle: string | null
|
||||
) => {
|
||||
return createBackup(objectId, shop, downloadOptionTitle);
|
||||
};
|
||||
|
||||
registerEvent("uploadSaveGame", uploadSaveGame);
|
||||
|
@ -7,6 +7,7 @@ import { Game } from "@main/entity";
|
||||
import axios from "axios";
|
||||
import { exec } from "child_process";
|
||||
import { ProcessPayload } from "./download/types";
|
||||
import { createBackup } from "@main/events/cloud-save/upload-save-game";
|
||||
|
||||
const commands = {
|
||||
findWineDir: `lsof -c wine 2>/dev/null | grep '/drive_c/windows$' | head -n 1 | awk '{for(i=9;i<=NF;i++) printf "%s ", $i; print ""}'`,
|
||||
@ -269,6 +270,10 @@ const onCloseGame = (game: Game) => {
|
||||
gamesPlaytime.delete(game.id);
|
||||
|
||||
if (game.remoteId) {
|
||||
// create backup
|
||||
// todo: check for hydra cloud?
|
||||
createBackup(game.objectID, game.shop, "");
|
||||
|
||||
updateGamePlaytime(
|
||||
game,
|
||||
performance.now() - gamePlaytime.lastSyncTick,
|
||||
|
Loading…
Reference in New Issue
Block a user