From 6b222ac4282b49389533ad1255f50825b6ed206d Mon Sep 17 00:00:00 2001 From: pikachuim Date: Mon, 16 Jun 2025 17:56:54 +0800 Subject: [PATCH] fix google drive cookie issue add aliyun2 refresh add yandex refresh add baiduyun oob mode --- src/yandex.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/yandex.ts b/src/yandex.ts index 013f6df..3000574 100644 --- a/src/yandex.ts +++ b/src/yandex.ts @@ -19,7 +19,7 @@ export async function yandexLogin(c: Context) { let client_uid: string | undefined = c.req.query('client_uid'); let client_key: string | undefined = c.req.query('client_key'); let server_use: string | undefined = c.req.query('server_use'); - if(!server_use) + if (!server_use) return c.json({text: "参数缺少"}, 500); if (!client_uid || !client_key) if (server_use == "false") @@ -47,16 +47,21 @@ export async function yandexLogin(c: Context) { export async function yandexCallBack(c: Context) { + let client_uid, client_key; const env = c.env; const code = c.req.query("code"); const error = c.req.query("error"); + const server_use = local.getCookie(c, 'server_use') + if (server_use && server_use == "true") { + client_uid = local.getCookie(c, 'client_uid') + client_key = local.getCookie(c, 'client_key') + } const error_description = c.req.query("error_description"); - const getToken = async (): Promise => { const params = new URLSearchParams(); params.append("grant_type", "authorization_code"); - params.append("client_id", env.yandexui_uid); - params.append("client_secret", env.yandexui_key); + params.append("client_id", server_use == "true" ? env.yandexui_uid : env.client_uid); + params.append("client_secret", server_use == "true" ? env.yandexui_key : env.client_key); params.append("code", code); const resp = await fetch("https://oauth.yandex.com/token", {