-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
\ No newline at end of file
diff --git a/public/favicon.ico b/public/favicon.ico
index a423a77..12d4a9e 100644
Binary files a/public/favicon.ico and b/public/favicon.ico differ
diff --git a/server/routes/check_status/[sid].ts b/server/api/alipan-tv-token/check_status/[sid].ts
similarity index 100%
rename from server/routes/check_status/[sid].ts
rename to server/api/alipan-tv-token/check_status/[sid].ts
diff --git a/server/routes/generate_qr.ts b/server/api/alipan-tv-token/generate_qr.ts
similarity index 100%
rename from server/routes/generate_qr.ts
rename to server/api/alipan-tv-token/generate_qr.ts
diff --git a/server/api/oauth/alipan/token.ts b/server/api/oauth/alipan/token.ts
new file mode 100644
index 0000000..45ede5c
--- /dev/null
+++ b/server/api/oauth/alipan/token.ts
@@ -0,0 +1,43 @@
+import { decrypt, getParams } from "@/utils/decode";
+import { defineEventHandler } from 'h3'
+import type { ApiResponse, TokenResponseEncrypt } from '~/types/api'
+
+export const runtime = 'edge'
+
+export default defineEventHandler(async (event) => {
+ try {
+ const { refresh_token } = await readBody(event);
+ const t = Math.floor(Date.now() / 1000);
+ const sendData = {
+ ...getParams(t),
+ refresh_token: refresh_token,
+ "Content-Type": "application/json"
+ };
+
+ const headers = Object.fromEntries(
+ Object.entries(sendData).map(([k, v]) => [k, String(v)])
+ );
+
+ const tokenData = await $fetch
('http://api.extscreen.com/aliyundrive/v3/token', {
+ method: 'POST',
+ headers: headers,
+ body: JSON.stringify(sendData)
+ });
+ const plainData = decrypt(tokenData.data.ciphertext, tokenData.data.iv, t);
+ const tokenInfo = JSON.parse(plainData);
+
+ return {
+ token_type: 'Bearer',
+ access_token: tokenInfo.access_token,
+ refresh_token: tokenInfo.refresh_token,
+ expires_in: tokenInfo.expires_in
+ };
+
+ } catch (error:any) {
+ return {
+ code: 500,
+ message: error.message,
+ data: null
+ } as ApiResponse
+ }
+})
diff --git a/server/routes/refresh.ts b/server/routes/refresh.ts
index 2ef8cb9..0125c64 100644
--- a/server/routes/refresh.ts
+++ b/server/routes/refresh.ts
@@ -32,8 +32,7 @@ export default defineEventHandler(async (event) => {
refresh_token: tokenInfo.refresh_token,
expires_in: tokenInfo.expires_in
};
- // 直接返回响应数据
- return tokenData;
+
} catch (error:any) {
return {