[test] backup request
This commit is contained in:
@@ -37,4 +37,15 @@
|
||||
}}
|
||||
class="drop-shadow-lg p-3 border-borderc border-solid mt-2 flex justify-center items-center ml-2 mr-2 border-1 hover:bg-selected text-sm">
|
||||
{language.loadbackup}
|
||||
</button>
|
||||
</button>
|
||||
|
||||
<!-- <button
|
||||
on:click={async () => {
|
||||
if((await alertConfirm(language.backupLoadConfirm)) && (await alertConfirm(language.backupLoadConfirm2))){
|
||||
localStorage.setItem('backup', 'load')
|
||||
checkDriver('reftoken')
|
||||
}
|
||||
}}
|
||||
class="drop-shadow-lg p-3 border-borderc border-solid mt-2 flex justify-center items-center ml-2 mr-2 border-1 hover:bg-selected text-sm">
|
||||
Test
|
||||
</button> -->
|
||||
@@ -8,17 +8,25 @@ import { language } from "../../lang";
|
||||
import { relaunch } from '@tauri-apps/api/process';
|
||||
import { open } from '@tauri-apps/api/shell';
|
||||
|
||||
export async function checkDriver(type:'save'|'load'|'loadtauri'|'savetauri'){
|
||||
export async function checkDriver(type:'save'|'load'|'loadtauri'|'savetauri'|'reftoken'){
|
||||
const CLIENT_ID = '580075990041-l26k2d3c0nemmqiu3d3aag01npfrkn76.apps.googleusercontent.com';
|
||||
const REDIRECT_URI = isTauri ? "https://risuai.xyz/" : `https://${location.host}/`
|
||||
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}`;
|
||||
|
||||
|
||||
if(type === 'reftoken'){
|
||||
const authorizationUrl = `https://accounts.google.com/o/oauth2/auth?client_id=${CLIENT_ID}&redirect_uri=${encodedRedirectUri}&scope=${SCOPE}&response_type=code&state=${"accesstauri"}&access_type=offline&prompt=consent`;
|
||||
open(authorizationUrl)
|
||||
return
|
||||
}
|
||||
|
||||
if(type === 'save' || type === 'load'){
|
||||
location.href = (authorizationUrl);
|
||||
}
|
||||
else{
|
||||
|
||||
try {
|
||||
open(authorizationUrl)
|
||||
let code = await alertInput(language.pasteAuthCode)
|
||||
|
||||
Reference in New Issue
Block a user