drive in functions (#28)
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user