File size: 1,902 Bytes
f9e1174
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// 配置文件
import dotenv from 'dotenv';

// 加载环境变量
dotenv.config();

const config = {
  // WebIDE URL - 可以通过环境变量 WEBIDE_URL 覆盖
  webideUrl: process.env.WEBIDE_URL || 'https://3e8ccf585a6c4fbd9f1aa9f05ac5e415.ap-shanghai.cloudstudio.club/?mode=edit',

  // 调度器时间间隔(毫秒)- 可以通过环境变量 SCHEDULER_INTERVAL 覆盖
  // 默认为 10 分钟 (10 * 60 * 1000 = 600000 毫秒)
  schedulerInterval: parseInt(process.env.SCHEDULER_INTERVAL) || 10 * 60 * 1000,

  // Cookie文件路径
  cookieFile: './cookies.json',

  // 浏览器配置
  browserOptions: {
    // 默认无头模式,可通过环境变量 HEADLESS=false 设置为有头模式
    // 支持 false/False/FALSE 等不同大小写形式
    headless: (process.env.HEADLESS || 'true').toLowerCase() !== 'false',
    slowMo: 100,     // 操作间隔时间(毫秒)
    timeout: 30000,   // 超时时间(毫秒)
    executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH,
  },

  // 要执行的命令
  command: 'service cron start',

  // 截图保存目录
  screenshotDir: './screenshots',

  // 等待时间配置(毫秒)
  waitTimes: {
    pageLoad: 5000,      // 页面加载等待时间
    terminalOpen: 3000,  // 终端打开等待时间
    commandExecution: 2000 // 命令执行等待时间
  },

  // 页面选择器(需要根据实际登录页面调整)
  selectors: {
    // 这些选择器需要根据实际的登录页面进行调整
    editor: '.monaco-grid-view',
    dialogButton: '.monaco-dialog-modal-block .dialog-buttons a.monaco-button',
    terminals: [
      '.terminal',
      // '.xterm',
      // '.console',
      // '.terminal-container',
      // '.xterm-screen',
      // '.monaco-workbench .part.panel .terminal',
      // '[data-testid="terminal"]',
      // '.integrated-terminal'
    ],
  }
};

export default config;