[test] backup request
This commit is contained in:
@@ -29,10 +29,7 @@ async function drive(request, env){
|
||||
const json = await resp.json()
|
||||
|
||||
if(json.access_token && json.expires_in){
|
||||
return new Response(JSON.stringify({
|
||||
access_token: json.access_token,
|
||||
expires_in: json.expires_in
|
||||
}), {
|
||||
return new Response(json, {
|
||||
status: 200,
|
||||
headers: headerE
|
||||
})
|
||||
|
||||
1018
pnpm-lock.yaml
generated
1018
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -38,3 +38,14 @@
|
||||
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
|
||||
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