drive in functions

This commit is contained in:
kwaroran
2023-05-10 08:06:12 +09:00
parent a3f3be3ce2
commit ca72c7c7c7
2 changed files with 3 additions and 6 deletions

View File

@@ -3,16 +3,13 @@ export function onRequest(context) {
return drive(request, context.env);
}
const encodedRedirectUri = encodeURIComponent("https://risuai.xyz/")
async function drive(request, env){
const url = new URL(request.url);
const encodedRedirectUri = url.host.includes('dev') ? encodeURIComponent("https://risu.pages.dev/") : encodeURIComponent("https://risuai.xyz/")
const headerE = {
"Access-Control-Allow-Origin": "https://risuai.xyz",
"Access-Control-Allow-Headers": "*"
}
const headerE = {}
const params = url.searchParams
const code = params.get('code')

View File

@@ -45,7 +45,7 @@ export async function checkDriverInit() {
const code = loc.get('code')
if(code){
const res = await fetch(`https://aichandict.xyz/api/drive/access?code=${encodeURIComponent(code)}`)
const res = await fetch(`/drive?code=${encodeURIComponent(code)}`)
if(res.status >= 200 && res.status < 300){
const json:{
access_token:string,