github-actions[bot] commited on
Commit
c76a8db
·
1 Parent(s): bce8f3a

Update from GitHub Actions

Browse files
Files changed (1) hide show
  1. src/index.ts +13 -17
src/index.ts CHANGED
@@ -240,23 +240,19 @@ app.get('/genspark', async (c) => {
240
  const headers = Object.fromEntries(c.req.raw.headers)
241
  // Get the cookie string from headers
242
  const cookieString = headers.cookie || '';
243
- let gensparkPage = null
244
- if (lastCookies != cookieString) {
245
- // Parse cookies into an array of objects with name and value properties
246
- const cookies = cookieString.split(';').map(cookie => {
247
- const [name, value] = cookie.trim().split('=');
248
- return { name, value, domain: 'www.genspark.ai', path: '/' };
249
- }).filter(cookie => cookie.name && cookie.value);
250
- gensparkPage = await initGensparkPage(cookies)
251
- //刷新页面以确保获取新令牌
252
- await gensparkPage.goto('https://www.genspark.ai/agents?type=moa_chat', {
253
- waitUntil: 'networkidle',
254
- timeout: 3600000
255
- })
256
- }
257
- else {
258
- gensparkPage = await initGensparkPage()
259
- }
260
 
261
  // 执行脚本获取令牌
262
  const token = await gensparkPage.evaluate(() => {
 
240
  const headers = Object.fromEntries(c.req.raw.headers)
241
  // Get the cookie string from headers
242
  const cookieString = headers.cookie || '';
243
+ // Parse cookies into an array of objects with name and value properties
244
+ const cookies = cookieString.split(';').map(cookie => {
245
+ const [name, value] = cookie.trim().split('=');
246
+ return { name, value, domain: 'www.genspark.ai', path: '/' };
247
+ }).filter(cookie => cookie.name && cookie.value);
248
+
249
+ const gensparkPage = await initGensparkPage(cookies)
250
+
251
+ //刷新页面以确保获取新令牌
252
+ await gensparkPage.goto('https://www.genspark.ai/agents?type=moa_chat', {
253
+ waitUntil: 'networkidle',
254
+ timeout: 3600000
255
+ })
 
 
 
 
256
 
257
  // 执行脚本获取令牌
258
  const token = await gensparkPage.evaluate(() => {