mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-30 14:21:04 +00:00
docs: moving readme
This commit is contained in:
@@ -19,13 +19,19 @@ const downloadGameArtifact = async (
|
||||
objectKey: string;
|
||||
}>(`/games/artifacts/${gameArtifactId}/download`);
|
||||
|
||||
const response = await axios.get(downloadUrl, {
|
||||
responseType: "stream",
|
||||
});
|
||||
|
||||
const zipLocation = path.join(app.getPath("userData"), objectKey);
|
||||
const backupPath = path.join(backupsPath, `${shop}-${objectId}`);
|
||||
|
||||
const response = await axios.get(downloadUrl, {
|
||||
responseType: "stream",
|
||||
onDownloadProgress: (progressEvent) => {
|
||||
WindowManager.mainWindow?.webContents.send(
|
||||
`on-backup-download-progress-${objectId}-${shop}`,
|
||||
progressEvent
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
const writer = fs.createWriteStream(zipLocation);
|
||||
|
||||
response.data.pipe(writer);
|
||||
@@ -45,7 +51,7 @@ const downloadGameArtifact = async (
|
||||
|
||||
Ludusavi.restoreBackup(backupPath).then(() => {
|
||||
WindowManager.mainWindow?.webContents.send(
|
||||
`on-download-complete-${objectId}-${shop}`,
|
||||
`on-backup-download-complete-${objectId}-${shop}`,
|
||||
true
|
||||
);
|
||||
});
|
||||
|
||||
@@ -73,26 +73,31 @@ const uploadSaveGame = async (
|
||||
throw err;
|
||||
}
|
||||
|
||||
axios.put(uploadUrl, fileBuffer, {
|
||||
await axios.put(uploadUrl, fileBuffer, {
|
||||
headers: {
|
||||
"Content-Type": "application/zip",
|
||||
},
|
||||
onUploadProgress: (progressEvent) => {
|
||||
if (progressEvent.progress === 1) {
|
||||
fs.rm(zipLocation, (err) => {
|
||||
if (err) {
|
||||
logger.error("Failed to remove zip file", err);
|
||||
throw err;
|
||||
}
|
||||
|
||||
WindowManager.mainWindow?.webContents.send(
|
||||
`on-upload-complete-${objectId}-${shop}`,
|
||||
true
|
||||
);
|
||||
});
|
||||
}
|
||||
console.log(progressEvent);
|
||||
},
|
||||
});
|
||||
|
||||
WindowManager.mainWindow?.webContents.send(
|
||||
`on-upload-complete-${objectId}-${shop}`,
|
||||
true
|
||||
);
|
||||
|
||||
// fs.rm(zipLocation, (err) => {
|
||||
// if (err) {
|
||||
// logger.error("Failed to remove zip file", err);
|
||||
// throw err;
|
||||
// }
|
||||
|
||||
// WindowManager.mainWindow?.webContents.send(
|
||||
// `on-upload-complete-${objectId}-${shop}`,
|
||||
// true
|
||||
// );
|
||||
// });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user