github-actions[bot] commited on
Commit
b8a045d
·
1 Parent(s): 1877b95

Update from GitHub Actions

Browse files
Files changed (2) hide show
  1. functions/utils/authService.ts +73 -19
  2. src/App.vue +2 -2
functions/utils/authService.ts CHANGED
@@ -74,22 +74,90 @@ export class AuthService {
74
  await page.waitForSelector('#idA_PWD_SwitchToPassword', { timeout: 3000 });
75
  await page.click('#idA_PWD_SwitchToPassword');
76
  } catch (error) {
77
- console.log(`没有切换到密码登录,继续执行: ${error}`);
78
  }
79
 
 
 
 
 
 
 
 
 
80
  await page.waitForURL("https://login.live.com/**");
81
  await page.fill('input[type="password"]', account.password);
82
  await page.fill('input[type="password"]', account.password);
83
  await page.click('button[type="submit"]');
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  try {
86
- await page.waitForURL("https://account.live.com/recover/**", { timeout: 5000 });
87
- await page.click('#iLandingViewAction');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  } catch (error) {
89
- console.log("验证确定 page not found or timeout, skipping...");
90
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
  }
92
 
 
93
  private async handleMultiFactorAuth(page: Page, account: Account) {
94
  for (let i = 0; i < 3; i++) {
95
  try {
@@ -110,21 +178,7 @@ export class AuthService {
110
  await page.fill("#iProofEmail", proofEmail);
111
  await page.click('input[type="submit"]');
112
 
113
- const proof = [
114
- {
115
- "suffix": "godgodgame.com",
116
- "apiUrl": "https://seedmail.igiven.com/api/latest-email",
117
- "token": this.env.PROOF_GODGODGAME_TOKEN
118
- },
119
- {
120
- "suffix": "igiven.com",
121
- "apiUrl": "https://mail.igiven.com/api/latest-email",
122
- "token": this.env.PROOF_IGIVEN_TOKEN
123
- }
124
- ];
125
-
126
- const suffix = proofEmail.substring(proofEmail.indexOf('@') + 1);
127
- const proofConfig = proof.find(p => p.suffix === suffix)!;
128
  const verificationCode = await getVerificationCode(
129
  proofConfig.apiUrl,
130
  proofConfig.token!,
 
74
  await page.waitForSelector('#idA_PWD_SwitchToPassword', { timeout: 3000 });
75
  await page.click('#idA_PWD_SwitchToPassword');
76
  } catch (error) {
77
+ console.log(account.email, `没有旧版切换到密码登录,继续执行: ${error}`);
78
  }
79
 
80
+ try {
81
+ const passwordButtonByRole = page.getByRole('button', { name: '使用密码' });
82
+ if (await passwordButtonByRole.isVisible({ timeout: 3000 })) {
83
+ await passwordButtonByRole.click();
84
+ }
85
+ } catch (error) {
86
+ console.log(account.email, `没有新版切换到密码登录,继续执行: ${error}`);
87
+ }
88
  await page.waitForURL("https://login.live.com/**");
89
  await page.fill('input[type="password"]', account.password);
90
  await page.fill('input[type="password"]', account.password);
91
  await page.click('button[type="submit"]');
92
 
93
+
94
+ const proofEmail = account.proofEmail;
95
+
96
+ try {
97
+ await page.waitForURL((url) => {
98
+ return url.href.startsWith('https://account.live.com/recover');
99
+ }, { timeout: 3000 });
100
+ await page.click('input[type="submit"]#iLandingViewAction');
101
+ const timestamp = Math.floor(Date.now() / 1000);
102
+ await page.fill("#iProofEmail", proofEmail)
103
+ await page.click('input[type="submit"]')
104
+
105
+ const proofConfig = this.getProofConfig(proofEmail);
106
+ const verificationCode = await getVerificationCode(proofConfig.apiUrl, proofConfig.token!, proofEmail, timestamp);
107
+ await page.fill('input[type="tel"]', verificationCode);
108
+ await page.click('input[type="submit"]');
109
+
110
+ //可能需要修改密码..这里就不处理了
111
+ } catch (error) {
112
+ console.log(account.email, `没有帮助我们保护帐户确认,继续执行: ${error}`);
113
+ }
114
+
115
  try {
116
+ //新版的邮箱验证
117
+ await page.waitForURL((url) => {
118
+ return url.href.startsWith('https://login.live.com/oauth20_authorize.srf');
119
+ }, { timeout: 3000 });
120
+
121
+ const timestamp = Math.floor(Date.now() / 1000);
122
+ await page.fill("#proof-confirmation-email-input", proofEmail)
123
+ await page.click('button[type="submit"]')
124
+
125
+ const proofConfig = this.getProofConfig(proofEmail);
126
+ const verificationCode = await getVerificationCode(proofConfig.apiUrl, proofConfig.token!, proofEmail, timestamp);
127
+ await page.fill('input#codeEntry-0', verificationCode[0]);
128
+ await page.fill('input#codeEntry-1', verificationCode[1]);
129
+ await page.fill('input#codeEntry-2', verificationCode[2]);
130
+ await page.fill('input#codeEntry-3', verificationCode[3]);
131
+ await page.fill('input#codeEntry-4', verificationCode[4]);
132
+ await page.fill('input#codeEntry-5', verificationCode[5]);
133
+
134
+ //可能需要修改密码..这里就不处理了
135
  } catch (error) {
136
+ console.log(account.email, `没有帮助我们保护帐户确认,继续执行: ${error}`);
137
  }
138
+
139
+ }
140
+
141
+ private getProofConfig(proofEmail: string) {
142
+ const proof = [
143
+ {
144
+ "suffix": "godgodgame.com",
145
+ "apiUrl": "https://seedmail.igiven.com/api/latest-email",
146
+ "token": this.env.PROOF_GODGODGAME_TOKEN
147
+ },
148
+ {
149
+ "suffix": "igiven.com",
150
+ "apiUrl": "https://mail.igiven.com/api/latest-email",
151
+ "token": this.env.PROOF_IGIVEN_TOKEN
152
+ }
153
+ ];
154
+
155
+ const suffix = proofEmail.substring(proofEmail.indexOf('@') + 1);
156
+ const proofConfig = proof.find(p => p.suffix === suffix)!;
157
+ return proofConfig;
158
  }
159
 
160
+
161
  private async handleMultiFactorAuth(page: Page, account: Account) {
162
  for (let i = 0; i < 3; i++) {
163
  try {
 
178
  await page.fill("#iProofEmail", proofEmail);
179
  await page.click('input[type="submit"]');
180
 
181
+ const proofConfig = this.getProofConfig(proofEmail);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  const verificationCode = await getVerificationCode(
183
  proofConfig.apiUrl,
184
  proofConfig.token!,
src/App.vue CHANGED
@@ -61,7 +61,7 @@ const jwtToken = parseToken();
61
  <template #logo>
62
  <router-link to="/" class="flex items-center gap-2 p-4">
63
  <img :src="logo" alt="logo" class="w-8 h-8" />
64
- <h1 class="text-xl font-bold text-white">SEED LOG</h1>
65
  </router-link>
66
  </template>
67
  <t-menu-item v-for="item in menu" :key="item.path" :value="item.path" :to="item.path"
@@ -80,7 +80,7 @@ const jwtToken = parseToken();
80
  <template #logo>
81
  <router-link to="/" class="flex items-center gap-2">
82
  <img :src="logo" alt="logo" class="w-10 h-10 transition-transform hover:scale-110" />
83
- <h1 class="text-2xl font-bold text-white tracking-wider">SEED LOG</h1>
84
  </router-link>
85
  </template>
86
  <t-menu-item v-for="item in menu" :key="item.path" :value="item.path" :to="item.path"
 
61
  <template #logo>
62
  <router-link to="/" class="flex items-center gap-2 p-4">
63
  <img :src="logo" alt="logo" class="w-8 h-8" />
64
+ <h1 class="text-xl font-bold text-white">MS MAIL</h1>
65
  </router-link>
66
  </template>
67
  <t-menu-item v-for="item in menu" :key="item.path" :value="item.path" :to="item.path"
 
80
  <template #logo>
81
  <router-link to="/" class="flex items-center gap-2">
82
  <img :src="logo" alt="logo" class="w-10 h-10 transition-transform hover:scale-110" />
83
+ <h1 class="text-2xl font-bold text-white tracking-wider">MS MAIL</h1>
84
  </router-link>
85
  </template>
86
  <t-menu-item v-for="item in menu" :key="item.path" :value="item.path" :to="item.path"