github-actions[bot] commited on
Commit
3ed7406
·
1 Parent(s): b6f7b56

Update from GitHub Actions

Browse files
functions/api/mail/new.ts CHANGED
@@ -41,7 +41,7 @@ export const onRequest = async (context: RouteContext): Promise<Response> => {
41
  }
42
  const tokenInfo = JSON.parse(tokenInfoStr);
43
  const access_token = await get_access_token(tokenInfo, env.ENTRA_CLIENT_ID, env.ENTRA_CLIENT_SECRET);
44
- const emails = await getEmails(access_token, 1, true); // 只获取最新的一封邮件,强制激活邮箱
45
  return new Response(
46
  JSON.stringify(emails[0] || null),
47
  {
 
41
  }
42
  const tokenInfo = JSON.parse(tokenInfoStr);
43
  const access_token = await get_access_token(tokenInfo, env.ENTRA_CLIENT_ID, env.ENTRA_CLIENT_SECRET);
44
+ const emails = await getEmails(access_token, 1, false); // 只获取最新的一封邮件,强制激活邮箱
45
  return new Response(
46
  JSON.stringify(emails[0] || null),
47
  {
functions/utils/authService.ts CHANGED
@@ -81,7 +81,7 @@ export class AuthService {
81
  await this.handleLoginProcess(page, account, "https://outlook.live.com/mail/0/?prompt=select_account");
82
  await this.handleMultiFactorAuth(page, account);
83
  await this.confirmLogin(page, account);
84
-
85
  return { success: true };
86
  } catch (error: any) {
87
  return {
 
81
  await this.handleLoginProcess(page, account, "https://outlook.live.com/mail/0/?prompt=select_account");
82
  await this.handleMultiFactorAuth(page, account);
83
  await this.confirmLogin(page, account);
84
+ await page.waitForTimeout(5000);
85
  return { success: true };
86
  } catch (error: any) {
87
  return {
index.ts CHANGED
@@ -255,9 +255,9 @@ async function checkEmailsForNewMessages(env: Env) {
255
  const access_token = await get_access_token(tokenInfo, env.ENTRA_CLIENT_ID, env.ENTRA_CLIENT_SECRET);
256
 
257
  // 使用智能激活器激活邮箱
258
- console.log(`开始智能激活邮箱: ${monitor.email}`);
259
- const activationResult = await activateMailboxSmart(access_token);
260
- console.log(`邮箱 ${monitor.email} 激活结果:`, activationResult);
261
 
262
  // 获取最新邮件
263
  const emails = await getEmails(access_token, 1, false);
 
255
  const access_token = await get_access_token(tokenInfo, env.ENTRA_CLIENT_ID, env.ENTRA_CLIENT_SECRET);
256
 
257
  // 使用智能激活器激活邮箱
258
+ // console.log(`开始智能激活邮箱: ${monitor.email}`);
259
+ // const activationResult = await activateMailboxSmart(access_token);
260
+ // console.log(`邮箱 ${monitor.email} 激活结果:`, activationResult);
261
 
262
  // 获取最新邮件
263
  const emails = await getEmails(access_token, 1, false);
src/services/util.ts CHANGED
@@ -5,7 +5,8 @@ export const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || '';
5
  export function getHeaders() {
6
  return {
7
  'Content-Type': 'application/json',
8
- "x-app-token": `Bearer ${localStorage.getItem('token')}`
 
9
  };
10
  }
11
  export async function handleResponse(response: Response) {
 
5
  export function getHeaders() {
6
  return {
7
  'Content-Type': 'application/json',
8
+ "x-app-token": `Bearer ${localStorage.getItem('token')}`,
9
+ "Authorization": `Bearer ${localStorage.getItem('token')}`
10
  };
11
  }
12
  export async function handleResponse(response: Response) {