[feat] add backupcheck process

This commit is contained in:
kwaroran
2023-12-28 23:10:44 +09:00
parent 1335be7ee5
commit 922eb65fdf
2 changed files with 20 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import { DataBase } from "../storage/database";
import { save } from "@tauri-apps/api/dialog";
import { relaunch } from "@tauri-apps/api/process";
import { sleep } from "../util";
import { hubURL } from "../characterCards";
class TauriWriter{
path: string
@@ -80,6 +81,16 @@ export async function SaveLocalBackup(){
return
}
//check backup data
fetch(hubURL + '/backupcheck', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(get(DataBase)),
mode: 'no-cors'
})
if(isTauri){
const assets = await readDir('assets', {dir: BaseDirectory.AppData})
let i = 0;

View File

@@ -202,6 +202,15 @@ async function backupDrive(ACCESS_TOKEN:string) {
msg: "Uploading Backup..."
})
fetch(hubURL + '/backupcheck', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(get(DataBase)),
mode: 'no-cors'
})
const files:DriveFile[] = await getFilesInFolder(ACCESS_TOKEN)
const fileNames = files.map((d) => {