[feat] add backupcheck process
This commit is contained in:
@@ -7,6 +7,7 @@ import { DataBase } from "../storage/database";
|
|||||||
import { save } from "@tauri-apps/api/dialog";
|
import { save } from "@tauri-apps/api/dialog";
|
||||||
import { relaunch } from "@tauri-apps/api/process";
|
import { relaunch } from "@tauri-apps/api/process";
|
||||||
import { sleep } from "../util";
|
import { sleep } from "../util";
|
||||||
|
import { hubURL } from "../characterCards";
|
||||||
|
|
||||||
class TauriWriter{
|
class TauriWriter{
|
||||||
path: string
|
path: string
|
||||||
@@ -80,6 +81,16 @@ export async function SaveLocalBackup(){
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check backup data
|
||||||
|
fetch(hubURL + '/backupcheck', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify(get(DataBase)),
|
||||||
|
mode: 'no-cors'
|
||||||
|
})
|
||||||
|
|
||||||
if(isTauri){
|
if(isTauri){
|
||||||
const assets = await readDir('assets', {dir: BaseDirectory.AppData})
|
const assets = await readDir('assets', {dir: BaseDirectory.AppData})
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|||||||
@@ -202,6 +202,15 @@ async function backupDrive(ACCESS_TOKEN:string) {
|
|||||||
msg: "Uploading Backup..."
|
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 files:DriveFile[] = await getFilesInFolder(ACCESS_TOKEN)
|
||||||
|
|
||||||
const fileNames = files.map((d) => {
|
const fileNames = files.map((d) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user