docs: moving readme

This commit is contained in:
Chubby Granny Chaser
2024-09-27 23:19:39 +01:00
64 changed files with 771 additions and 549 deletions

View File

@@ -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
);
});

View File

@@ -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
// );
// });
});
});
});