From 43cf7383245d0a2bf7a6bba80b2c6646e4213a2f Mon Sep 17 00:00:00 2001 From: kwaroran Date: Thu, 15 Jun 2023 12:11:49 +0900 Subject: [PATCH] [feat] sync improvements --- src/ts/drive/drive.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ts/drive/drive.ts b/src/ts/drive/drive.ts index 6092caee..e1278d7a 100644 --- a/src/ts/drive/drive.ts +++ b/src/ts/drive/drive.ts @@ -13,7 +13,7 @@ import { hubURL } from "../characterCards"; export async function checkDriver(type:'save'|'load'|'loadtauri'|'savetauri'|'reftoken'){ const CLIENT_ID = '580075990041-l26k2d3c0nemmqiu3d3aag01npfrkn76.apps.googleusercontent.com'; - const REDIRECT_URI = type === 'reftoken' ? 'https://sv.risuai.xyz/drive' : ((isTauri || isNodeServer) ? "https://risuai.xyz/" : `https://${location.host}/`) + const REDIRECT_URI = type === 'reftoken' ? 'https://sv.risuai.xyz/drive' : "https://risuai.xyz/" const SCOPE = 'https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/drive.appdata'; const encodedRedirectUri = encodeURIComponent(REDIRECT_URI); const authorizationUrl = `https://accounts.google.com/o/oauth2/auth?client_id=${CLIENT_ID}&redirect_uri=${encodedRedirectUri}&scope=${SCOPE}&response_type=code&state=${type}`; @@ -131,6 +131,8 @@ export async function syncDrive() { } const ACCESS_TOKEN = maindb.account.data.access_token const d = await loadDrive(ACCESS_TOKEN, 'sync') + lastSaved = Math.floor(Date.now() / 1000) + localStorage.setItem('risu_lastsaved', `${lastSaved}`) const hadNoSync = d === 'noSync' if((!isEqual(maindb, BackupDb)) || hadNoSync){ BackupDb = cloneDeep(maindb)