clash-linux commited on
Commit
8c0c410
·
verified ·
1 Parent(s): 2a9cf19

Upload 17 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ src/proxy/chrome_proxy_server_android_arm64 filter=lfs diff=lfs merge=lfs -text
37
+ src/proxy/chrome_proxy_server_linux_amd64 filter=lfs diff=lfs merge=lfs -text
38
+ src/proxy/chrome_proxy_server_windows_amd64.exe filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 依赖
2
+ node_modules/
3
+ npm-debug.log
4
+ yarn-debug.log
5
+ yarn-error.log
6
+
7
+ # 环境变量
8
+ .env
9
+ .env.local
10
+ .env.development.local
11
+ .env.test.local
12
+ .env.production.local
13
+
14
+ # 日志
15
+ logs
16
+ *.log
17
+
18
+ # 运行时数据
19
+ pids
20
+ *.pid
21
+ *.seed
22
+ *.pid.lock
23
+
24
+ # 目录
25
+ dist/
26
+ build/
27
+ coverage/
28
+
29
+ # 其他
30
+ .DS_Store
31
+ .idea/
32
+ .vscode/
33
+ *.swp
34
+ *.swo
Dockerfile ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official Node.js runtime as a parent image
2
+ FROM node:18-slim
3
+
4
+ # Set the working directory in the container
5
+ WORKDIR /app
6
+
7
+ # Copy package.json and package-lock.json to the working directory
8
+ COPY package*.json ./
9
+
10
+ # Install app dependencies
11
+ # Using --production flag to install only production dependencies
12
+ # Playwright needs special handling to download browsers
13
+ # We need to install dependencies first to make sure Playwright downloads its browsers.
14
+ RUN npm install --production
15
+
16
+ # Copy the rest of the application source code to the working directory
17
+ COPY . .
18
+
19
+ # Switch back to root user to install proxychains
20
+ USER root
21
+
22
+ # Install proxychains4
23
+ RUN apt-get update && apt-get install -y proxychains4 && rm -rf /var/lib/apt/lists/*
24
+
25
+ # Grant execute permission to the proxy server binary for the root user
26
+ RUN chmod +x /app/src/proxy/chrome_proxy_server_linux_amd64
27
+
28
+ # Change ownership of the app directory to the node user
29
+ RUN chown -R node:node /app
30
+
31
+ # Switch to a non-root user for security
32
+ USER node
33
+
34
+ # Make port 7860 available to the world outside this container
35
+ EXPOSE 7860
36
+
37
+ # 确认proxychains配置可用
38
+ RUN echo '检查文件存在:' && ls -l /app/proxychains.conf || echo '文件不存在' && \
39
+ echo 'proxychains.conf 内容:' && cat /app/proxychains.conf || echo '无法读取文件' && \
40
+ mkdir -p /etc/proxychains && cp /app/proxychains.conf /etc/proxychains/ && \
41
+ echo '复制配置到全局目录'
42
+
43
+ # Define the command to run the app
44
+ CMD ["npm", "start"]
README.md CHANGED
@@ -1,10 +1,216 @@
1
- ---
2
- title: Notion
3
- emoji: 🐠
4
- colorFrom: purple
5
- colorTo: purple
6
- sdk: docker
7
- pinned: false
8
- ---
9
-
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Notion2API Node.js
3
+ emoji: 🚀
4
+ colorFrom: green
5
+ colorTo: blue
6
+ sdk: docker
7
+ app_port: 7860
8
+ pinned: false
9
+ ---
10
+ # Notion API 轻量级客户端
11
+
12
+ 这个项目提供了一个轻量级的 Notion API 客户端,可以在资源受限的环境(如 Termux)中运行,无需完整的浏览器环境。
13
+
14
+ ## 特点
15
+
16
+ - 使用 `node-fetch` 代替 Playwright 浏览器自动化
17
+ - 轻量级设计,适合在移动设备和资源受限环境中运行
18
+ - 支持 Notion AI 的流式响应
19
+ - 兼容 OpenAI API 格式的请求和响应
20
+
21
+ ## 安装
22
+
23
+ ### 依赖项
24
+
25
+ 确保安装以下依赖:
26
+
27
+ ```bash
28
+ npm install
29
+ ```
30
+
31
+ ### 环境变量
32
+
33
+ 创建 `.env` 文件,设置以下环境变量:
34
+
35
+ ```
36
+ NOTION_COOKIE=your_notion_cookie_here
37
+ NOTION_SPACE_ID=optional_space_id
38
+ NOTION_ACTIVE_USER_HEADER=optional_user_id
39
+ PROXY_URL=optional_proxy_url
40
+ PROXY_AUTH_TOKEN=your_auth_token
41
+ PORT=7860
42
+ ```
43
+
44
+ ## 使用方法
45
+
46
+ ### 启动服务
47
+
48
+ 运行轻量级服务器:
49
+
50
+ ```bash
51
+ npm start
52
+ ```
53
+
54
+ 服务器将在指定端口(默认 7860)启动。
55
+
56
+ 如果需要使用原始的基于 Playwright 的版本(不推荐在 Termux 中使用):
57
+
58
+ ```bash
59
+ npm run original
60
+ ```
61
+
62
+ ### API 端点
63
+
64
+ - `GET /v1/models` - 获取可用模型列表
65
+ - `POST /v1/chat/completions` - 聊天完成端点
66
+ - `GET /health` - 健康检查
67
+
68
+ ### 在 Termux 中运行
69
+
70
+ 1. 安装 Termux 和 Node.js:
71
+ ```bash
72
+ pkg update
73
+ pkg install nodejs
74
+ ```
75
+
76
+ 2. 克隆项目并安装依赖:
77
+ ```bash
78
+ git clone https://github.com/yourusername/notion2api-nodejs.git
79
+ cd notion2api-nodejs
80
+ npm install
81
+ ```
82
+
83
+ 3. 设置环境变量并运行:
84
+ ```bash
85
+ npm start
86
+ ```
87
+
88
+ ## 作为模块集成
89
+
90
+ 你也可以将轻量级客户端作为模块导入到你自己的项目中:
91
+
92
+ ```javascript
93
+ import {
94
+ initialize,
95
+ streamNotionResponse,
96
+ buildNotionRequest,
97
+ FETCHED_IDS_SUCCESSFULLY
98
+ } from './lightweight-client.js';
99
+
100
+ // 初始化客户端
101
+ await initialize();
102
+
103
+ // 检查是否成功获取 Notion IDs
104
+ if (FETCHED_IDS_SUCCESSFULLY) {
105
+ // 构建请求
106
+ const requestData = {
107
+ notion_model: "openai-gpt-4.1",
108
+ messages: [
109
+ { role: "user", content: "你好,请介绍一下自己" }
110
+ ]
111
+ };
112
+
113
+ const notionRequestBody = buildNotionRequest(requestData);
114
+
115
+ // 获取响应流
116
+ const stream = await streamNotionResponse(notionRequestBody);
117
+
118
+ // 处理响应
119
+ stream.on('data', chunk => {
120
+ console.log(chunk.toString());
121
+ });
122
+ }
123
+ ```
124
+
125
+ ## 故障排除
126
+
127
+ - 如果无法获取 Notion IDs,请确保提供了有效的 NOTION_COOKIE
128
+ - 对于网络问题,可以尝试设置 PROXY_URL
129
+ - 查看日志输出以获取详细的错误信息
130
+
131
+ ## 依赖说明
132
+
133
+ - `node-fetch`: 用于发送 HTTP 请求
134
+ - `jsdom`: 提供 DOM API 的轻量级模拟
135
+ - `dotenv`: 加载环境变量
136
+ - `express`: Web 服务器框架
137
+ - `https-proxy-agent`: 支持 HTTPS 代理
138
+
139
+ ## Cookie管理功能
140
+
141
+ 本项目新增了Cookie管理功能,可以更方便地管理多个Notion Cookie,避免在.env文件中手动编辑长字符串。
142
+
143
+ ### 使用方法
144
+
145
+ #### 1. 通过文件管理Cookie
146
+
147
+ 在项目根目录创建一个`cookies.txt`文件,每行一个完整的Cookie字符串:
148
+
149
+ ```
150
+ cookie1_string_here
151
+ cookie2_string_here
152
+ cookie3_string_here
153
+ ```
154
+
155
+ 然后在`.env`文件中设置:
156
+
157
+ ```
158
+ COOKIE_FILE=cookies.txt
159
+ ```
160
+
161
+ 系统启动时会自动从该文件加载Cookie。
162
+
163
+ #### 2. 使用Cookie管理工具
164
+
165
+ 项目提供了一个命令行工具来管理Cookie:
166
+
167
+ ```bash
168
+ # 使用npm脚本运行
169
+ npm run cookie
170
+
171
+ # 或者全局安装后运行
172
+ npm link
173
+ notion-cookie
174
+ ```
175
+
176
+ 命令行工具支持以下功能:
177
+
178
+ - `help`: 显示帮助信息
179
+ - `list`: 列出所有已加载的Cookie
180
+ - `add`: 添加新的Cookie
181
+ - `validate`: 验证所有Cookie的有效性
182
+ - `remove`: 删除指定的Cookie
183
+ - `save`: 保存Cookie到文件
184
+ - `load`: 从文件加载Cookie
185
+ - `exit`: 退出程序
186
+
187
+ ### Cookie轮询机制
188
+
189
+ 系统会自动轮询使用所有有效的Cookie,当一个Cookie返回401错误(未授权)时,会自动将其标记为无效并切换到下一个Cookie。这样可以提高系统的可靠性和可用性。
190
+
191
+ ### 文件格式支持
192
+
193
+ Cookie管理器支持两种文件格式:
194
+
195
+ 1. 文本格式(.txt):每行一个Cookie
196
+ 2. JSON格式(.json):包含Cookie数组的JSON文件
197
+
198
+ ```json
199
+ {
200
+ "cookies": [
201
+ "cookie1_string_here",
202
+ "cookie2_string_here"
203
+ ],
204
+ "updatedAt": "2023-08-01T12:00:00.000Z",
205
+ "count": 2
206
+ }
207
+ ```
208
+
209
+ 或者简单的数组:
210
+
211
+ ```json
212
+ [
213
+ "cookie1_string_here",
214
+ "cookie2_string_here"
215
+ ]
216
+ ```
package-lock.json ADDED
@@ -0,0 +1,2044 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "notion2api-nodejs",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "notion2api-nodejs",
9
+ "version": "1.0.0",
10
+ "license": "MIT",
11
+ "dependencies": {
12
+ "axios": "^1.9.0",
13
+ "chalk": "^4.1.2",
14
+ "dotenv": "^16.3.1",
15
+ "express": "^4.18.2",
16
+ "https-proxy-agent": "^7.0.2",
17
+ "jsdom": "^22.1.0",
18
+ "node-fetch": "^3.3.2",
19
+ "playwright": "^1.40.1"
20
+ },
21
+ "bin": {
22
+ "notion-cookie": "src/cookie-cli.js"
23
+ },
24
+ "devDependencies": {
25
+ "nodemon": "^3.0.2"
26
+ }
27
+ },
28
+ "node_modules/@tootallnate/once": {
29
+ "version": "2.0.0",
30
+ "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz",
31
+ "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==",
32
+ "license": "MIT",
33
+ "engines": {
34
+ "node": ">= 10"
35
+ }
36
+ },
37
+ "node_modules/abab": {
38
+ "version": "2.0.6",
39
+ "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz",
40
+ "integrity": "sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==",
41
+ "deprecated": "Use your platform's native atob() and btoa() methods instead",
42
+ "license": "BSD-3-Clause"
43
+ },
44
+ "node_modules/accepts": {
45
+ "version": "1.3.8",
46
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
47
+ "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
48
+ "license": "MIT",
49
+ "dependencies": {
50
+ "mime-types": "~2.1.34",
51
+ "negotiator": "0.6.3"
52
+ },
53
+ "engines": {
54
+ "node": ">= 0.6"
55
+ }
56
+ },
57
+ "node_modules/agent-base": {
58
+ "version": "7.1.3",
59
+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz",
60
+ "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==",
61
+ "license": "MIT",
62
+ "engines": {
63
+ "node": ">= 14"
64
+ }
65
+ },
66
+ "node_modules/ansi-styles": {
67
+ "version": "4.3.0",
68
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
69
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
70
+ "license": "MIT",
71
+ "dependencies": {
72
+ "color-convert": "^2.0.1"
73
+ },
74
+ "engines": {
75
+ "node": ">=8"
76
+ },
77
+ "funding": {
78
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
79
+ }
80
+ },
81
+ "node_modules/anymatch": {
82
+ "version": "3.1.3",
83
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
84
+ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
85
+ "dev": true,
86
+ "license": "ISC",
87
+ "dependencies": {
88
+ "normalize-path": "^3.0.0",
89
+ "picomatch": "^2.0.4"
90
+ },
91
+ "engines": {
92
+ "node": ">= 8"
93
+ }
94
+ },
95
+ "node_modules/array-flatten": {
96
+ "version": "1.1.1",
97
+ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
98
+ "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
99
+ "license": "MIT"
100
+ },
101
+ "node_modules/asynckit": {
102
+ "version": "0.4.0",
103
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
104
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
105
+ "license": "MIT"
106
+ },
107
+ "node_modules/axios": {
108
+ "version": "1.9.0",
109
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.9.0.tgz",
110
+ "integrity": "sha512-re4CqKTJaURpzbLHtIi6XpDv20/CnpXOtjRY5/CU32L8gU8ek9UIivcfvSWvmKEngmVbrUtPpdDwWDWL7DNHvg==",
111
+ "license": "MIT",
112
+ "dependencies": {
113
+ "follow-redirects": "^1.15.6",
114
+ "form-data": "^4.0.0",
115
+ "proxy-from-env": "^1.1.0"
116
+ }
117
+ },
118
+ "node_modules/balanced-match": {
119
+ "version": "1.0.2",
120
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
121
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
122
+ "dev": true,
123
+ "license": "MIT"
124
+ },
125
+ "node_modules/binary-extensions": {
126
+ "version": "2.3.0",
127
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
128
+ "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
129
+ "dev": true,
130
+ "license": "MIT",
131
+ "engines": {
132
+ "node": ">=8"
133
+ },
134
+ "funding": {
135
+ "url": "https://github.com/sponsors/sindresorhus"
136
+ }
137
+ },
138
+ "node_modules/body-parser": {
139
+ "version": "1.20.3",
140
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz",
141
+ "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==",
142
+ "license": "MIT",
143
+ "dependencies": {
144
+ "bytes": "3.1.2",
145
+ "content-type": "~1.0.5",
146
+ "debug": "2.6.9",
147
+ "depd": "2.0.0",
148
+ "destroy": "1.2.0",
149
+ "http-errors": "2.0.0",
150
+ "iconv-lite": "0.4.24",
151
+ "on-finished": "2.4.1",
152
+ "qs": "6.13.0",
153
+ "raw-body": "2.5.2",
154
+ "type-is": "~1.6.18",
155
+ "unpipe": "1.0.0"
156
+ },
157
+ "engines": {
158
+ "node": ">= 0.8",
159
+ "npm": "1.2.8000 || >= 1.4.16"
160
+ }
161
+ },
162
+ "node_modules/brace-expansion": {
163
+ "version": "1.1.11",
164
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
165
+ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
166
+ "dev": true,
167
+ "license": "MIT",
168
+ "dependencies": {
169
+ "balanced-match": "^1.0.0",
170
+ "concat-map": "0.0.1"
171
+ }
172
+ },
173
+ "node_modules/braces": {
174
+ "version": "3.0.3",
175
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
176
+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
177
+ "dev": true,
178
+ "license": "MIT",
179
+ "dependencies": {
180
+ "fill-range": "^7.1.1"
181
+ },
182
+ "engines": {
183
+ "node": ">=8"
184
+ }
185
+ },
186
+ "node_modules/bytes": {
187
+ "version": "3.1.2",
188
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
189
+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
190
+ "license": "MIT",
191
+ "engines": {
192
+ "node": ">= 0.8"
193
+ }
194
+ },
195
+ "node_modules/call-bind-apply-helpers": {
196
+ "version": "1.0.2",
197
+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
198
+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
199
+ "license": "MIT",
200
+ "dependencies": {
201
+ "es-errors": "^1.3.0",
202
+ "function-bind": "^1.1.2"
203
+ },
204
+ "engines": {
205
+ "node": ">= 0.4"
206
+ }
207
+ },
208
+ "node_modules/call-bound": {
209
+ "version": "1.0.4",
210
+ "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
211
+ "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
212
+ "license": "MIT",
213
+ "dependencies": {
214
+ "call-bind-apply-helpers": "^1.0.2",
215
+ "get-intrinsic": "^1.3.0"
216
+ },
217
+ "engines": {
218
+ "node": ">= 0.4"
219
+ },
220
+ "funding": {
221
+ "url": "https://github.com/sponsors/ljharb"
222
+ }
223
+ },
224
+ "node_modules/chalk": {
225
+ "version": "4.1.2",
226
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
227
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
228
+ "license": "MIT",
229
+ "dependencies": {
230
+ "ansi-styles": "^4.1.0",
231
+ "supports-color": "^7.1.0"
232
+ },
233
+ "engines": {
234
+ "node": ">=10"
235
+ },
236
+ "funding": {
237
+ "url": "https://github.com/chalk/chalk?sponsor=1"
238
+ }
239
+ },
240
+ "node_modules/chalk/node_modules/has-flag": {
241
+ "version": "4.0.0",
242
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
243
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
244
+ "license": "MIT",
245
+ "engines": {
246
+ "node": ">=8"
247
+ }
248
+ },
249
+ "node_modules/chalk/node_modules/supports-color": {
250
+ "version": "7.2.0",
251
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
252
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
253
+ "license": "MIT",
254
+ "dependencies": {
255
+ "has-flag": "^4.0.0"
256
+ },
257
+ "engines": {
258
+ "node": ">=8"
259
+ }
260
+ },
261
+ "node_modules/chokidar": {
262
+ "version": "3.6.0",
263
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
264
+ "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
265
+ "dev": true,
266
+ "license": "MIT",
267
+ "dependencies": {
268
+ "anymatch": "~3.1.2",
269
+ "braces": "~3.0.2",
270
+ "glob-parent": "~5.1.2",
271
+ "is-binary-path": "~2.1.0",
272
+ "is-glob": "~4.0.1",
273
+ "normalize-path": "~3.0.0",
274
+ "readdirp": "~3.6.0"
275
+ },
276
+ "engines": {
277
+ "node": ">= 8.10.0"
278
+ },
279
+ "funding": {
280
+ "url": "https://paulmillr.com/funding/"
281
+ },
282
+ "optionalDependencies": {
283
+ "fsevents": "~2.3.2"
284
+ }
285
+ },
286
+ "node_modules/color-convert": {
287
+ "version": "2.0.1",
288
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
289
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
290
+ "license": "MIT",
291
+ "dependencies": {
292
+ "color-name": "~1.1.4"
293
+ },
294
+ "engines": {
295
+ "node": ">=7.0.0"
296
+ }
297
+ },
298
+ "node_modules/color-name": {
299
+ "version": "1.1.4",
300
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
301
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
302
+ "license": "MIT"
303
+ },
304
+ "node_modules/combined-stream": {
305
+ "version": "1.0.8",
306
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
307
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
308
+ "license": "MIT",
309
+ "dependencies": {
310
+ "delayed-stream": "~1.0.0"
311
+ },
312
+ "engines": {
313
+ "node": ">= 0.8"
314
+ }
315
+ },
316
+ "node_modules/concat-map": {
317
+ "version": "0.0.1",
318
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
319
+ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
320
+ "dev": true,
321
+ "license": "MIT"
322
+ },
323
+ "node_modules/content-disposition": {
324
+ "version": "0.5.4",
325
+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
326
+ "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
327
+ "license": "MIT",
328
+ "dependencies": {
329
+ "safe-buffer": "5.2.1"
330
+ },
331
+ "engines": {
332
+ "node": ">= 0.6"
333
+ }
334
+ },
335
+ "node_modules/content-type": {
336
+ "version": "1.0.5",
337
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
338
+ "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
339
+ "license": "MIT",
340
+ "engines": {
341
+ "node": ">= 0.6"
342
+ }
343
+ },
344
+ "node_modules/cookie": {
345
+ "version": "0.7.1",
346
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz",
347
+ "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==",
348
+ "license": "MIT",
349
+ "engines": {
350
+ "node": ">= 0.6"
351
+ }
352
+ },
353
+ "node_modules/cookie-signature": {
354
+ "version": "1.0.6",
355
+ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
356
+ "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==",
357
+ "license": "MIT"
358
+ },
359
+ "node_modules/cssstyle": {
360
+ "version": "3.0.0",
361
+ "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-3.0.0.tgz",
362
+ "integrity": "sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg==",
363
+ "license": "MIT",
364
+ "dependencies": {
365
+ "rrweb-cssom": "^0.6.0"
366
+ },
367
+ "engines": {
368
+ "node": ">=14"
369
+ }
370
+ },
371
+ "node_modules/data-uri-to-buffer": {
372
+ "version": "4.0.1",
373
+ "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
374
+ "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
375
+ "license": "MIT",
376
+ "engines": {
377
+ "node": ">= 12"
378
+ }
379
+ },
380
+ "node_modules/data-urls": {
381
+ "version": "4.0.0",
382
+ "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-4.0.0.tgz",
383
+ "integrity": "sha512-/mMTei/JXPqvFqQtfyTowxmJVwr2PVAeCcDxyFf6LhoOu/09TX2OX3kb2wzi4DMXcfj4OItwDOnhl5oziPnT6g==",
384
+ "license": "MIT",
385
+ "dependencies": {
386
+ "abab": "^2.0.6",
387
+ "whatwg-mimetype": "^3.0.0",
388
+ "whatwg-url": "^12.0.0"
389
+ },
390
+ "engines": {
391
+ "node": ">=14"
392
+ }
393
+ },
394
+ "node_modules/debug": {
395
+ "version": "2.6.9",
396
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
397
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
398
+ "license": "MIT",
399
+ "dependencies": {
400
+ "ms": "2.0.0"
401
+ }
402
+ },
403
+ "node_modules/decimal.js": {
404
+ "version": "10.5.0",
405
+ "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.5.0.tgz",
406
+ "integrity": "sha512-8vDa8Qxvr/+d94hSh5P3IJwI5t8/c0KsMp+g8bNw9cY2icONa5aPfvKeieW1WlG0WQYwwhJ7mjui2xtiePQSXw==",
407
+ "license": "MIT"
408
+ },
409
+ "node_modules/delayed-stream": {
410
+ "version": "1.0.0",
411
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
412
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
413
+ "license": "MIT",
414
+ "engines": {
415
+ "node": ">=0.4.0"
416
+ }
417
+ },
418
+ "node_modules/depd": {
419
+ "version": "2.0.0",
420
+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
421
+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
422
+ "license": "MIT",
423
+ "engines": {
424
+ "node": ">= 0.8"
425
+ }
426
+ },
427
+ "node_modules/destroy": {
428
+ "version": "1.2.0",
429
+ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
430
+ "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
431
+ "license": "MIT",
432
+ "engines": {
433
+ "node": ">= 0.8",
434
+ "npm": "1.2.8000 || >= 1.4.16"
435
+ }
436
+ },
437
+ "node_modules/domexception": {
438
+ "version": "4.0.0",
439
+ "resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz",
440
+ "integrity": "sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==",
441
+ "deprecated": "Use your platform's native DOMException instead",
442
+ "license": "MIT",
443
+ "dependencies": {
444
+ "webidl-conversions": "^7.0.0"
445
+ },
446
+ "engines": {
447
+ "node": ">=12"
448
+ }
449
+ },
450
+ "node_modules/dotenv": {
451
+ "version": "16.5.0",
452
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.5.0.tgz",
453
+ "integrity": "sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==",
454
+ "license": "BSD-2-Clause",
455
+ "engines": {
456
+ "node": ">=12"
457
+ },
458
+ "funding": {
459
+ "url": "https://dotenvx.com"
460
+ }
461
+ },
462
+ "node_modules/dunder-proto": {
463
+ "version": "1.0.1",
464
+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
465
+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
466
+ "license": "MIT",
467
+ "dependencies": {
468
+ "call-bind-apply-helpers": "^1.0.1",
469
+ "es-errors": "^1.3.0",
470
+ "gopd": "^1.2.0"
471
+ },
472
+ "engines": {
473
+ "node": ">= 0.4"
474
+ }
475
+ },
476
+ "node_modules/ee-first": {
477
+ "version": "1.1.1",
478
+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
479
+ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
480
+ "license": "MIT"
481
+ },
482
+ "node_modules/encodeurl": {
483
+ "version": "2.0.0",
484
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
485
+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
486
+ "license": "MIT",
487
+ "engines": {
488
+ "node": ">= 0.8"
489
+ }
490
+ },
491
+ "node_modules/entities": {
492
+ "version": "6.0.0",
493
+ "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.0.tgz",
494
+ "integrity": "sha512-aKstq2TDOndCn4diEyp9Uq/Flu2i1GlLkc6XIDQSDMuaFE3OPW5OphLCyQ5SpSJZTb4reN+kTcYru5yIfXoRPw==",
495
+ "license": "BSD-2-Clause",
496
+ "engines": {
497
+ "node": ">=0.12"
498
+ },
499
+ "funding": {
500
+ "url": "https://github.com/fb55/entities?sponsor=1"
501
+ }
502
+ },
503
+ "node_modules/es-define-property": {
504
+ "version": "1.0.1",
505
+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
506
+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
507
+ "license": "MIT",
508
+ "engines": {
509
+ "node": ">= 0.4"
510
+ }
511
+ },
512
+ "node_modules/es-errors": {
513
+ "version": "1.3.0",
514
+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
515
+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
516
+ "license": "MIT",
517
+ "engines": {
518
+ "node": ">= 0.4"
519
+ }
520
+ },
521
+ "node_modules/es-object-atoms": {
522
+ "version": "1.1.1",
523
+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
524
+ "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
525
+ "license": "MIT",
526
+ "dependencies": {
527
+ "es-errors": "^1.3.0"
528
+ },
529
+ "engines": {
530
+ "node": ">= 0.4"
531
+ }
532
+ },
533
+ "node_modules/es-set-tostringtag": {
534
+ "version": "2.1.0",
535
+ "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
536
+ "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
537
+ "license": "MIT",
538
+ "dependencies": {
539
+ "es-errors": "^1.3.0",
540
+ "get-intrinsic": "^1.2.6",
541
+ "has-tostringtag": "^1.0.2",
542
+ "hasown": "^2.0.2"
543
+ },
544
+ "engines": {
545
+ "node": ">= 0.4"
546
+ }
547
+ },
548
+ "node_modules/escape-html": {
549
+ "version": "1.0.3",
550
+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
551
+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
552
+ "license": "MIT"
553
+ },
554
+ "node_modules/etag": {
555
+ "version": "1.8.1",
556
+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
557
+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
558
+ "license": "MIT",
559
+ "engines": {
560
+ "node": ">= 0.6"
561
+ }
562
+ },
563
+ "node_modules/express": {
564
+ "version": "4.21.2",
565
+ "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz",
566
+ "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==",
567
+ "license": "MIT",
568
+ "dependencies": {
569
+ "accepts": "~1.3.8",
570
+ "array-flatten": "1.1.1",
571
+ "body-parser": "1.20.3",
572
+ "content-disposition": "0.5.4",
573
+ "content-type": "~1.0.4",
574
+ "cookie": "0.7.1",
575
+ "cookie-signature": "1.0.6",
576
+ "debug": "2.6.9",
577
+ "depd": "2.0.0",
578
+ "encodeurl": "~2.0.0",
579
+ "escape-html": "~1.0.3",
580
+ "etag": "~1.8.1",
581
+ "finalhandler": "1.3.1",
582
+ "fresh": "0.5.2",
583
+ "http-errors": "2.0.0",
584
+ "merge-descriptors": "1.0.3",
585
+ "methods": "~1.1.2",
586
+ "on-finished": "2.4.1",
587
+ "parseurl": "~1.3.3",
588
+ "path-to-regexp": "0.1.12",
589
+ "proxy-addr": "~2.0.7",
590
+ "qs": "6.13.0",
591
+ "range-parser": "~1.2.1",
592
+ "safe-buffer": "5.2.1",
593
+ "send": "0.19.0",
594
+ "serve-static": "1.16.2",
595
+ "setprototypeof": "1.2.0",
596
+ "statuses": "2.0.1",
597
+ "type-is": "~1.6.18",
598
+ "utils-merge": "1.0.1",
599
+ "vary": "~1.1.2"
600
+ },
601
+ "engines": {
602
+ "node": ">= 0.10.0"
603
+ },
604
+ "funding": {
605
+ "type": "opencollective",
606
+ "url": "https://opencollective.com/express"
607
+ }
608
+ },
609
+ "node_modules/fetch-blob": {
610
+ "version": "3.2.0",
611
+ "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
612
+ "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
613
+ "funding": [
614
+ {
615
+ "type": "github",
616
+ "url": "https://github.com/sponsors/jimmywarting"
617
+ },
618
+ {
619
+ "type": "paypal",
620
+ "url": "https://paypal.me/jimmywarting"
621
+ }
622
+ ],
623
+ "license": "MIT",
624
+ "dependencies": {
625
+ "node-domexception": "^1.0.0",
626
+ "web-streams-polyfill": "^3.0.3"
627
+ },
628
+ "engines": {
629
+ "node": "^12.20 || >= 14.13"
630
+ }
631
+ },
632
+ "node_modules/fill-range": {
633
+ "version": "7.1.1",
634
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
635
+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
636
+ "dev": true,
637
+ "license": "MIT",
638
+ "dependencies": {
639
+ "to-regex-range": "^5.0.1"
640
+ },
641
+ "engines": {
642
+ "node": ">=8"
643
+ }
644
+ },
645
+ "node_modules/finalhandler": {
646
+ "version": "1.3.1",
647
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz",
648
+ "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==",
649
+ "license": "MIT",
650
+ "dependencies": {
651
+ "debug": "2.6.9",
652
+ "encodeurl": "~2.0.0",
653
+ "escape-html": "~1.0.3",
654
+ "on-finished": "2.4.1",
655
+ "parseurl": "~1.3.3",
656
+ "statuses": "2.0.1",
657
+ "unpipe": "~1.0.0"
658
+ },
659
+ "engines": {
660
+ "node": ">= 0.8"
661
+ }
662
+ },
663
+ "node_modules/follow-redirects": {
664
+ "version": "1.15.9",
665
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
666
+ "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
667
+ "funding": [
668
+ {
669
+ "type": "individual",
670
+ "url": "https://github.com/sponsors/RubenVerborgh"
671
+ }
672
+ ],
673
+ "license": "MIT",
674
+ "engines": {
675
+ "node": ">=4.0"
676
+ },
677
+ "peerDependenciesMeta": {
678
+ "debug": {
679
+ "optional": true
680
+ }
681
+ }
682
+ },
683
+ "node_modules/form-data": {
684
+ "version": "4.0.2",
685
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.2.tgz",
686
+ "integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==",
687
+ "license": "MIT",
688
+ "dependencies": {
689
+ "asynckit": "^0.4.0",
690
+ "combined-stream": "^1.0.8",
691
+ "es-set-tostringtag": "^2.1.0",
692
+ "mime-types": "^2.1.12"
693
+ },
694
+ "engines": {
695
+ "node": ">= 6"
696
+ }
697
+ },
698
+ "node_modules/formdata-polyfill": {
699
+ "version": "4.0.10",
700
+ "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
701
+ "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
702
+ "license": "MIT",
703
+ "dependencies": {
704
+ "fetch-blob": "^3.1.2"
705
+ },
706
+ "engines": {
707
+ "node": ">=12.20.0"
708
+ }
709
+ },
710
+ "node_modules/forwarded": {
711
+ "version": "0.2.0",
712
+ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
713
+ "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
714
+ "license": "MIT",
715
+ "engines": {
716
+ "node": ">= 0.6"
717
+ }
718
+ },
719
+ "node_modules/fresh": {
720
+ "version": "0.5.2",
721
+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
722
+ "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
723
+ "license": "MIT",
724
+ "engines": {
725
+ "node": ">= 0.6"
726
+ }
727
+ },
728
+ "node_modules/fsevents": {
729
+ "version": "2.3.3",
730
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
731
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
732
+ "dev": true,
733
+ "hasInstallScript": true,
734
+ "license": "MIT",
735
+ "optional": true,
736
+ "os": [
737
+ "darwin"
738
+ ],
739
+ "engines": {
740
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
741
+ }
742
+ },
743
+ "node_modules/function-bind": {
744
+ "version": "1.1.2",
745
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
746
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
747
+ "license": "MIT",
748
+ "funding": {
749
+ "url": "https://github.com/sponsors/ljharb"
750
+ }
751
+ },
752
+ "node_modules/get-intrinsic": {
753
+ "version": "1.3.0",
754
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
755
+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
756
+ "license": "MIT",
757
+ "dependencies": {
758
+ "call-bind-apply-helpers": "^1.0.2",
759
+ "es-define-property": "^1.0.1",
760
+ "es-errors": "^1.3.0",
761
+ "es-object-atoms": "^1.1.1",
762
+ "function-bind": "^1.1.2",
763
+ "get-proto": "^1.0.1",
764
+ "gopd": "^1.2.0",
765
+ "has-symbols": "^1.1.0",
766
+ "hasown": "^2.0.2",
767
+ "math-intrinsics": "^1.1.0"
768
+ },
769
+ "engines": {
770
+ "node": ">= 0.4"
771
+ },
772
+ "funding": {
773
+ "url": "https://github.com/sponsors/ljharb"
774
+ }
775
+ },
776
+ "node_modules/get-proto": {
777
+ "version": "1.0.1",
778
+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
779
+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
780
+ "license": "MIT",
781
+ "dependencies": {
782
+ "dunder-proto": "^1.0.1",
783
+ "es-object-atoms": "^1.0.0"
784
+ },
785
+ "engines": {
786
+ "node": ">= 0.4"
787
+ }
788
+ },
789
+ "node_modules/glob-parent": {
790
+ "version": "5.1.2",
791
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
792
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
793
+ "dev": true,
794
+ "license": "ISC",
795
+ "dependencies": {
796
+ "is-glob": "^4.0.1"
797
+ },
798
+ "engines": {
799
+ "node": ">= 6"
800
+ }
801
+ },
802
+ "node_modules/gopd": {
803
+ "version": "1.2.0",
804
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
805
+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
806
+ "license": "MIT",
807
+ "engines": {
808
+ "node": ">= 0.4"
809
+ },
810
+ "funding": {
811
+ "url": "https://github.com/sponsors/ljharb"
812
+ }
813
+ },
814
+ "node_modules/has-flag": {
815
+ "version": "3.0.0",
816
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
817
+ "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
818
+ "dev": true,
819
+ "license": "MIT",
820
+ "engines": {
821
+ "node": ">=4"
822
+ }
823
+ },
824
+ "node_modules/has-symbols": {
825
+ "version": "1.1.0",
826
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
827
+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
828
+ "license": "MIT",
829
+ "engines": {
830
+ "node": ">= 0.4"
831
+ },
832
+ "funding": {
833
+ "url": "https://github.com/sponsors/ljharb"
834
+ }
835
+ },
836
+ "node_modules/has-tostringtag": {
837
+ "version": "1.0.2",
838
+ "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
839
+ "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
840
+ "license": "MIT",
841
+ "dependencies": {
842
+ "has-symbols": "^1.0.3"
843
+ },
844
+ "engines": {
845
+ "node": ">= 0.4"
846
+ },
847
+ "funding": {
848
+ "url": "https://github.com/sponsors/ljharb"
849
+ }
850
+ },
851
+ "node_modules/hasown": {
852
+ "version": "2.0.2",
853
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
854
+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
855
+ "license": "MIT",
856
+ "dependencies": {
857
+ "function-bind": "^1.1.2"
858
+ },
859
+ "engines": {
860
+ "node": ">= 0.4"
861
+ }
862
+ },
863
+ "node_modules/html-encoding-sniffer": {
864
+ "version": "3.0.0",
865
+ "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz",
866
+ "integrity": "sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==",
867
+ "license": "MIT",
868
+ "dependencies": {
869
+ "whatwg-encoding": "^2.0.0"
870
+ },
871
+ "engines": {
872
+ "node": ">=12"
873
+ }
874
+ },
875
+ "node_modules/http-errors": {
876
+ "version": "2.0.0",
877
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
878
+ "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
879
+ "license": "MIT",
880
+ "dependencies": {
881
+ "depd": "2.0.0",
882
+ "inherits": "2.0.4",
883
+ "setprototypeof": "1.2.0",
884
+ "statuses": "2.0.1",
885
+ "toidentifier": "1.0.1"
886
+ },
887
+ "engines": {
888
+ "node": ">= 0.8"
889
+ }
890
+ },
891
+ "node_modules/http-proxy-agent": {
892
+ "version": "5.0.0",
893
+ "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz",
894
+ "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==",
895
+ "license": "MIT",
896
+ "dependencies": {
897
+ "@tootallnate/once": "2",
898
+ "agent-base": "6",
899
+ "debug": "4"
900
+ },
901
+ "engines": {
902
+ "node": ">= 6"
903
+ }
904
+ },
905
+ "node_modules/http-proxy-agent/node_modules/agent-base": {
906
+ "version": "6.0.2",
907
+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
908
+ "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
909
+ "license": "MIT",
910
+ "dependencies": {
911
+ "debug": "4"
912
+ },
913
+ "engines": {
914
+ "node": ">= 6.0.0"
915
+ }
916
+ },
917
+ "node_modules/http-proxy-agent/node_modules/debug": {
918
+ "version": "4.4.1",
919
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
920
+ "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==",
921
+ "license": "MIT",
922
+ "dependencies": {
923
+ "ms": "^2.1.3"
924
+ },
925
+ "engines": {
926
+ "node": ">=6.0"
927
+ },
928
+ "peerDependenciesMeta": {
929
+ "supports-color": {
930
+ "optional": true
931
+ }
932
+ }
933
+ },
934
+ "node_modules/http-proxy-agent/node_modules/ms": {
935
+ "version": "2.1.3",
936
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
937
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
938
+ "license": "MIT"
939
+ },
940
+ "node_modules/https-proxy-agent": {
941
+ "version": "7.0.6",
942
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
943
+ "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
944
+ "license": "MIT",
945
+ "dependencies": {
946
+ "agent-base": "^7.1.2",
947
+ "debug": "4"
948
+ },
949
+ "engines": {
950
+ "node": ">= 14"
951
+ }
952
+ },
953
+ "node_modules/https-proxy-agent/node_modules/debug": {
954
+ "version": "4.4.1",
955
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
956
+ "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==",
957
+ "license": "MIT",
958
+ "dependencies": {
959
+ "ms": "^2.1.3"
960
+ },
961
+ "engines": {
962
+ "node": ">=6.0"
963
+ },
964
+ "peerDependenciesMeta": {
965
+ "supports-color": {
966
+ "optional": true
967
+ }
968
+ }
969
+ },
970
+ "node_modules/https-proxy-agent/node_modules/ms": {
971
+ "version": "2.1.3",
972
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
973
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
974
+ "license": "MIT"
975
+ },
976
+ "node_modules/iconv-lite": {
977
+ "version": "0.4.24",
978
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
979
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
980
+ "license": "MIT",
981
+ "dependencies": {
982
+ "safer-buffer": ">= 2.1.2 < 3"
983
+ },
984
+ "engines": {
985
+ "node": ">=0.10.0"
986
+ }
987
+ },
988
+ "node_modules/ignore-by-default": {
989
+ "version": "1.0.1",
990
+ "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
991
+ "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==",
992
+ "dev": true,
993
+ "license": "ISC"
994
+ },
995
+ "node_modules/inherits": {
996
+ "version": "2.0.4",
997
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
998
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
999
+ "license": "ISC"
1000
+ },
1001
+ "node_modules/ipaddr.js": {
1002
+ "version": "1.9.1",
1003
+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
1004
+ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
1005
+ "license": "MIT",
1006
+ "engines": {
1007
+ "node": ">= 0.10"
1008
+ }
1009
+ },
1010
+ "node_modules/is-binary-path": {
1011
+ "version": "2.1.0",
1012
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
1013
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
1014
+ "dev": true,
1015
+ "license": "MIT",
1016
+ "dependencies": {
1017
+ "binary-extensions": "^2.0.0"
1018
+ },
1019
+ "engines": {
1020
+ "node": ">=8"
1021
+ }
1022
+ },
1023
+ "node_modules/is-extglob": {
1024
+ "version": "2.1.1",
1025
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
1026
+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
1027
+ "dev": true,
1028
+ "license": "MIT",
1029
+ "engines": {
1030
+ "node": ">=0.10.0"
1031
+ }
1032
+ },
1033
+ "node_modules/is-glob": {
1034
+ "version": "4.0.3",
1035
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
1036
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
1037
+ "dev": true,
1038
+ "license": "MIT",
1039
+ "dependencies": {
1040
+ "is-extglob": "^2.1.1"
1041
+ },
1042
+ "engines": {
1043
+ "node": ">=0.10.0"
1044
+ }
1045
+ },
1046
+ "node_modules/is-number": {
1047
+ "version": "7.0.0",
1048
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
1049
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
1050
+ "dev": true,
1051
+ "license": "MIT",
1052
+ "engines": {
1053
+ "node": ">=0.12.0"
1054
+ }
1055
+ },
1056
+ "node_modules/is-potential-custom-element-name": {
1057
+ "version": "1.0.1",
1058
+ "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz",
1059
+ "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==",
1060
+ "license": "MIT"
1061
+ },
1062
+ "node_modules/jsdom": {
1063
+ "version": "22.1.0",
1064
+ "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-22.1.0.tgz",
1065
+ "integrity": "sha512-/9AVW7xNbsBv6GfWho4TTNjEo9fe6Zhf9O7s0Fhhr3u+awPwAJMKwAMXnkk5vBxflqLW9hTHX/0cs+P3gW+cQw==",
1066
+ "license": "MIT",
1067
+ "dependencies": {
1068
+ "abab": "^2.0.6",
1069
+ "cssstyle": "^3.0.0",
1070
+ "data-urls": "^4.0.0",
1071
+ "decimal.js": "^10.4.3",
1072
+ "domexception": "^4.0.0",
1073
+ "form-data": "^4.0.0",
1074
+ "html-encoding-sniffer": "^3.0.0",
1075
+ "http-proxy-agent": "^5.0.0",
1076
+ "https-proxy-agent": "^5.0.1",
1077
+ "is-potential-custom-element-name": "^1.0.1",
1078
+ "nwsapi": "^2.2.4",
1079
+ "parse5": "^7.1.2",
1080
+ "rrweb-cssom": "^0.6.0",
1081
+ "saxes": "^6.0.0",
1082
+ "symbol-tree": "^3.2.4",
1083
+ "tough-cookie": "^4.1.2",
1084
+ "w3c-xmlserializer": "^4.0.0",
1085
+ "webidl-conversions": "^7.0.0",
1086
+ "whatwg-encoding": "^2.0.0",
1087
+ "whatwg-mimetype": "^3.0.0",
1088
+ "whatwg-url": "^12.0.1",
1089
+ "ws": "^8.13.0",
1090
+ "xml-name-validator": "^4.0.0"
1091
+ },
1092
+ "engines": {
1093
+ "node": ">=16"
1094
+ },
1095
+ "peerDependencies": {
1096
+ "canvas": "^2.5.0"
1097
+ },
1098
+ "peerDependenciesMeta": {
1099
+ "canvas": {
1100
+ "optional": true
1101
+ }
1102
+ }
1103
+ },
1104
+ "node_modules/jsdom/node_modules/agent-base": {
1105
+ "version": "6.0.2",
1106
+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
1107
+ "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==",
1108
+ "license": "MIT",
1109
+ "dependencies": {
1110
+ "debug": "4"
1111
+ },
1112
+ "engines": {
1113
+ "node": ">= 6.0.0"
1114
+ }
1115
+ },
1116
+ "node_modules/jsdom/node_modules/debug": {
1117
+ "version": "4.4.1",
1118
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
1119
+ "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==",
1120
+ "license": "MIT",
1121
+ "dependencies": {
1122
+ "ms": "^2.1.3"
1123
+ },
1124
+ "engines": {
1125
+ "node": ">=6.0"
1126
+ },
1127
+ "peerDependenciesMeta": {
1128
+ "supports-color": {
1129
+ "optional": true
1130
+ }
1131
+ }
1132
+ },
1133
+ "node_modules/jsdom/node_modules/https-proxy-agent": {
1134
+ "version": "5.0.1",
1135
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz",
1136
+ "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==",
1137
+ "license": "MIT",
1138
+ "dependencies": {
1139
+ "agent-base": "6",
1140
+ "debug": "4"
1141
+ },
1142
+ "engines": {
1143
+ "node": ">= 6"
1144
+ }
1145
+ },
1146
+ "node_modules/jsdom/node_modules/ms": {
1147
+ "version": "2.1.3",
1148
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
1149
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
1150
+ "license": "MIT"
1151
+ },
1152
+ "node_modules/math-intrinsics": {
1153
+ "version": "1.1.0",
1154
+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
1155
+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
1156
+ "license": "MIT",
1157
+ "engines": {
1158
+ "node": ">= 0.4"
1159
+ }
1160
+ },
1161
+ "node_modules/media-typer": {
1162
+ "version": "0.3.0",
1163
+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
1164
+ "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
1165
+ "license": "MIT",
1166
+ "engines": {
1167
+ "node": ">= 0.6"
1168
+ }
1169
+ },
1170
+ "node_modules/merge-descriptors": {
1171
+ "version": "1.0.3",
1172
+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
1173
+ "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
1174
+ "license": "MIT",
1175
+ "funding": {
1176
+ "url": "https://github.com/sponsors/sindresorhus"
1177
+ }
1178
+ },
1179
+ "node_modules/methods": {
1180
+ "version": "1.1.2",
1181
+ "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
1182
+ "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
1183
+ "license": "MIT",
1184
+ "engines": {
1185
+ "node": ">= 0.6"
1186
+ }
1187
+ },
1188
+ "node_modules/mime": {
1189
+ "version": "1.6.0",
1190
+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
1191
+ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
1192
+ "license": "MIT",
1193
+ "bin": {
1194
+ "mime": "cli.js"
1195
+ },
1196
+ "engines": {
1197
+ "node": ">=4"
1198
+ }
1199
+ },
1200
+ "node_modules/mime-db": {
1201
+ "version": "1.52.0",
1202
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
1203
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
1204
+ "license": "MIT",
1205
+ "engines": {
1206
+ "node": ">= 0.6"
1207
+ }
1208
+ },
1209
+ "node_modules/mime-types": {
1210
+ "version": "2.1.35",
1211
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
1212
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
1213
+ "license": "MIT",
1214
+ "dependencies": {
1215
+ "mime-db": "1.52.0"
1216
+ },
1217
+ "engines": {
1218
+ "node": ">= 0.6"
1219
+ }
1220
+ },
1221
+ "node_modules/minimatch": {
1222
+ "version": "3.1.2",
1223
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
1224
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
1225
+ "dev": true,
1226
+ "license": "ISC",
1227
+ "dependencies": {
1228
+ "brace-expansion": "^1.1.7"
1229
+ },
1230
+ "engines": {
1231
+ "node": "*"
1232
+ }
1233
+ },
1234
+ "node_modules/ms": {
1235
+ "version": "2.0.0",
1236
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
1237
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
1238
+ "license": "MIT"
1239
+ },
1240
+ "node_modules/negotiator": {
1241
+ "version": "0.6.3",
1242
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
1243
+ "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
1244
+ "license": "MIT",
1245
+ "engines": {
1246
+ "node": ">= 0.6"
1247
+ }
1248
+ },
1249
+ "node_modules/node-domexception": {
1250
+ "version": "1.0.0",
1251
+ "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
1252
+ "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
1253
+ "deprecated": "Use your platform's native DOMException instead",
1254
+ "funding": [
1255
+ {
1256
+ "type": "github",
1257
+ "url": "https://github.com/sponsors/jimmywarting"
1258
+ },
1259
+ {
1260
+ "type": "github",
1261
+ "url": "https://paypal.me/jimmywarting"
1262
+ }
1263
+ ],
1264
+ "license": "MIT",
1265
+ "engines": {
1266
+ "node": ">=10.5.0"
1267
+ }
1268
+ },
1269
+ "node_modules/node-fetch": {
1270
+ "version": "3.3.2",
1271
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
1272
+ "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
1273
+ "license": "MIT",
1274
+ "dependencies": {
1275
+ "data-uri-to-buffer": "^4.0.0",
1276
+ "fetch-blob": "^3.1.4",
1277
+ "formdata-polyfill": "^4.0.10"
1278
+ },
1279
+ "engines": {
1280
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
1281
+ },
1282
+ "funding": {
1283
+ "type": "opencollective",
1284
+ "url": "https://opencollective.com/node-fetch"
1285
+ }
1286
+ },
1287
+ "node_modules/nodemon": {
1288
+ "version": "3.1.10",
1289
+ "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.10.tgz",
1290
+ "integrity": "sha512-WDjw3pJ0/0jMFmyNDp3gvY2YizjLmmOUQo6DEBY+JgdvW/yQ9mEeSw6H5ythl5Ny2ytb7f9C2nIbjSxMNzbJXw==",
1291
+ "dev": true,
1292
+ "license": "MIT",
1293
+ "dependencies": {
1294
+ "chokidar": "^3.5.2",
1295
+ "debug": "^4",
1296
+ "ignore-by-default": "^1.0.1",
1297
+ "minimatch": "^3.1.2",
1298
+ "pstree.remy": "^1.1.8",
1299
+ "semver": "^7.5.3",
1300
+ "simple-update-notifier": "^2.0.0",
1301
+ "supports-color": "^5.5.0",
1302
+ "touch": "^3.1.0",
1303
+ "undefsafe": "^2.0.5"
1304
+ },
1305
+ "bin": {
1306
+ "nodemon": "bin/nodemon.js"
1307
+ },
1308
+ "engines": {
1309
+ "node": ">=10"
1310
+ },
1311
+ "funding": {
1312
+ "type": "opencollective",
1313
+ "url": "https://opencollective.com/nodemon"
1314
+ }
1315
+ },
1316
+ "node_modules/nodemon/node_modules/debug": {
1317
+ "version": "4.4.1",
1318
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
1319
+ "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==",
1320
+ "dev": true,
1321
+ "license": "MIT",
1322
+ "dependencies": {
1323
+ "ms": "^2.1.3"
1324
+ },
1325
+ "engines": {
1326
+ "node": ">=6.0"
1327
+ },
1328
+ "peerDependenciesMeta": {
1329
+ "supports-color": {
1330
+ "optional": true
1331
+ }
1332
+ }
1333
+ },
1334
+ "node_modules/nodemon/node_modules/ms": {
1335
+ "version": "2.1.3",
1336
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
1337
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
1338
+ "dev": true,
1339
+ "license": "MIT"
1340
+ },
1341
+ "node_modules/normalize-path": {
1342
+ "version": "3.0.0",
1343
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
1344
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
1345
+ "dev": true,
1346
+ "license": "MIT",
1347
+ "engines": {
1348
+ "node": ">=0.10.0"
1349
+ }
1350
+ },
1351
+ "node_modules/nwsapi": {
1352
+ "version": "2.2.20",
1353
+ "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.20.tgz",
1354
+ "integrity": "sha512-/ieB+mDe4MrrKMT8z+mQL8klXydZWGR5Dowt4RAGKbJ3kIGEx3X4ljUo+6V73IXtUPWgfOlU5B9MlGxFO5T+cA==",
1355
+ "license": "MIT"
1356
+ },
1357
+ "node_modules/object-inspect": {
1358
+ "version": "1.13.4",
1359
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
1360
+ "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
1361
+ "license": "MIT",
1362
+ "engines": {
1363
+ "node": ">= 0.4"
1364
+ },
1365
+ "funding": {
1366
+ "url": "https://github.com/sponsors/ljharb"
1367
+ }
1368
+ },
1369
+ "node_modules/on-finished": {
1370
+ "version": "2.4.1",
1371
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
1372
+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
1373
+ "license": "MIT",
1374
+ "dependencies": {
1375
+ "ee-first": "1.1.1"
1376
+ },
1377
+ "engines": {
1378
+ "node": ">= 0.8"
1379
+ }
1380
+ },
1381
+ "node_modules/parse5": {
1382
+ "version": "7.3.0",
1383
+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz",
1384
+ "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==",
1385
+ "license": "MIT",
1386
+ "dependencies": {
1387
+ "entities": "^6.0.0"
1388
+ },
1389
+ "funding": {
1390
+ "url": "https://github.com/inikulin/parse5?sponsor=1"
1391
+ }
1392
+ },
1393
+ "node_modules/parseurl": {
1394
+ "version": "1.3.3",
1395
+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
1396
+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
1397
+ "license": "MIT",
1398
+ "engines": {
1399
+ "node": ">= 0.8"
1400
+ }
1401
+ },
1402
+ "node_modules/path-to-regexp": {
1403
+ "version": "0.1.12",
1404
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz",
1405
+ "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==",
1406
+ "license": "MIT"
1407
+ },
1408
+ "node_modules/picomatch": {
1409
+ "version": "2.3.1",
1410
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
1411
+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
1412
+ "dev": true,
1413
+ "license": "MIT",
1414
+ "engines": {
1415
+ "node": ">=8.6"
1416
+ },
1417
+ "funding": {
1418
+ "url": "https://github.com/sponsors/jonschlinkert"
1419
+ }
1420
+ },
1421
+ "node_modules/playwright": {
1422
+ "version": "1.52.0",
1423
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.52.0.tgz",
1424
+ "integrity": "sha512-JAwMNMBlxJ2oD1kce4KPtMkDeKGHQstdpFPcPH3maElAXon/QZeTvtsfXmTMRyO9TslfoYOXkSsvao2nE1ilTw==",
1425
+ "license": "Apache-2.0",
1426
+ "dependencies": {
1427
+ "playwright-core": "1.52.0"
1428
+ },
1429
+ "bin": {
1430
+ "playwright": "cli.js"
1431
+ },
1432
+ "engines": {
1433
+ "node": ">=18"
1434
+ },
1435
+ "optionalDependencies": {
1436
+ "fsevents": "2.3.2"
1437
+ }
1438
+ },
1439
+ "node_modules/playwright-core": {
1440
+ "version": "1.52.0",
1441
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.52.0.tgz",
1442
+ "integrity": "sha512-l2osTgLXSMeuLZOML9qYODUQoPPnUsKsb5/P6LJ2e6uPKXUdPK5WYhN4z03G+YNbWmGDY4YENauNu4ZKczreHg==",
1443
+ "license": "Apache-2.0",
1444
+ "bin": {
1445
+ "playwright-core": "cli.js"
1446
+ },
1447
+ "engines": {
1448
+ "node": ">=18"
1449
+ }
1450
+ },
1451
+ "node_modules/playwright/node_modules/fsevents": {
1452
+ "version": "2.3.2",
1453
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
1454
+ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
1455
+ "hasInstallScript": true,
1456
+ "license": "MIT",
1457
+ "optional": true,
1458
+ "os": [
1459
+ "darwin"
1460
+ ],
1461
+ "engines": {
1462
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
1463
+ }
1464
+ },
1465
+ "node_modules/proxy-addr": {
1466
+ "version": "2.0.7",
1467
+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
1468
+ "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
1469
+ "license": "MIT",
1470
+ "dependencies": {
1471
+ "forwarded": "0.2.0",
1472
+ "ipaddr.js": "1.9.1"
1473
+ },
1474
+ "engines": {
1475
+ "node": ">= 0.10"
1476
+ }
1477
+ },
1478
+ "node_modules/proxy-from-env": {
1479
+ "version": "1.1.0",
1480
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
1481
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
1482
+ "license": "MIT"
1483
+ },
1484
+ "node_modules/psl": {
1485
+ "version": "1.15.0",
1486
+ "resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz",
1487
+ "integrity": "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==",
1488
+ "license": "MIT",
1489
+ "dependencies": {
1490
+ "punycode": "^2.3.1"
1491
+ },
1492
+ "funding": {
1493
+ "url": "https://github.com/sponsors/lupomontero"
1494
+ }
1495
+ },
1496
+ "node_modules/pstree.remy": {
1497
+ "version": "1.1.8",
1498
+ "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
1499
+ "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==",
1500
+ "dev": true,
1501
+ "license": "MIT"
1502
+ },
1503
+ "node_modules/punycode": {
1504
+ "version": "2.3.1",
1505
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
1506
+ "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
1507
+ "license": "MIT",
1508
+ "engines": {
1509
+ "node": ">=6"
1510
+ }
1511
+ },
1512
+ "node_modules/qs": {
1513
+ "version": "6.13.0",
1514
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz",
1515
+ "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==",
1516
+ "license": "BSD-3-Clause",
1517
+ "dependencies": {
1518
+ "side-channel": "^1.0.6"
1519
+ },
1520
+ "engines": {
1521
+ "node": ">=0.6"
1522
+ },
1523
+ "funding": {
1524
+ "url": "https://github.com/sponsors/ljharb"
1525
+ }
1526
+ },
1527
+ "node_modules/querystringify": {
1528
+ "version": "2.2.0",
1529
+ "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
1530
+ "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==",
1531
+ "license": "MIT"
1532
+ },
1533
+ "node_modules/range-parser": {
1534
+ "version": "1.2.1",
1535
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
1536
+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
1537
+ "license": "MIT",
1538
+ "engines": {
1539
+ "node": ">= 0.6"
1540
+ }
1541
+ },
1542
+ "node_modules/raw-body": {
1543
+ "version": "2.5.2",
1544
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz",
1545
+ "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==",
1546
+ "license": "MIT",
1547
+ "dependencies": {
1548
+ "bytes": "3.1.2",
1549
+ "http-errors": "2.0.0",
1550
+ "iconv-lite": "0.4.24",
1551
+ "unpipe": "1.0.0"
1552
+ },
1553
+ "engines": {
1554
+ "node": ">= 0.8"
1555
+ }
1556
+ },
1557
+ "node_modules/readdirp": {
1558
+ "version": "3.6.0",
1559
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
1560
+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
1561
+ "dev": true,
1562
+ "license": "MIT",
1563
+ "dependencies": {
1564
+ "picomatch": "^2.2.1"
1565
+ },
1566
+ "engines": {
1567
+ "node": ">=8.10.0"
1568
+ }
1569
+ },
1570
+ "node_modules/requires-port": {
1571
+ "version": "1.0.0",
1572
+ "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
1573
+ "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
1574
+ "license": "MIT"
1575
+ },
1576
+ "node_modules/rrweb-cssom": {
1577
+ "version": "0.6.0",
1578
+ "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.6.0.tgz",
1579
+ "integrity": "sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==",
1580
+ "license": "MIT"
1581
+ },
1582
+ "node_modules/safe-buffer": {
1583
+ "version": "5.2.1",
1584
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
1585
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
1586
+ "funding": [
1587
+ {
1588
+ "type": "github",
1589
+ "url": "https://github.com/sponsors/feross"
1590
+ },
1591
+ {
1592
+ "type": "patreon",
1593
+ "url": "https://www.patreon.com/feross"
1594
+ },
1595
+ {
1596
+ "type": "consulting",
1597
+ "url": "https://feross.org/support"
1598
+ }
1599
+ ],
1600
+ "license": "MIT"
1601
+ },
1602
+ "node_modules/safer-buffer": {
1603
+ "version": "2.1.2",
1604
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
1605
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
1606
+ "license": "MIT"
1607
+ },
1608
+ "node_modules/saxes": {
1609
+ "version": "6.0.0",
1610
+ "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz",
1611
+ "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==",
1612
+ "license": "ISC",
1613
+ "dependencies": {
1614
+ "xmlchars": "^2.2.0"
1615
+ },
1616
+ "engines": {
1617
+ "node": ">=v12.22.7"
1618
+ }
1619
+ },
1620
+ "node_modules/semver": {
1621
+ "version": "7.7.2",
1622
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz",
1623
+ "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",
1624
+ "dev": true,
1625
+ "license": "ISC",
1626
+ "bin": {
1627
+ "semver": "bin/semver.js"
1628
+ },
1629
+ "engines": {
1630
+ "node": ">=10"
1631
+ }
1632
+ },
1633
+ "node_modules/send": {
1634
+ "version": "0.19.0",
1635
+ "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz",
1636
+ "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==",
1637
+ "license": "MIT",
1638
+ "dependencies": {
1639
+ "debug": "2.6.9",
1640
+ "depd": "2.0.0",
1641
+ "destroy": "1.2.0",
1642
+ "encodeurl": "~1.0.2",
1643
+ "escape-html": "~1.0.3",
1644
+ "etag": "~1.8.1",
1645
+ "fresh": "0.5.2",
1646
+ "http-errors": "2.0.0",
1647
+ "mime": "1.6.0",
1648
+ "ms": "2.1.3",
1649
+ "on-finished": "2.4.1",
1650
+ "range-parser": "~1.2.1",
1651
+ "statuses": "2.0.1"
1652
+ },
1653
+ "engines": {
1654
+ "node": ">= 0.8.0"
1655
+ }
1656
+ },
1657
+ "node_modules/send/node_modules/encodeurl": {
1658
+ "version": "1.0.2",
1659
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
1660
+ "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
1661
+ "license": "MIT",
1662
+ "engines": {
1663
+ "node": ">= 0.8"
1664
+ }
1665
+ },
1666
+ "node_modules/send/node_modules/ms": {
1667
+ "version": "2.1.3",
1668
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
1669
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
1670
+ "license": "MIT"
1671
+ },
1672
+ "node_modules/serve-static": {
1673
+ "version": "1.16.2",
1674
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",
1675
+ "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==",
1676
+ "license": "MIT",
1677
+ "dependencies": {
1678
+ "encodeurl": "~2.0.0",
1679
+ "escape-html": "~1.0.3",
1680
+ "parseurl": "~1.3.3",
1681
+ "send": "0.19.0"
1682
+ },
1683
+ "engines": {
1684
+ "node": ">= 0.8.0"
1685
+ }
1686
+ },
1687
+ "node_modules/setprototypeof": {
1688
+ "version": "1.2.0",
1689
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
1690
+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
1691
+ "license": "ISC"
1692
+ },
1693
+ "node_modules/side-channel": {
1694
+ "version": "1.1.0",
1695
+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
1696
+ "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
1697
+ "license": "MIT",
1698
+ "dependencies": {
1699
+ "es-errors": "^1.3.0",
1700
+ "object-inspect": "^1.13.3",
1701
+ "side-channel-list": "^1.0.0",
1702
+ "side-channel-map": "^1.0.1",
1703
+ "side-channel-weakmap": "^1.0.2"
1704
+ },
1705
+ "engines": {
1706
+ "node": ">= 0.4"
1707
+ },
1708
+ "funding": {
1709
+ "url": "https://github.com/sponsors/ljharb"
1710
+ }
1711
+ },
1712
+ "node_modules/side-channel-list": {
1713
+ "version": "1.0.0",
1714
+ "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",
1715
+ "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
1716
+ "license": "MIT",
1717
+ "dependencies": {
1718
+ "es-errors": "^1.3.0",
1719
+ "object-inspect": "^1.13.3"
1720
+ },
1721
+ "engines": {
1722
+ "node": ">= 0.4"
1723
+ },
1724
+ "funding": {
1725
+ "url": "https://github.com/sponsors/ljharb"
1726
+ }
1727
+ },
1728
+ "node_modules/side-channel-map": {
1729
+ "version": "1.0.1",
1730
+ "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
1731
+ "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
1732
+ "license": "MIT",
1733
+ "dependencies": {
1734
+ "call-bound": "^1.0.2",
1735
+ "es-errors": "^1.3.0",
1736
+ "get-intrinsic": "^1.2.5",
1737
+ "object-inspect": "^1.13.3"
1738
+ },
1739
+ "engines": {
1740
+ "node": ">= 0.4"
1741
+ },
1742
+ "funding": {
1743
+ "url": "https://github.com/sponsors/ljharb"
1744
+ }
1745
+ },
1746
+ "node_modules/side-channel-weakmap": {
1747
+ "version": "1.0.2",
1748
+ "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
1749
+ "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
1750
+ "license": "MIT",
1751
+ "dependencies": {
1752
+ "call-bound": "^1.0.2",
1753
+ "es-errors": "^1.3.0",
1754
+ "get-intrinsic": "^1.2.5",
1755
+ "object-inspect": "^1.13.3",
1756
+ "side-channel-map": "^1.0.1"
1757
+ },
1758
+ "engines": {
1759
+ "node": ">= 0.4"
1760
+ },
1761
+ "funding": {
1762
+ "url": "https://github.com/sponsors/ljharb"
1763
+ }
1764
+ },
1765
+ "node_modules/simple-update-notifier": {
1766
+ "version": "2.0.0",
1767
+ "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz",
1768
+ "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==",
1769
+ "dev": true,
1770
+ "license": "MIT",
1771
+ "dependencies": {
1772
+ "semver": "^7.5.3"
1773
+ },
1774
+ "engines": {
1775
+ "node": ">=10"
1776
+ }
1777
+ },
1778
+ "node_modules/statuses": {
1779
+ "version": "2.0.1",
1780
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
1781
+ "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
1782
+ "license": "MIT",
1783
+ "engines": {
1784
+ "node": ">= 0.8"
1785
+ }
1786
+ },
1787
+ "node_modules/supports-color": {
1788
+ "version": "5.5.0",
1789
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
1790
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
1791
+ "dev": true,
1792
+ "license": "MIT",
1793
+ "dependencies": {
1794
+ "has-flag": "^3.0.0"
1795
+ },
1796
+ "engines": {
1797
+ "node": ">=4"
1798
+ }
1799
+ },
1800
+ "node_modules/symbol-tree": {
1801
+ "version": "3.2.4",
1802
+ "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
1803
+ "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
1804
+ "license": "MIT"
1805
+ },
1806
+ "node_modules/to-regex-range": {
1807
+ "version": "5.0.1",
1808
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
1809
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
1810
+ "dev": true,
1811
+ "license": "MIT",
1812
+ "dependencies": {
1813
+ "is-number": "^7.0.0"
1814
+ },
1815
+ "engines": {
1816
+ "node": ">=8.0"
1817
+ }
1818
+ },
1819
+ "node_modules/toidentifier": {
1820
+ "version": "1.0.1",
1821
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
1822
+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
1823
+ "license": "MIT",
1824
+ "engines": {
1825
+ "node": ">=0.6"
1826
+ }
1827
+ },
1828
+ "node_modules/touch": {
1829
+ "version": "3.1.1",
1830
+ "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz",
1831
+ "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==",
1832
+ "dev": true,
1833
+ "license": "ISC",
1834
+ "bin": {
1835
+ "nodetouch": "bin/nodetouch.js"
1836
+ }
1837
+ },
1838
+ "node_modules/tough-cookie": {
1839
+ "version": "4.1.4",
1840
+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz",
1841
+ "integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==",
1842
+ "license": "BSD-3-Clause",
1843
+ "dependencies": {
1844
+ "psl": "^1.1.33",
1845
+ "punycode": "^2.1.1",
1846
+ "universalify": "^0.2.0",
1847
+ "url-parse": "^1.5.3"
1848
+ },
1849
+ "engines": {
1850
+ "node": ">=6"
1851
+ }
1852
+ },
1853
+ "node_modules/tr46": {
1854
+ "version": "4.1.1",
1855
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz",
1856
+ "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==",
1857
+ "license": "MIT",
1858
+ "dependencies": {
1859
+ "punycode": "^2.3.0"
1860
+ },
1861
+ "engines": {
1862
+ "node": ">=14"
1863
+ }
1864
+ },
1865
+ "node_modules/type-is": {
1866
+ "version": "1.6.18",
1867
+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
1868
+ "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
1869
+ "license": "MIT",
1870
+ "dependencies": {
1871
+ "media-typer": "0.3.0",
1872
+ "mime-types": "~2.1.24"
1873
+ },
1874
+ "engines": {
1875
+ "node": ">= 0.6"
1876
+ }
1877
+ },
1878
+ "node_modules/undefsafe": {
1879
+ "version": "2.0.5",
1880
+ "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
1881
+ "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==",
1882
+ "dev": true,
1883
+ "license": "MIT"
1884
+ },
1885
+ "node_modules/universalify": {
1886
+ "version": "0.2.0",
1887
+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz",
1888
+ "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==",
1889
+ "license": "MIT",
1890
+ "engines": {
1891
+ "node": ">= 4.0.0"
1892
+ }
1893
+ },
1894
+ "node_modules/unpipe": {
1895
+ "version": "1.0.0",
1896
+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
1897
+ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
1898
+ "license": "MIT",
1899
+ "engines": {
1900
+ "node": ">= 0.8"
1901
+ }
1902
+ },
1903
+ "node_modules/url-parse": {
1904
+ "version": "1.5.10",
1905
+ "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
1906
+ "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
1907
+ "license": "MIT",
1908
+ "dependencies": {
1909
+ "querystringify": "^2.1.1",
1910
+ "requires-port": "^1.0.0"
1911
+ }
1912
+ },
1913
+ "node_modules/utils-merge": {
1914
+ "version": "1.0.1",
1915
+ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
1916
+ "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
1917
+ "license": "MIT",
1918
+ "engines": {
1919
+ "node": ">= 0.4.0"
1920
+ }
1921
+ },
1922
+ "node_modules/vary": {
1923
+ "version": "1.1.2",
1924
+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
1925
+ "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
1926
+ "license": "MIT",
1927
+ "engines": {
1928
+ "node": ">= 0.8"
1929
+ }
1930
+ },
1931
+ "node_modules/w3c-xmlserializer": {
1932
+ "version": "4.0.0",
1933
+ "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz",
1934
+ "integrity": "sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==",
1935
+ "license": "MIT",
1936
+ "dependencies": {
1937
+ "xml-name-validator": "^4.0.0"
1938
+ },
1939
+ "engines": {
1940
+ "node": ">=14"
1941
+ }
1942
+ },
1943
+ "node_modules/web-streams-polyfill": {
1944
+ "version": "3.3.3",
1945
+ "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
1946
+ "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
1947
+ "license": "MIT",
1948
+ "engines": {
1949
+ "node": ">= 8"
1950
+ }
1951
+ },
1952
+ "node_modules/webidl-conversions": {
1953
+ "version": "7.0.0",
1954
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
1955
+ "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
1956
+ "license": "BSD-2-Clause",
1957
+ "engines": {
1958
+ "node": ">=12"
1959
+ }
1960
+ },
1961
+ "node_modules/whatwg-encoding": {
1962
+ "version": "2.0.0",
1963
+ "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz",
1964
+ "integrity": "sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==",
1965
+ "license": "MIT",
1966
+ "dependencies": {
1967
+ "iconv-lite": "0.6.3"
1968
+ },
1969
+ "engines": {
1970
+ "node": ">=12"
1971
+ }
1972
+ },
1973
+ "node_modules/whatwg-encoding/node_modules/iconv-lite": {
1974
+ "version": "0.6.3",
1975
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
1976
+ "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
1977
+ "license": "MIT",
1978
+ "dependencies": {
1979
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
1980
+ },
1981
+ "engines": {
1982
+ "node": ">=0.10.0"
1983
+ }
1984
+ },
1985
+ "node_modules/whatwg-mimetype": {
1986
+ "version": "3.0.0",
1987
+ "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz",
1988
+ "integrity": "sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==",
1989
+ "license": "MIT",
1990
+ "engines": {
1991
+ "node": ">=12"
1992
+ }
1993
+ },
1994
+ "node_modules/whatwg-url": {
1995
+ "version": "12.0.1",
1996
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-12.0.1.tgz",
1997
+ "integrity": "sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==",
1998
+ "license": "MIT",
1999
+ "dependencies": {
2000
+ "tr46": "^4.1.1",
2001
+ "webidl-conversions": "^7.0.0"
2002
+ },
2003
+ "engines": {
2004
+ "node": ">=14"
2005
+ }
2006
+ },
2007
+ "node_modules/ws": {
2008
+ "version": "8.18.2",
2009
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.2.tgz",
2010
+ "integrity": "sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ==",
2011
+ "license": "MIT",
2012
+ "engines": {
2013
+ "node": ">=10.0.0"
2014
+ },
2015
+ "peerDependencies": {
2016
+ "bufferutil": "^4.0.1",
2017
+ "utf-8-validate": ">=5.0.2"
2018
+ },
2019
+ "peerDependenciesMeta": {
2020
+ "bufferutil": {
2021
+ "optional": true
2022
+ },
2023
+ "utf-8-validate": {
2024
+ "optional": true
2025
+ }
2026
+ }
2027
+ },
2028
+ "node_modules/xml-name-validator": {
2029
+ "version": "4.0.0",
2030
+ "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-4.0.0.tgz",
2031
+ "integrity": "sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==",
2032
+ "license": "Apache-2.0",
2033
+ "engines": {
2034
+ "node": ">=12"
2035
+ }
2036
+ },
2037
+ "node_modules/xmlchars": {
2038
+ "version": "2.2.0",
2039
+ "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
2040
+ "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==",
2041
+ "license": "MIT"
2042
+ }
2043
+ }
2044
+ }
package.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "notion2api-nodejs",
3
+ "version": "1.0.0",
4
+ "description": "Notion API client with lightweight browser-free option",
5
+ "main": "src/lightweight-client-express.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "notion-cookie": "src/cookie-cli.js"
9
+ },
10
+ "scripts": {
11
+ "start": "node src/lightweight-client-express.js",
12
+ "dev": "nodemon src/lightweight-client-express.js",
13
+ "original": "node src/index.js",
14
+ "cookie": "node src/cookie-cli.js"
15
+ },
16
+ "keywords": [
17
+ "notion",
18
+ "openai",
19
+ "api",
20
+ "bridge"
21
+ ],
22
+ "author": "",
23
+ "license": "MIT",
24
+ "dependencies": {
25
+ "axios": "^1.9.0",
26
+ "chalk": "^4.1.2",
27
+ "dotenv": "^16.3.1",
28
+ "express": "^4.18.2",
29
+ "https-proxy-agent": "^7.0.2",
30
+ "jsdom": "^22.1.0",
31
+ "node-fetch": "^3.3.2",
32
+ "playwright": "^1.40.1"
33
+ },
34
+ "devDependencies": {
35
+ "nodemon": "^3.0.2"
36
+ }
37
+ }
proxy_server.log ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2025/06/09 12:18:12.836692 chrome_tls_proxy.go:706: Chrome TLS指纹代理服务器运行在 http://localhost:10655/proxy
2
+ 2025/06/09 12:18:12.841349 chrome_tls_proxy.go:707: 使用方法:向/proxy发送POST请求,请求体包含目标URL、方法、请求头和请求体
3
+ 2025/06/09 12:18:12.841349 chrome_tls_proxy.go:708: 支持流式响应,需要在请求体中添加 'stream': true
4
+ 2025/06/09 12:18:12.841349 chrome_tls_proxy.go:709: 已禁用速率限制:允许无限制请求
5
+ 2025/06/09 12:18:12.841349 chrome_tls_proxy.go:710: 已禁用并发限制:允许同一IP发起多个并发请求
6
+ 2025/06/09 12:18:12.841349 chrome_tls_proxy.go:711: 已强制使用IPv4连接,并使用8.8.8.8作为DNS服务器
7
+ 2025/06/09 12:18:12.841349 chrome_tls_proxy.go:712: 使用Chrome浏览器的TLS指纹进行连接
8
+ 2025/06/09 12:20:28.077805 chrome_tls_proxy.go:706: Chrome TLS指纹代理服务器运行在 http://localhost:10655/proxy
9
+ 2025/06/09 12:20:28.082498 chrome_tls_proxy.go:707: 使用方法:向/proxy发送POST请求,请求体包含目标URL、方法、请求头和请求体
10
+ 2025/06/09 12:20:28.082498 chrome_tls_proxy.go:708: 支持流式响应,需要在请求体中添加 'stream': true
11
+ 2025/06/09 12:20:28.082498 chrome_tls_proxy.go:709: 已禁用速率限制:允许无限制请求
12
+ 2025/06/09 12:20:28.082498 chrome_tls_proxy.go:710: 已禁用并发限制:允许同一IP发起多个并发请求
13
+ 2025/06/09 12:20:28.082498 chrome_tls_proxy.go:711: 已强制使用IPv4连接,并使用8.8.8.8作为DNS服务器
14
+ 2025/06/09 12:20:28.082498 chrome_tls_proxy.go:712: 使用Chrome浏览器的TLS指纹进行连接
15
+ 2025/06/09 12:21:16.376141 chrome_tls_proxy.go:706: Chrome TLS指纹代理服务器运行在 http://localhost:10655/proxy
16
+ 2025/06/09 12:21:16.382812 chrome_tls_proxy.go:707: 使用方法:向/proxy发送POST请求,请求体包含目标URL、方法、请求头和请求体
17
+ 2025/06/09 12:21:16.382812 chrome_tls_proxy.go:708: 支持流式响应,需要在请求体中添加 'stream': true
18
+ 2025/06/09 12:21:16.382812 chrome_tls_proxy.go:709: 已禁用速率限制:允许无限制请求
19
+ 2025/06/09 12:21:16.382812 chrome_tls_proxy.go:710: 已禁用并发限制:允许同一IP发起多个并发请求
20
+ 2025/06/09 12:21:16.382812 chrome_tls_proxy.go:711: 已强制使用IPv4连接,并使用8.8.8.8作为DNS服务器
21
+ 2025/06/09 12:21:16.382812 chrome_tls_proxy.go:712: 使用Chrome浏览器的TLS指纹进行连接
22
+ 2025/06/09 12:22:43.593498 chrome_tls_proxy.go:706: Chrome TLS指纹代理服务器运行在 http://localhost:10655/proxy
23
+ 2025/06/09 12:22:43.597928 chrome_tls_proxy.go:707: 使用方法:向/proxy发送POST请求,请求体包含目标URL、方法、请求头和请求体
24
+ 2025/06/09 12:22:43.597928 chrome_tls_proxy.go:708: 支持流式响应,需要在请求体中添加 'stream': true
25
+ 2025/06/09 12:22:43.597928 chrome_tls_proxy.go:709: 已禁用速率限制:允许无限制请求
26
+ 2025/06/09 12:22:43.597928 chrome_tls_proxy.go:710: 已禁用并发限制:允许同一IP发起多个并发请求
27
+ 2025/06/09 12:22:43.597928 chrome_tls_proxy.go:711: 已强制使用IPv4连接,并使用8.8.8.8作为DNS服务器
28
+ 2025/06/09 12:22:43.597928 chrome_tls_proxy.go:712: 使用Chrome浏览器的TLS指纹进行连接
29
+ 2025/06/09 12:23:33.082331 chrome_tls_proxy.go:706: Chrome TLS指纹代理服务器运行在 http://localhost:10655/proxy
30
+ 2025/06/09 12:23:33.087347 chrome_tls_proxy.go:707: 使用方法:向/proxy发送POST请求,请求体包含目标URL、方法、请求头和请求体
31
+ 2025/06/09 12:23:33.087347 chrome_tls_proxy.go:708: 支持流式响应,需要在请求体中添加 'stream': true
32
+ 2025/06/09 12:23:33.087347 chrome_tls_proxy.go:709: 已禁用速率限制:允许无限制请求
33
+ 2025/06/09 12:23:33.087347 chrome_tls_proxy.go:710: 已禁用并发限制:允许同一IP发起多个并发请求
34
+ 2025/06/09 12:23:33.087347 chrome_tls_proxy.go:711: 已强制使用IPv4连接,并使用8.8.8.8作为DNS服务器
35
+ 2025/06/09 12:23:33.087347 chrome_tls_proxy.go:712: 使用Chrome浏览器的TLS指纹进行连接
36
+ 2025/06/09 12:24:37.277389 chrome_tls_proxy.go:537: 处理流式请求: POST https://www.notion.so/api/v3/runInferenceTranscript
37
+ 2025/06/09 12:24:37.317968 chrome_tls_proxy.go:153: 成功解析域名: www.notion.so -> 198.18.0.63
38
+ 2025/06/09 12:24:37.317968 chrome_tls_proxy.go:187: 建立TCP连接到: www.notion.so:443 (IP: 198.18.0.63)
39
+ 2025/06/09 12:24:37.319157 chrome_tls_proxy.go:196: TCP连接成功建立到 198.18.0.63:443
40
+ 2025/06/09 12:24:38.271929 chrome_tls_proxy.go:214: TLS握手成功,使用Chrome指纹
41
+ 2025/06/09 12:24:38.271929 chrome_tls_proxy.go:218: 协商的协议: h2
42
+ 2025/06/09 12:24:38.273041 chrome_tls_proxy.go:222: 使用Chrome TLS指纹处理HTTP/2请求
43
+ 2025/06/09 12:25:14.238223 chrome_tls_proxy.go:606: 流式传输完成: POST https://www.notion.so/api/v3/runInferenceTranscript, 总计 31669 字节
44
+ 2025/06/10 02:42:16.676423 chrome_tls_proxy.go:706: Chrome TLS指纹代理服务器运行在 http://localhost:10655/proxy
45
+ 2025/06/10 02:42:16.681953 chrome_tls_proxy.go:707: 使用方法:向/proxy发送POST请求,请求体包含目标URL、方法、请求头和请求体
46
+ 2025/06/10 02:42:16.681953 chrome_tls_proxy.go:708: 支持流式响应,需要在请求体中添加 'stream': true
47
+ 2025/06/10 02:42:16.681953 chrome_tls_proxy.go:709: 已禁用速率限制:允许无限制请求
48
+ 2025/06/10 02:42:16.681953 chrome_tls_proxy.go:710: 已禁用并发限制:允许同一IP发起多个并发请求
49
+ 2025/06/10 02:42:16.681953 chrome_tls_proxy.go:711: 已强制使用IPv4连接,并使用8.8.8.8作为DNS服务器
50
+ 2025/06/10 02:42:16.681953 chrome_tls_proxy.go:712: 使用Chrome浏览器的TLS指纹进行连接
51
+ 2025/06/10 02:43:05.148946 chrome_tls_proxy.go:537: 处理流式请求: POST https://www.notion.so/api/v3/runInferenceTranscript
52
+ 2025/06/10 02:43:05.208572 chrome_tls_proxy.go:153: 成功解析域名: www.notion.so -> 198.18.0.144
53
+ 2025/06/10 02:43:05.208572 chrome_tls_proxy.go:187: 建立TCP连接到: www.notion.so:443 (IP: 198.18.0.144)
54
+ 2025/06/10 02:43:05.211835 chrome_tls_proxy.go:196: TCP连接成功建立到 198.18.0.144:443
55
+ 2025/06/10 02:43:05.427302 chrome_tls_proxy.go:214: TLS握手成功,使用Chrome指纹
56
+ 2025/06/10 02:43:05.427302 chrome_tls_proxy.go:218: 协商的协议: h2
57
+ 2025/06/10 02:43:05.427302 chrome_tls_proxy.go:222: 使用Chrome TLS指纹处理HTTP/2请求
58
+ 2025/06/10 02:43:41.149891 chrome_tls_proxy.go:606: 流式传输完成: POST https://www.notion.so/api/v3/runInferenceTranscript, 总计 31608 字节
59
+ 2025/06/10 03:01:17.428507 chrome_tls_proxy.go:537: 处理流式请求: POST https://www.notion.so/api/v3/runInferenceTranscript
60
+ 2025/06/10 03:01:17.448863 chrome_tls_proxy.go:153: 成功解析域名: www.notion.so -> 198.18.0.144
61
+ 2025/06/10 03:01:17.448863 chrome_tls_proxy.go:187: 建立TCP连接到: www.notion.so:443 (IP: 198.18.0.144)
62
+ 2025/06/10 03:01:17.453925 chrome_tls_proxy.go:196: TCP连接成功建立到 198.18.0.144:443
63
+ 2025/06/10 03:01:17.644603 chrome_tls_proxy.go:214: TLS握手成功,使用Chrome指纹
64
+ 2025/06/10 03:01:17.644603 chrome_tls_proxy.go:218: 协商的协议: h2
65
+ 2025/06/10 03:01:17.644603 chrome_tls_proxy.go:222: 使用Chrome TLS指纹处理HTTP/2请求
66
+ 2025/06/10 03:06:57.990484 chrome_tls_proxy.go:604: 错误: 读取响应错误: read tcp4 198.18.0.1:54244->198.18.0.144:443: wsarecv: An established connection was aborted by the software in your host machine.
67
+ 2025/06/10 03:07:11.842946 chrome_tls_proxy.go:537: 处理流式请求: POST https://www.notion.so/api/v3/runInferenceTranscript
68
+ 2025/06/10 03:07:11.868226 chrome_tls_proxy.go:153: 成功解析域名: www.notion.so -> 198.18.0.144
69
+ 2025/06/10 03:07:11.868226 chrome_tls_proxy.go:187: 建立TCP连接到: www.notion.so:443 (IP: 198.18.0.144)
70
+ 2025/06/10 03:07:11.869739 chrome_tls_proxy.go:196: TCP连接成功建立到 198.18.0.144:443
71
+ 2025/06/10 03:07:12.053531 chrome_tls_proxy.go:214: TLS握手成功,使用Chrome指纹
72
+ 2025/06/10 03:07:12.053531 chrome_tls_proxy.go:218: 协商的协议: h2
73
+ 2025/06/10 03:07:12.053531 chrome_tls_proxy.go:222: 使用Chrome TLS指纹处理HTTP/2请求
74
+ 2025/06/10 03:08:38.704075 chrome_tls_proxy.go:606: 流式传输完成: POST https://www.notion.so/api/v3/runInferenceTranscript, 总计 51661 字节
75
+ 2025/06/11 16:06:01.368108 chrome_tls_proxy.go:706: Chrome TLS指纹代理服务器运行在 http://localhost:10655/proxy
76
+ 2025/06/11 16:06:01.373106 chrome_tls_proxy.go:707: 使用方法:向/proxy发送POST请求,请求体包含目标URL、方法、请求头和请求体
77
+ 2025/06/11 16:06:01.373106 chrome_tls_proxy.go:708: 支持流式响应,需要在请求体中添加 'stream': true
78
+ 2025/06/11 16:06:01.373106 chrome_tls_proxy.go:709: 已禁用速率限制:允许无限制请求
79
+ 2025/06/11 16:06:01.373106 chrome_tls_proxy.go:710: 已禁用并发限制:允许同一IP发起多个并发请求
80
+ 2025/06/11 16:06:01.373106 chrome_tls_proxy.go:711: 已强制使用IPv4连接,并使用8.8.8.8作为DNS服务器
81
+ 2025/06/11 16:06:01.373106 chrome_tls_proxy.go:712: 使用Chrome浏览器的TLS指纹进行连接
82
+ 2025/06/11 17:54:09.353046 chrome_tls_proxy.go:706: Chrome TLS指纹代理服务器运行在 http://localhost:10655/proxy
83
+ 2025/06/11 17:54:09.357768 chrome_tls_proxy.go:707: 使用方法:向/proxy发送POST请求,请求体包含目标URL、方法、请求头和请求体
84
+ 2025/06/11 17:54:09.357768 chrome_tls_proxy.go:708: 支持流式响应,需要在请求体中添加 'stream': true
85
+ 2025/06/11 17:54:09.357768 chrome_tls_proxy.go:709: 已禁用速率限制:允许无限制请求
86
+ 2025/06/11 17:54:09.357768 chrome_tls_proxy.go:710: 已禁用并发限制:允许同一IP发起多个并发请求
87
+ 2025/06/11 17:54:09.357768 chrome_tls_proxy.go:711: 已强制使用IPv4连接,并使用8.8.8.8作为DNS服务器
88
+ 2025/06/11 17:54:09.357768 chrome_tls_proxy.go:712: 使用Chrome浏览器的TLS指纹进行连接
89
+ 2025/06/11 18:05:05.408576 chrome_tls_proxy.go:706: Chrome TLS指纹代理服务器运行在 http://localhost:10655/proxy
90
+ 2025/06/11 18:05:05.413163 chrome_tls_proxy.go:707: 使用方法���向/proxy发送POST请求,请求体包含目标URL、方法、请求头和请求体
91
+ 2025/06/11 18:05:05.413163 chrome_tls_proxy.go:708: 支持流式响应,需要在请求体中添加 'stream': true
92
+ 2025/06/11 18:05:05.413163 chrome_tls_proxy.go:709: 已禁用速率限制:允许无限制请求
93
+ 2025/06/11 18:05:05.413163 chrome_tls_proxy.go:710: 已禁用并发限制:允许同一IP发起多个并发请求
94
+ 2025/06/11 18:05:05.413163 chrome_tls_proxy.go:711: 已强制使用IPv4连接,并使用8.8.8.8作为DNS服务器
95
+ 2025/06/11 18:05:05.413163 chrome_tls_proxy.go:712: 使用Chrome浏览器的TLS指纹进行连接
96
+ 2025/06/11 18:05:05.414212 chrome_tls_proxy.go:716: 服务器启动失败: listen tcp :10655: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.
proxychains.conf ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 严格模式:强制所有流量通过代理
2
+ strict_chain
3
+
4
+ # 代理 DNS 查询
5
+ proxy_dns
6
+
7
+ # 超时设置
8
+ tcp_read_time_out 15000
9
+ tcp_connect_time_out 8000
10
+
11
+ # 禁用通配符和远程DNS解析(增强匿名性)
12
+ localnet 127.0.0.0/255.0.0.0
13
+
14
+ # 强制 proxy_dns
15
+ proxy_dns_old_mode
16
+
17
+ # 代理服务器列表
18
+ [ProxyList]
19
+ # 添加您的代理服务器
20
+ http 34.55.224.190 8080
src/CookieManager.js ADDED
@@ -0,0 +1,423 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { JSDOM } from 'jsdom';
2
+ import fetch from 'node-fetch';
3
+ import fs from 'fs';
4
+ import path from 'path';
5
+ import { fileURLToPath } from 'url';
6
+ import { dirname } from 'path';
7
+
8
+ // 获取当前文件的目录路径
9
+ const __filename = fileURLToPath(import.meta.url);
10
+ const __dirname = dirname(__filename);
11
+
12
+ // 日志配置
13
+ const logger = {
14
+ info: (message) => console.log(`\x1b[34m[info] ${message}\x1b[0m`),
15
+ error: (message) => console.error(`\x1b[31m[error] ${message}\x1b[0m`),
16
+ warning: (message) => console.warn(`\x1b[33m[warn] ${message}\x1b[0m`),
17
+ success: (message) => console.log(`\x1b[32m[success] ${message}\x1b[0m`),
18
+ };
19
+
20
+ class CookieManager {
21
+ constructor() {
22
+ this.cookieEntries = []; // 存储cookie及其对应的ID
23
+ this.currentIndex = 0;
24
+ this.initialized = false;
25
+ this.maxRetries = 3; // 最大重试次数
26
+ this.proxyUrl = process.env.PROXY_URL || "";
27
+ }
28
+
29
+ /**
30
+ * 从文件加载cookie
31
+ * @param {string} filePath - cookie文件路径
32
+ * @returns {Promise<boolean>} - 是否加载成功
33
+ */
34
+ async loadFromFile(filePath) {
35
+ try {
36
+ // 确保文件路径是绝对路径
37
+ const absolutePath = path.isAbsolute(filePath)
38
+ ? filePath
39
+ : path.join(dirname(__dirname), filePath);
40
+
41
+ logger.info(`从文件加载cookie: ${absolutePath}`);
42
+
43
+ // 检查文件是否存在
44
+ if (!fs.existsSync(absolutePath)) {
45
+ logger.error(`Cookie文件不存在: ${absolutePath}`);
46
+ return false;
47
+ }
48
+
49
+ // 读取文件内容
50
+ const fileContent = fs.readFileSync(absolutePath, 'utf8');
51
+
52
+ // 根据文件扩展名处理不同格式
53
+ const ext = path.extname(absolutePath).toLowerCase();
54
+ let cookieArray = [];
55
+
56
+ if (ext === '.json') {
57
+ // JSON格式
58
+ try {
59
+ const jsonData = JSON.parse(fileContent);
60
+ if (Array.isArray(jsonData)) {
61
+ cookieArray = jsonData;
62
+ } else if (jsonData.cookies && Array.isArray(jsonData.cookies)) {
63
+ cookieArray = jsonData.cookies;
64
+ } else {
65
+ logger.error('JSON文件格式错误,应为cookie数组或包含cookies数组的对象');
66
+ return false;
67
+ }
68
+ } catch (error) {
69
+ logger.error(`解析JSON文件失败: ${error.message}`);
70
+ return false;
71
+ }
72
+ } else {
73
+ // 文本格式,每行一个cookie
74
+ cookieArray = fileContent
75
+ .split('\n')
76
+ .map(line => line.trim())
77
+ .filter(line => line && !line.startsWith('#'));
78
+ }
79
+
80
+ logger.info(`从文件中读取了 ${cookieArray.length} 个cookie`);
81
+
82
+ // 初始化cookie
83
+ return await this.initialize(cookieArray.join('|'));
84
+
85
+ } catch (error) {
86
+ logger.error(`从文件加载cookie失败: ${error.message}`);
87
+ return false;
88
+ }
89
+ }
90
+
91
+ /**
92
+ * 初始化cookie管理器
93
+ * @param {string} cookiesString - 以"|"分隔的cookie字符串
94
+ * @returns {Promise<boolean>} - 是否初始化成功
95
+ */
96
+ async initialize(cookiesString) {
97
+ if (!cookiesString) {
98
+ logger.error('未提供cookie字符串');
99
+ return false;
100
+ }
101
+
102
+ // 分割cookie字符串
103
+ const cookieArray = cookiesString.split('|').map(c => c.trim()).filter(c => c);
104
+
105
+ if (cookieArray.length === 0) {
106
+ logger.error('没有有效的cookie');
107
+ return false;
108
+ }
109
+
110
+ logger.info(`发现 ${cookieArray.length} 个cookie,开始获取对应的ID信息...`);
111
+
112
+ // 清空现有条目
113
+ this.cookieEntries = [];
114
+
115
+ // 为每个cookie获取ID
116
+ for (let i = 0; i < cookieArray.length; i++) {
117
+ const cookie = cookieArray[i];
118
+ logger.info(`正在处理第 ${i+1}/${cookieArray.length} 个cookie...`);
119
+
120
+ const result = await this.fetchNotionIds(cookie);
121
+ if (result.success) {
122
+ this.cookieEntries.push({
123
+ cookie,
124
+ spaceId: result.spaceId,
125
+ userId: result.userId,
126
+ valid: true,
127
+ lastUsed: 0 // 记录上次使用时间戳
128
+ });
129
+ logger.success(`第 ${i+1} 个cookie验证成功`);
130
+ } else {
131
+ if (result.status === 401) {
132
+ logger.error(`第 ${i+1} 个cookie无效(401未授权),已跳过`);
133
+ } else {
134
+ logger.warning(`第 ${i+1} 个cookie验证失败: ${result.error},已跳过`);
135
+ }
136
+ }
137
+ }
138
+
139
+ // 检查是否有有效的cookie
140
+ if (this.cookieEntries.length === 0) {
141
+ logger.error('没有有效的cookie,初始化失败');
142
+ return false;
143
+ }
144
+
145
+ logger.success(`成功初始化 ${this.cookieEntries.length}/${cookieArray.length} 个cookie`);
146
+ this.initialized = true;
147
+ this.currentIndex = 0;
148
+ return true;
149
+ }
150
+
151
+ /**
152
+ * 保存cookie到文件
153
+ * @param {string} filePath - 保存路径
154
+ * @param {boolean} onlyValid - 是否只保存有效的cookie
155
+ * @returns {boolean} - 是否保存成功
156
+ */
157
+ saveToFile(filePath, onlyValid = true) {
158
+ try {
159
+ // 确保文件路径是绝对路径
160
+ const absolutePath = path.isAbsolute(filePath)
161
+ ? filePath
162
+ : path.join(dirname(__dirname), filePath);
163
+
164
+ // 获取要保存的cookie
165
+ const cookiesToSave = onlyValid
166
+ ? this.cookieEntries.filter(entry => entry.valid).map(entry => entry.cookie)
167
+ : this.cookieEntries.map(entry => entry.cookie);
168
+
169
+ // 根据文件扩展名选择保存格式
170
+ const ext = path.extname(absolutePath).toLowerCase();
171
+
172
+ if (ext === '.json') {
173
+ // 保存为JSON格式
174
+ const jsonData = {
175
+ cookies: cookiesToSave,
176
+ updatedAt: new Date().toISOString(),
177
+ count: cookiesToSave.length
178
+ };
179
+ fs.writeFileSync(absolutePath, JSON.stringify(jsonData, null, 2), 'utf8');
180
+ } else {
181
+ // 保存为文本格式,每行一个cookie
182
+ const content = cookiesToSave.join('\n');
183
+ fs.writeFileSync(absolutePath, content, 'utf8');
184
+ }
185
+
186
+ logger.success(`已将 ${cookiesToSave.length} 个cookie保存到文件: ${absolutePath}`);
187
+ return true;
188
+ } catch (error) {
189
+ logger.error(`保存cookie到文件失败: ${error.message}`);
190
+ return false;
191
+ }
192
+ }
193
+
194
+ /**
195
+ * 获取Notion的空间ID和用户ID
196
+ * @param {string} cookie - Notion cookie
197
+ * @returns {Promise<Object>} - 包含ID信息的对象
198
+ */
199
+ async fetchNotionIds(cookie, retryCount = 0) {
200
+ if (!cookie) {
201
+ return { success: false, error: '未提供cookie' };
202
+ }
203
+
204
+ try {
205
+ // 创建JSDOM实例模拟浏览器环境
206
+ const dom = new JSDOM("", {
207
+ url: "https://www.notion.so",
208
+ referrer: "https://www.notion.so/",
209
+ contentType: "text/html",
210
+ includeNodeLocations: true,
211
+ storageQuota: 10000000,
212
+ pretendToBeVisual: true,
213
+ userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"
214
+ });
215
+
216
+ // 设置全局对象
217
+ const { window } = dom;
218
+
219
+ // 安全地设置全局对象
220
+ if (!global.window) global.window = window;
221
+ if (!global.document) global.document = window.document;
222
+
223
+ // 设置navigator
224
+ if (!global.navigator) {
225
+ try {
226
+ Object.defineProperty(global, 'navigator', {
227
+ value: window.navigator,
228
+ writable: true,
229
+ configurable: true
230
+ });
231
+ } catch (navError) {
232
+ logger.warning(`无法设置navigator: ${navError.message},继续执行`);
233
+ }
234
+ }
235
+
236
+ // 设置cookie
237
+ document.cookie = cookie;
238
+
239
+ // 创建fetch选项
240
+ const fetchOptions = {
241
+ method: 'POST',
242
+ headers: {
243
+ 'Content-Type': 'application/json',
244
+ 'accept': '*/*',
245
+ 'accept-language': 'en-US,en;q=0.9',
246
+ 'notion-audit-log-platform': 'web',
247
+ 'notion-client-version': '23.13.0.3686',
248
+ 'origin': 'https://www.notion.so',
249
+ 'referer': 'https://www.notion.so/',
250
+ 'user-agent': window.navigator.userAgent,
251
+ 'Cookie': cookie
252
+ },
253
+ body: JSON.stringify({}),
254
+ };
255
+
256
+ // 添加代理配置(如果有)
257
+ if (this.proxyUrl) {
258
+ const { HttpsProxyAgent } = await import('https-proxy-agent');
259
+ fetchOptions.agent = new HttpsProxyAgent(this.proxyUrl);
260
+ logger.info(`使用代理: ${this.proxyUrl}`);
261
+ }
262
+
263
+ // 发送请求
264
+ const response = await fetch("https://www.notion.so/api/v3/getSpaces", fetchOptions);
265
+
266
+ // 检查响应状态
267
+ if (response.status === 401) {
268
+ return { success: false, status: 401, error: '未授权,cookie无效' };
269
+ }
270
+
271
+ if (!response.ok) {
272
+ throw new Error(`HTTP error! status: ${response.status}`);
273
+ }
274
+
275
+ const data = await response.json();
276
+
277
+ // 提取用户ID
278
+ const userIdKey = Object.keys(data)[0];
279
+ if (!userIdKey) {
280
+ throw new Error('无法从响应中提取用户ID');
281
+ }
282
+
283
+ const userId = userIdKey;
284
+
285
+ // 提取空间ID
286
+ const userRoot = data[userIdKey]?.user_root?.[userIdKey];
287
+ const spaceViewPointers = userRoot?.value?.value?.space_view_pointers;
288
+
289
+ if (!spaceViewPointers || !Array.isArray(spaceViewPointers) || spaceViewPointers.length === 0) {
290
+ throw new Error('在响应中找不到space_view_pointers或spaceId');
291
+ }
292
+
293
+ const spaceId = spaceViewPointers[0].spaceId;
294
+
295
+ if (!spaceId) {
296
+ throw new Error('无法从space_view_pointers中提取spaceId');
297
+ }
298
+
299
+ // 清理全局对象
300
+ this.cleanupGlobalObjects();
301
+
302
+ return {
303
+ success: true,
304
+ userId,
305
+ spaceId
306
+ };
307
+
308
+ } catch (error) {
309
+ // 清理全局对象
310
+ this.cleanupGlobalObjects();
311
+
312
+ // 重试逻辑
313
+ if (retryCount < this.maxRetries && error.message !== '未授权,cookie无效') {
314
+ logger.warning(`获取Notion ID失败,正在重试 (${retryCount + 1}/${this.maxRetries}): ${error.message}`);
315
+ return await this.fetchNotionIds(cookie, retryCount + 1);
316
+ }
317
+
318
+ return {
319
+ success: false,
320
+ error: error.message
321
+ };
322
+ }
323
+ }
324
+
325
+ /**
326
+ * 清理全局对象
327
+ */
328
+ cleanupGlobalObjects() {
329
+ try {
330
+ if (global.window) delete global.window;
331
+ if (global.document) delete global.document;
332
+
333
+ // 安全地删除navigator
334
+ if (global.navigator) {
335
+ try {
336
+ delete global.navigator;
337
+ } catch (navError) {
338
+ // 如果无法删除,尝试将其设置为undefined
339
+ try {
340
+ Object.defineProperty(global, 'navigator', {
341
+ value: undefined,
342
+ writable: true,
343
+ configurable: true
344
+ });
345
+ } catch (defineError) {
346
+ logger.warning(`无法清理navigator: ${defineError.message}`);
347
+ }
348
+ }
349
+ }
350
+ } catch (cleanupError) {
351
+ logger.warning(`清理全局对象时出错: ${cleanupError.message}`);
352
+ }
353
+ }
354
+
355
+ /**
356
+ * 获取下一个可用的cookie及其ID
357
+ * @returns {Object|null} - cookie及其对应的ID,如果没有可用cookie则返回null
358
+ */
359
+ getNext() {
360
+ if (!this.initialized || this.cookieEntries.length === 0) {
361
+ return null;
362
+ }
363
+
364
+ // 轮询选择下一个cookie
365
+ const entry = this.cookieEntries[this.currentIndex];
366
+
367
+ // 更新索引,实现轮询
368
+ this.currentIndex = (this.currentIndex + 1) % this.cookieEntries.length;
369
+
370
+ // 更新最后使用时间
371
+ entry.lastUsed = Date.now();
372
+
373
+ return {
374
+ cookie: entry.cookie,
375
+ spaceId: entry.spaceId,
376
+ userId: entry.userId
377
+ };
378
+ }
379
+
380
+ /**
381
+ * 标记cookie为无效
382
+ * @param {string} userId - 用户ID
383
+ */
384
+ markAsInvalid(userId) {
385
+ const index = this.cookieEntries.findIndex(entry => entry.userId === userId);
386
+ if (index !== -1) {
387
+ this.cookieEntries[index].valid = false;
388
+ logger.warning(`已将用户ID为 ${userId} 的cookie标记为无效`);
389
+
390
+ // 过滤掉所有无效的cookie
391
+ this.cookieEntries = this.cookieEntries.filter(entry => entry.valid);
392
+
393
+ // 重置当前索引
394
+ if (this.cookieEntries.length > 0) {
395
+ this.currentIndex = 0;
396
+ }
397
+ }
398
+ }
399
+
400
+ /**
401
+ * 获取有效cookie的数量
402
+ * @returns {number} - 有效cookie的数量
403
+ */
404
+ getValidCount() {
405
+ return this.cookieEntries.filter(entry => entry.valid).length;
406
+ }
407
+
408
+ /**
409
+ * 获取所有cookie的状态信息
410
+ * @returns {Array} - cookie状态数组
411
+ */
412
+ getStatus() {
413
+ return this.cookieEntries.map((entry, index) => ({
414
+ index,
415
+ userId: entry.userId.substring(0, 8) + '...',
416
+ spaceId: entry.spaceId.substring(0, 8) + '...',
417
+ valid: entry.valid,
418
+ lastUsed: entry.lastUsed ? new Date(entry.lastUsed).toLocaleString() : 'never'
419
+ }));
420
+ }
421
+ }
422
+
423
+ export const cookieManager = new CookieManager();
src/ProxyPool.js ADDED
@@ -0,0 +1,513 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import axios from 'axios';
2
+
3
+ /**
4
+ * 代理池类,用于管理和提供HTTP代理
5
+ */
6
+ class ProxyPool {
7
+ /**
8
+ * 创建代理池实例
9
+ * @param {Object} options - 配置选项
10
+ * @param {number} options.targetCount - 目标代理数量,默认20
11
+ * @param {number} options.batchSize - 每次获取的代理数量,默认20
12
+ * @param {number} options.testTimeout - 测试代理超时时间(毫秒),默认5000
13
+ * @param {number} options.requestTimeout - 请求目标网站超时时间(毫秒),默认10000
14
+ * @param {string} options.targetUrl - 目标网站URL,默认'https://www.notion.so'
15
+ * @param {number} options.concurrentRequests - 并发请求数量,默认10
16
+ * @param {number} options.minThreshold - 可用代理数量低于此阈值时自动补充,默认5
17
+ * @param {number} options.checkInterval - 检查代理池状态的时间间隔(毫秒),默认30000
18
+ * @param {string} options.proxyProtocol - 代理协议,默认'http'
19
+ * @param {number} options.maxRefillAttempts - 最大补充尝试次数,默认20
20
+ * @param {number} options.retryDelay - 重试延迟(毫秒),默认1000
21
+ * @param {boolean} options.useCache - 是否使用缓存,默认true
22
+ * @param {number} options.cacheExpiry - 缓存过期时间(毫秒),默认3600000 (1小时)
23
+ */
24
+ constructor(options = {}) {
25
+ // 配置参数
26
+ this.targetCount = options.targetCount || 20;
27
+ this.batchSize = options.batchSize || 20;
28
+ this.testTimeout = options.testTimeout || 5000;
29
+ this.requestTimeout = options.requestTimeout || 10000;
30
+ this.targetUrl = options.targetUrl || 'https://www.notion.so';
31
+ this.concurrentRequests = options.concurrentRequests || 10;
32
+ this.minThreshold = options.minThreshold || 5;
33
+ this.checkInterval = options.checkInterval || 30000; // 默认30秒检查一次
34
+ this.proxyProtocol = options.proxyProtocol || 'http';
35
+ this.maxRefillAttempts = options.maxRefillAttempts || 20; // 减少最大尝试次数
36
+ this.retryDelay = options.retryDelay || 1000; // 减少重试延迟
37
+ this.useCache = options.useCache !== undefined ? options.useCache : true;
38
+ this.cacheExpiry = options.cacheExpiry || 3600000; // 默认1小时
39
+
40
+ // 内部状态
41
+ this.availableProxies = [];
42
+ this.currentIndex = 0;
43
+ this.isInitialized = false;
44
+ this.isRefilling = false;
45
+ this.checkTimer = null;
46
+ this.proxyCache = new Map(); // 缓存验证过的代理
47
+
48
+ // 绑定方法
49
+ this.getProxy = this.getProxy.bind(this);
50
+ this.removeProxy = this.removeProxy.bind(this);
51
+ this.checkAndRefill = this.checkAndRefill.bind(this);
52
+ }
53
+
54
+ /**
55
+ * 初始化代理池
56
+ * @returns {Promise<void>}
57
+ */
58
+ async initialize() {
59
+ if (this.isInitialized) return;
60
+
61
+ console.log(`初始化代理池,目标数量: ${this.targetCount}`);
62
+ await this.refillProxies();
63
+
64
+ // 设置定时检查
65
+ this.checkTimer = setInterval(this.checkAndRefill, this.checkInterval);
66
+
67
+ this.isInitialized = true;
68
+ console.log(`代理池初始化完成,当前可用代理数量: ${this.availableProxies.length}`);
69
+ }
70
+
71
+ /**
72
+ * 停止代理池服务
73
+ */
74
+ stop() {
75
+ if (this.checkTimer) {
76
+ clearInterval(this.checkTimer);
77
+ this.checkTimer = null;
78
+ }
79
+ console.log('代理池服务已停止');
80
+ }
81
+
82
+ /**
83
+ * 检查并补充代理
84
+ */
85
+ async checkAndRefill() {
86
+ if (this.availableProxies.length <= this.minThreshold && !this.isRefilling) {
87
+ console.log(`可用代理数量(${this.availableProxies.length})低于阈值(${this.minThreshold}),开始补充代理`);
88
+ await this.refillProxies();
89
+ }
90
+ }
91
+
92
+ /**
93
+ * 补充代理到目标数量
94
+ * @returns {Promise<void>}
95
+ */
96
+ async refillProxies() {
97
+ if (this.isRefilling) return;
98
+
99
+ this.isRefilling = true;
100
+ console.log(`开始补充代理,当前数量: ${this.availableProxies.length},目标数量: ${this.targetCount}`);
101
+
102
+ let attempts = 0;
103
+
104
+ try {
105
+ // 计算需要补充的代理数量
106
+ const neededProxies = this.targetCount - this.availableProxies.length;
107
+
108
+ // 优先检查缓存中的代理
109
+ if (this.useCache && this.proxyCache.size > 0) {
110
+ await this.tryUsingCachedProxies(neededProxies);
111
+ }
112
+
113
+ // 如果缓存中的代理不足,继续获取新代理
114
+ while (this.availableProxies.length < this.targetCount && attempts < this.maxRefillAttempts) {
115
+ attempts++;
116
+
117
+ console.log(`补充尝试 #${attempts},当前可用代理: ${this.availableProxies.length}/${this.targetCount}`);
118
+
119
+ // 计算本次需要获取的批次大小
120
+ const remainingNeeded = this.targetCount - this.availableProxies.length;
121
+ const batchSizeNeeded = Math.max(this.batchSize, remainingNeeded * 2); // 获取更多代理以提高成功率
122
+
123
+ // 获取代理
124
+ const proxies = await this.getProxiesFromProvider(batchSizeNeeded);
125
+
126
+ if (proxies.length === 0) {
127
+ console.log(`没有获取到代理,等待${this.retryDelay/1000}秒后重试...`);
128
+ await new Promise(resolve => setTimeout(resolve, this.retryDelay));
129
+ continue;
130
+ }
131
+
132
+ // 过滤掉已有的代理
133
+ const newProxies = this.filterExistingProxies(proxies);
134
+
135
+ if (newProxies.length === 0) {
136
+ console.log('所有获取的代理都已存在,继续获取新代理...');
137
+ continue;
138
+ }
139
+
140
+ // 测试代理
141
+ const results = await this.testProxiesConcurrently(newProxies);
142
+
143
+ // 添加可用代理
144
+ this.addValidProxies(results);
145
+
146
+ // 如果已经获取到足够的代理,提前结束
147
+ if (this.availableProxies.length >= this.targetCount) {
148
+ break;
149
+ }
150
+
151
+ // 如果还没补充到足够的代理,等待一段时间再继续
152
+ if (this.availableProxies.length < this.targetCount) {
153
+ await new Promise(resolve => setTimeout(resolve, this.retryDelay));
154
+ }
155
+ }
156
+ } catch (error) {
157
+ console.error('补充代理过程中出错:', error);
158
+ } finally {
159
+ this.isRefilling = false;
160
+
161
+ if (this.availableProxies.length >= this.targetCount) {
162
+ console.log(`代理补充完成,当前可用代理: ${this.availableProxies.length}/${this.targetCount}`);
163
+ } else {
164
+ console.log(`已达到最大尝试次数 ${this.maxRefillAttempts},当前可用代理: ${this.availableProxies.length}/${this.targetCount}`);
165
+ }
166
+ }
167
+ }
168
+
169
+ /**
170
+ * 尝试使用缓存中的代理
171
+ * @param {number} neededProxies - 需要的代理数量
172
+ */
173
+ async tryUsingCachedProxies(neededProxies) {
174
+ const now = Date.now();
175
+ const cachedProxies = [];
176
+
177
+ // 筛选未过期的缓存代理
178
+ for (const [proxyKey, data] of this.proxyCache.entries()) {
179
+ if (now - data.timestamp < this.cacheExpiry && data.valid) {
180
+ cachedProxies.push(proxyKey);
181
+
182
+ if (cachedProxies.length >= neededProxies) {
183
+ break;
184
+ }
185
+ }
186
+ }
187
+
188
+ if (cachedProxies.length > 0) {
189
+ console.log(`从缓存中找到 ${cachedProxies.length} 个可能可用的代理`);
190
+
191
+ // 验证缓存的代理是否仍然可用
192
+ const results = await this.testProxiesConcurrently(cachedProxies);
193
+ this.addValidProxies(results);
194
+ }
195
+ }
196
+
197
+ /**
198
+ * 过滤掉已存在的代理
199
+ * @param {Array<string>} proxies - 代理列表
200
+ * @returns {Array<string>} - 新代理列表
201
+ */
202
+ filterExistingProxies(proxies) {
203
+ return proxies.filter(proxy => {
204
+ const [ip, port] = proxy.split(':');
205
+ return !this.availableProxies.some(p => p.ip === ip && p.port === port);
206
+ });
207
+ }
208
+
209
+ /**
210
+ * 添加有效的代理到代理池
211
+ * @param {Array<{proxy: string, result: boolean}>} results - 测试结果
212
+ */
213
+ addValidProxies(results) {
214
+ for (const { proxy, result } of results) {
215
+ if (result) {
216
+ const [ip, port] = proxy.split(':');
217
+
218
+ // 检查是否已存在
219
+ if (!this.availableProxies.some(p => p.ip === ip && p.port === port)) {
220
+ const proxyObj = {
221
+ ip,
222
+ port,
223
+ protocol: this.proxyProtocol,
224
+ full: `${this.proxyProtocol}://${proxy}`,
225
+ addedAt: new Date().toISOString()
226
+ };
227
+
228
+ this.availableProxies.push(proxyObj);
229
+
230
+ // 添加到缓存
231
+ if (this.useCache) {
232
+ this.proxyCache.set(proxy, {
233
+ valid: true,
234
+ timestamp: Date.now()
235
+ });
236
+ }
237
+
238
+ console.log(`成功添加代理: ${proxyObj.full},当前可用代理: ${this.availableProxies.length}/${this.targetCount}`);
239
+
240
+ if (this.availableProxies.length >= this.targetCount) {
241
+ break;
242
+ }
243
+ }
244
+ } else if (this.useCache) {
245
+ // 记录无效代理到缓存
246
+ this.proxyCache.set(proxy, {
247
+ valid: false,
248
+ timestamp: Date.now()
249
+ });
250
+ }
251
+ }
252
+ }
253
+
254
+ /**
255
+ * 从代理服务获取代理URL
256
+ * @param {number} count - 请求的代理数量
257
+ * @returns {Promise<Array<string>>} - 代理URL列表
258
+ */
259
+ async getProxiesFromProvider(count = null) {
260
+ try {
261
+ console.log(`使用自定义代理服务器`);
262
+ // 直接返回配置的代理
263
+ return ['34.55.224.190:8080'];
264
+ } catch (error) {
265
+ console.error('获取代理出错:', error.message);
266
+ return [];
267
+ }
268
+ }
269
+
270
+ /**
271
+ * 并发测试多个代理
272
+ * @param {Array<string>} proxies - 代理列表
273
+ * @returns {Promise<Array<{proxy: string, result: boolean}>>} - 测试结果
274
+ */
275
+ async testProxiesConcurrently(proxies) {
276
+ const results = [];
277
+ const remainingNeeded = this.targetCount - this.availableProxies.length;
278
+
279
+ // 增加并发数以加快处理速度
280
+ const concurrentRequests = Math.min(this.concurrentRequests * 2, 20);
281
+
282
+ // 分批处理代理
283
+ for (let i = 0; i < proxies.length; i += concurrentRequests) {
284
+ const batch = proxies.slice(i, i + concurrentRequests);
285
+ const promises = batch.map(proxy => {
286
+ // 检查缓存中是否有近期验证过的结果
287
+ if (this.useCache && this.proxyCache.has(proxy)) {
288
+ const cachedResult = this.proxyCache.get(proxy);
289
+ const isFresh = (Date.now() - cachedResult.timestamp) < this.cacheExpiry;
290
+
291
+ if (isFresh) {
292
+ // 使用缓存结果,避免重复测试
293
+ return Promise.resolve({ proxy, result: cachedResult.valid });
294
+ }
295
+ }
296
+
297
+ return this.testProxy(proxy)
298
+ .then(result => ({ proxy, result }))
299
+ .catch(() => ({ proxy, result: false }));
300
+ });
301
+
302
+ const batchResults = await Promise.all(promises);
303
+ results.push(...batchResults);
304
+
305
+ // 如果已经找到足够的代理,提前结束测试
306
+ const successCount = results.filter(item => item.result).length;
307
+ if (successCount >= remainingNeeded) {
308
+ break;
309
+ }
310
+ }
311
+
312
+ return results;
313
+ }
314
+
315
+ /**
316
+ * 测试代理是否可用
317
+ * @param {string} proxyUrl - 代理URL
318
+ * @returns {Promise<boolean>} - 代理是否可用
319
+ */
320
+ async testProxy(proxyUrl) {
321
+ try {
322
+ // 创建代理配置
323
+ const proxyConfig = {
324
+ host: proxyUrl.split(':')[0],
325
+ port: parseInt(proxyUrl.split(':')[1]),
326
+ protocol: this.proxyProtocol
327
+ };
328
+
329
+ // 发送请求到目标网站
330
+ const response = await axios.get(this.targetUrl, {
331
+ proxy: proxyConfig,
332
+ headers: {
333
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
334
+ 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
335
+ 'Accept-Language': 'en-US,en;q=0.5',
336
+ 'Connection': 'keep-alive',
337
+ 'Upgrade-Insecure-Requests': '1'
338
+ },
339
+ timeout: this.requestTimeout,
340
+ validateStatus: status => true,
341
+ maxRedirects: 10,
342
+ followRedirect: true
343
+ });
344
+
345
+ // 检查响应是否包含目标网站特有的内容
346
+ const isTargetContent = response.data &&
347
+ (typeof response.data === 'string') &&
348
+ (response.data.includes('notion') ||
349
+ response.data.includes('Notion'));
350
+
351
+ const isValid = response.status === 200 && isTargetContent;
352
+
353
+ if (isValid) {
354
+ console.log(`代理 ${proxyUrl} 请求目标网站成功,状态码: ${response.status}`);
355
+ } else {
356
+ console.log(`代理 ${proxyUrl} 请求目标网站失败,状态码: ${response.status}`);
357
+ }
358
+
359
+ return isValid;
360
+ } catch (error) {
361
+ console.log(`代理 ${proxyUrl} 请求出错: ${error.message}`);
362
+ return false;
363
+ }
364
+ }
365
+
366
+ /**
367
+ * 获取一个可用代理
368
+ * @returns {Object|null} - 代理对象,如果没有可用代理则返回null
369
+ */
370
+ getProxy() {
371
+ if (this.availableProxies.length === 0) {
372
+ console.log('没有可用代理');
373
+ return null;
374
+ }
375
+
376
+ // 轮询方式获取代理
377
+ const proxy = this.availableProxies[this.currentIndex];
378
+ this.currentIndex = (this.currentIndex + 1) % this.availableProxies.length;
379
+
380
+ return proxy;
381
+ }
382
+
383
+ /**
384
+ * 移除指定代理
385
+ * @param {string} ip - 代理IP
386
+ * @param {string|number} port - 代理端口
387
+ * @returns {boolean} - 是否成功移除
388
+ */
389
+ removeProxy(ip, port) {
390
+ const portStr = port.toString();
391
+ const initialLength = this.availableProxies.length;
392
+
393
+ // 找到要移除的代理
394
+ const proxyToRemove = this.availableProxies.find(
395
+ proxy => proxy.ip === ip && proxy.port === portStr
396
+ );
397
+
398
+ if (proxyToRemove) {
399
+ // 更新缓存,标记为无效
400
+ if (this.useCache) {
401
+ const proxyKey = `${ip}:${portStr}`;
402
+ this.proxyCache.set(proxyKey, { valid: false, timestamp: Date.now() });
403
+ }
404
+ }
405
+
406
+ this.availableProxies = this.availableProxies.filter(
407
+ proxy => !(proxy.ip === ip && proxy.port === portStr)
408
+ );
409
+
410
+ // 重置当前索引,确保不会越界
411
+ if (this.currentIndex >= this.availableProxies.length && this.availableProxies.length > 0) {
412
+ this.currentIndex = 0;
413
+ }
414
+
415
+ const removed = initialLength > this.availableProxies.length;
416
+
417
+ if (removed) {
418
+ console.log(`已移除代理 ${ip}:${port},当前可用代理: ${this.availableProxies.length}`);
419
+ } else {
420
+ console.log(`未找到要移除的代理 ${ip}:${port}`);
421
+ }
422
+
423
+ // 如果移除后代理数量低于阈值,触发补充
424
+ this.checkAndRefill();
425
+
426
+ return removed;
427
+ }
428
+
429
+ /**
430
+ * 获取所有可用代理
431
+ * @returns {Array<Object>} - 代理对象数组
432
+ */
433
+ getAllProxies() {
434
+ return [...this.availableProxies];
435
+ }
436
+
437
+ /**
438
+ * 获取可用代理数量
439
+ * @returns {number} - 代理数量
440
+ */
441
+ getCount() {
442
+ return this.availableProxies.length;
443
+ }
444
+
445
+ /**
446
+ * 清理过期的缓存条目
447
+ */
448
+ cleanupCache() {
449
+ if (!this.useCache) return;
450
+
451
+ const now = Date.now();
452
+ let cleanupCount = 0;
453
+
454
+ for (const [key, data] of this.proxyCache.entries()) {
455
+ if (now - data.timestamp > this.cacheExpiry) {
456
+ this.proxyCache.delete(key);
457
+ cleanupCount++;
458
+ }
459
+ }
460
+
461
+ if (cleanupCount > 0) {
462
+ console.log(`清理了 ${cleanupCount} 个过期的缓存代理`);
463
+ }
464
+ }
465
+ }
466
+
467
+ // 使用示例
468
+ async function example() {
469
+ // 创建代理池实例
470
+ const proxyPool = new ProxyPool({
471
+ targetCount: 10, // 目标保持10个代理
472
+ minThreshold: 3, // 当可用代理少于3个时,自动补充
473
+ checkInterval: 60000, // 每60秒检查一次
474
+ targetUrl: 'https://www.notion.so',
475
+ concurrentRequests: 15, // 增加并发请求数
476
+ useCache: true, // 启用缓存
477
+ maxRefillAttempts: 15, // 减少最大尝试次数
478
+ retryDelay: 1000 // 减少重试延迟
479
+ });
480
+
481
+ // 初始化代理池
482
+ await proxyPool.initialize();
483
+
484
+ // 获取一个代理
485
+ const proxy = proxyPool.getProxy();
486
+ console.log('获取到代理:', proxy);
487
+
488
+ // 模拟使用一段时间后,移除一个代理
489
+ setTimeout(() => {
490
+ if (proxy) {
491
+ proxyPool.removeProxy(proxy.ip, proxy.port);
492
+ }
493
+
494
+ // 获取所有代理
495
+ const allProxies = proxyPool.getAllProxies();
496
+ console.log(`当前所有代理(${allProxies.length}):`, allProxies);
497
+
498
+ // 使用完毕后停止服务
499
+ setTimeout(() => {
500
+ proxyPool.stop();
501
+ console.log('代理池示例运行完毕');
502
+ }, 5000);
503
+ }, 5000);
504
+ }
505
+
506
+ // 如果直接运行此文件,则执行示例
507
+ if (typeof require !== 'undefined' && require.main === module) {
508
+ example().catch(err => console.error('示例运行出错:', err));
509
+ }
510
+
511
+ // 导出 ProxyPool 类和实例
512
+ export default ProxyPool;
513
+ export const proxyPool = new ProxyPool();
src/ProxyServer.js ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { spawn } from 'child_process';
2
+ import { fileURLToPath } from 'url';
3
+ import { dirname, join } from 'path';
4
+ import fs from 'fs';
5
+ import os from 'os';
6
+ import dotenv from 'dotenv';
7
+ import chalk from 'chalk';
8
+
9
+ // 获取当前文件的目录路径
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = dirname(__filename);
12
+
13
+ // 加载环境变量
14
+ dotenv.config({ path: join(dirname(__dirname), '.env') });
15
+
16
+ // 日志配置
17
+ const logger = {
18
+ info: (message) => console.log(chalk.blue(`[ProxyServer] ${message}`)),
19
+ error: (message) => console.error(chalk.red(`[ProxyServer] ${message}`)),
20
+ warning: (message) => console.warn(chalk.yellow(`[ProxyServer] ${message}`)),
21
+ success: (message) => console.log(chalk.green(`[ProxyServer] ${message}`)),
22
+ };
23
+
24
+ class ProxyServer {
25
+ constructor() {
26
+ this.proxyProcess = null;
27
+ this.platform = process.env.PROXY_SERVER_PLATFORM || 'auto';
28
+ this.port = process.env.PROXY_SERVER_PORT || 10655;
29
+ this.logPath = process.env.PROXY_SERVER_LOG_PATH || './proxy_server.log';
30
+ this.enabled = process.env.ENABLE_PROXY_SERVER === 'true';
31
+ this.proxyAuthToken = process.env.PROXY_AUTH_TOKEN || 'default_token';
32
+ this.logStream = null;
33
+ }
34
+
35
+ // 获取当前系统平台
36
+ detectPlatform() {
37
+ if (this.platform !== 'auto') {
38
+ return this.platform;
39
+ }
40
+
41
+ const platform = os.platform();
42
+ const arch = os.arch();
43
+
44
+ if (platform === 'win32') {
45
+ return 'windows';
46
+ } else if (platform === 'linux') {
47
+ if (arch === 'arm64') {
48
+ return 'android';
49
+ } else {
50
+ return 'linux';
51
+ }
52
+ } else if (platform === 'android') {
53
+ return 'android';
54
+ } else {
55
+ logger.warning(`未知平台: ${platform}, ${arch}, 默认使用linux版本`);
56
+ return 'linux';
57
+ }
58
+ }
59
+
60
+ // 获取代理服务器可执行文件路径
61
+ getProxyServerPath() {
62
+ const platform = this.detectPlatform();
63
+ const proxyDir = join(__dirname, 'proxy');
64
+
65
+ switch (platform) {
66
+ case 'windows':
67
+ return join(proxyDir, 'chrome_proxy_server_windows_amd64.exe');
68
+ case 'linux':
69
+ return join(proxyDir, 'chrome_proxy_server_linux_amd64');
70
+ case 'android':
71
+ return join(proxyDir, 'chrome_proxy_server_android_arm64');
72
+ default:
73
+ logger.error(`不支持的平台: ${platform}`);
74
+ return null;
75
+ }
76
+ }
77
+
78
+ // 启动代理服务器
79
+ async start() {
80
+ if (!this.enabled) {
81
+ logger.info('代理服务器未启用,跳过启动');
82
+ return;
83
+ }
84
+
85
+ if (this.proxyProcess) {
86
+ logger.warning('代理服务器已经在运行中');
87
+ return;
88
+ }
89
+
90
+ const proxyServerPath = this.getProxyServerPath();
91
+ if (!proxyServerPath) {
92
+ logger.error('无法获取代理服务器路径');
93
+ return;
94
+ }
95
+
96
+ // 检查proxychains.conf文件是否存在
97
+ const proxyChainsConfigPath = join(dirname(__dirname), 'proxychains.conf');
98
+ try {
99
+ if (fs.existsSync(proxyChainsConfigPath)) {
100
+ logger.info(`找到proxychains配置文件: ${proxyChainsConfigPath}`);
101
+ // 输出配置文件内容
102
+ const configContent = fs.readFileSync(proxyChainsConfigPath, 'utf8');
103
+ logger.info(`proxychains配置内容: ${configContent}`);
104
+ } else {
105
+ logger.error(`proxychains配置文件不存在: ${proxyChainsConfigPath}`);
106
+ // 尝试在标准位置查找
107
+ const altConfigPath = '/etc/proxychains/proxychains.conf';
108
+ if (fs.existsSync(altConfigPath)) {
109
+ logger.info(`找到备用proxychains配置: ${altConfigPath}`);
110
+ } else {
111
+ logger.error('找不到任何可用的proxychains配置');
112
+ }
113
+ }
114
+ } catch (error) {
115
+ logger.error(`检查proxychains配置时出错: ${error.message}`);
116
+ }
117
+
118
+ try {
119
+ // 确保可执行文件有执行权限(在Linux/Android上)
120
+ if (this.detectPlatform() !== 'windows') {
121
+ try {
122
+ fs.chmodSync(proxyServerPath, 0o755);
123
+ } catch (err) {
124
+ logger.warning(`无法设置执行权限: ${err.message}`);
125
+ }
126
+ }
127
+
128
+ // 创建日志文件
129
+ this.logStream = fs.createWriteStream(this.logPath, { flags: 'a' });
130
+
131
+ // 获取 proxy.conf 路径
132
+ const proxyChainsConfigPath = join(dirname(__dirname), 'proxychains.conf');
133
+
134
+ // 环境变量方式设置代理
135
+ const env = {
136
+ ...process.env,
137
+ HTTP_PROXY: 'http://34.55.224.190:8080',
138
+ HTTPS_PROXY: 'http://34.55.224.190:8080',
139
+ http_proxy: 'http://34.55.224.190:8080',
140
+ https_proxy: 'http://34.55.224.190:8080',
141
+ PROXYCHAINS_CONF_FILE: proxyChainsConfigPath,
142
+ LD_PRELOAD: '/usr/lib/x86_64-linux-gnu/libproxychains.so.4'
143
+ };
144
+
145
+ // 尝试使用 proxychains + 环境变量的组合方式
146
+ this.proxyProcess = spawn('proxychains4', [
147
+ '-f', proxyChainsConfigPath,
148
+ proxyServerPath,
149
+ '--port', this.port.toString(),
150
+ '--token', this.proxyAuthToken
151
+ ], {
152
+ stdio: ['ignore', 'pipe', 'pipe'], // 使用pipe而不是直接传递流
153
+ detached: false,
154
+ env: env
155
+ });
156
+
157
+ // 将进程的输出重定向到日志文件
158
+ if (this.proxyProcess.stdout) {
159
+ this.proxyProcess.stdout.pipe(this.logStream);
160
+ }
161
+
162
+ if (this.proxyProcess.stderr) {
163
+ this.proxyProcess.stderr.pipe(this.logStream);
164
+ }
165
+
166
+ // 设置进程事件处理
167
+ this.proxyProcess.on('error', (err) => {
168
+ logger.error(`代理服务器启动失败: ${err.message}`);
169
+ this.proxyProcess = null;
170
+ if (this.logStream) {
171
+ this.logStream.end();
172
+ this.logStream = null;
173
+ }
174
+ });
175
+
176
+ this.proxyProcess.on('exit', (code, signal) => {
177
+ logger.info(`代理服务器已退出,退出码: ${code}, 信号: ${signal}`);
178
+ this.proxyProcess = null;
179
+ if (this.logStream) {
180
+ this.logStream.end();
181
+ this.logStream = null;
182
+ }
183
+ });
184
+
185
+ // 等待一段时间,确保服务器启动
186
+ await new Promise(resolve => setTimeout(resolve, 1000));
187
+
188
+ if (this.proxyProcess && this.proxyProcess.exitCode === null) {
189
+ logger.success(`代理服务器已启动,端口: ${this.port}, 日志文件: ${this.logPath}`);
190
+ return true;
191
+ } else {
192
+ logger.error('代理服务器启动失败');
193
+ if (this.logStream) {
194
+ this.logStream.end();
195
+ this.logStream = null;
196
+ }
197
+ return false;
198
+ }
199
+ } catch (error) {
200
+ logger.error(`启动代理服务器时出错: ${error.message}`);
201
+ if (this.logStream) {
202
+ this.logStream.end();
203
+ this.logStream = null;
204
+ }
205
+ return false;
206
+ }
207
+ }
208
+
209
+ // 停止代理服务器
210
+ stop() {
211
+ if (!this.proxyProcess) {
212
+ //logger.info('代理服务器已关闭');
213
+ return;
214
+ }
215
+
216
+ try {
217
+ // 在Windows上使用taskkill确保子进程也被终止
218
+ if (this.detectPlatform() === 'windows' && this.proxyProcess.pid) {
219
+ spawn('taskkill', ['/pid', this.proxyProcess.pid, '/f', '/t']);
220
+ } else {
221
+ // 在Linux/Android上使用kill信号
222
+ this.proxyProcess.kill('SIGTERM');
223
+ }
224
+
225
+ logger.success('代理服务器已停止');
226
+ } catch (error) {
227
+ logger.error(`停止代理服务器时出错: ${error.message}`);
228
+ } finally {
229
+ this.proxyProcess = null;
230
+ if (this.logStream) {
231
+ this.logStream.end();
232
+ this.logStream = null;
233
+ }
234
+ }
235
+ }
236
+ }
237
+
238
+ // 创建单例
239
+ const proxyServer = new ProxyServer();
240
+
241
+ // 导出
242
+ export { proxyServer };
src/cookie-cli.js ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env node
2
+
3
+ import { cookieManager } from './CookieManager.js';
4
+ import dotenv from 'dotenv';
5
+ import { fileURLToPath } from 'url';
6
+ import { dirname, join } from 'path';
7
+ import fs from 'fs';
8
+ import readline from 'readline';
9
+ import chalk from 'chalk';
10
+
11
+ // 获取当前文件的目录路径
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ const __dirname = dirname(__filename);
14
+
15
+ // 加载环境变量
16
+ dotenv.config({ path: join(dirname(__dirname), '.env') });
17
+
18
+ // 日志配置
19
+ const logger = {
20
+ info: (message) => console.log(chalk.blue(`[信息] ${message}`)),
21
+ error: (message) => console.error(chalk.red(`[错误] ${message}`)),
22
+ warning: (message) => console.warn(chalk.yellow(`[警告] ${message}`)),
23
+ success: (message) => console.log(chalk.green(`[成功] ${message}`)),
24
+ };
25
+
26
+ // 创建readline接口
27
+ const rl = readline.createInterface({
28
+ input: process.stdin,
29
+ output: process.stdout
30
+ });
31
+
32
+ // 默认cookie文件路径
33
+ const DEFAULT_COOKIE_FILE = 'cookies.txt';
34
+
35
+ let isSaveCookie = false;
36
+ let isAddCookie = false;
37
+
38
+ // 显示帮助信息
39
+ function showHelp() {
40
+ console.log(chalk.cyan('Notion Cookie 管理工具'));
41
+ console.log(chalk.cyan('===================='));
42
+ console.log('');
43
+ console.log('可用命令:');
44
+ console.log(' help - 显示此帮助信息');
45
+ console.log(' list - 列出所有cookie');
46
+ console.log(' add - 添加新的cookie');
47
+ console.log(' validate - 验证所有cookie');
48
+ console.log(' remove - 删除指定cookie');
49
+ console.log(' save - 保存cookie到文件');
50
+ console.log(' load - 从文件加载cookie');
51
+ console.log(' exit - 退出程序');
52
+ console.log('');
53
+ }
54
+
55
+ // 列出所有cookie
56
+ async function listCookies() {
57
+ if (!cookieManager.initialized || cookieManager.getValidCount() === 0) {
58
+ logger.warning('没有可用的cookie,请先加载或添加cookie');
59
+ return;
60
+ }
61
+
62
+ const status = cookieManager.getStatus();
63
+ console.log(chalk.cyan('\nCookie 列表:'));
64
+ console.log(chalk.cyan('==========='));
65
+
66
+ status.forEach((entry, idx) => {
67
+ const validMark = entry.valid ? chalk.green('✓') : chalk.red('✗');
68
+ console.log(`${idx + 1}. ${validMark} 用户ID: ${entry.userId}, 空间ID: ${entry.spaceId}, 上次使用: ${entry.lastUsed}`);
69
+ });
70
+
71
+ console.log(`\n共有 ${status.length} 个cookie,${cookieManager.getValidCount()} 个有效\n`);
72
+ }
73
+
74
+ // 添加新cookie
75
+ async function addCookie() {
76
+ return new Promise((resolve) => {
77
+ rl.question(chalk.yellow('请输入Notion cookie: '), async (cookie) => {
78
+ if (!cookie || cookie.trim() === '') {
79
+ logger.error('Cookie不能为空');
80
+ resolve();
81
+ return;
82
+ }
83
+
84
+ logger.info('正在验证cookie...');
85
+ const result = await cookieManager.fetchNotionIds(cookie.trim());
86
+
87
+ if (result.success) {
88
+ // 如果cookie管理器尚未初始化,先初始化
89
+ if (!cookieManager.initialized) {
90
+ await cookieManager.initialize(cookie.trim());
91
+ } else {
92
+ // 已初始化,直接添加到现有条目
93
+ cookieManager.cookieEntries.push({
94
+ cookie: cookie.trim(),
95
+ spaceId: result.spaceId,
96
+ userId: result.userId,
97
+ valid: true,
98
+ lastUsed: 0
99
+ });
100
+ }
101
+ isAddCookie = true;
102
+ logger.success(`Cookie添加成功! 用户ID: ${result.userId}, 空间ID: ${result.spaceId}`);
103
+
104
+ } else {
105
+ logger.error(`Cookie验证失败: ${result.error}`);
106
+ }
107
+
108
+ resolve();
109
+ });
110
+ });
111
+ }
112
+
113
+ // 验证所有cookie
114
+ async function validateCookies() {
115
+ if (!cookieManager.initialized || cookieManager.cookieEntries.length === 0) {
116
+ logger.warning('没有可用的cookie,请先加载或添加cookie');
117
+ return;
118
+ }
119
+
120
+ logger.info('开始验证所有cookie...');
121
+
122
+ const originalEntries = [...cookieManager.cookieEntries];
123
+ cookieManager.cookieEntries = [];
124
+
125
+ for (let i = 0; i < originalEntries.length; i++) {
126
+ const entry = originalEntries[i];
127
+ logger.info(`正在验证第 ${i+1}/${originalEntries.length} 个cookie...`);
128
+
129
+ const result = await cookieManager.fetchNotionIds(entry.cookie);
130
+ if (result.success) {
131
+ cookieManager.cookieEntries.push({
132
+ cookie: entry.cookie,
133
+ spaceId: result.spaceId,
134
+ userId: result.userId,
135
+ valid: true,
136
+ lastUsed: entry.lastUsed || 0
137
+ });
138
+ logger.success(`第 ${i+1} 个cookie验证成功`);
139
+ } else {
140
+ logger.error(`第 ${i+1} 个cookie验证失败: ${result.error}`);
141
+ }
142
+ }
143
+
144
+ logger.info(`验证完成,共 ${originalEntries.length} 个cookie,${cookieManager.cookieEntries.length} 个有效`);
145
+ }
146
+
147
+ // 删除指定cookie
148
+ async function removeCookie() {
149
+ if (!cookieManager.initialized || cookieManager.cookieEntries.length === 0) {
150
+ logger.warning('没有可用的cookie,请先加载或添加cookie');
151
+ return;
152
+ }
153
+
154
+ // 先列出所有cookie
155
+ await listCookies();
156
+
157
+ return new Promise((resolve) => {
158
+ rl.question(chalk.yellow('请输入要删除的cookie编号: '), (input) => {
159
+ const index = parseInt(input) - 1;
160
+
161
+ if (isNaN(index) || index < 0 || index >= cookieManager.cookieEntries.length) {
162
+ logger.error('无效的编号');
163
+ resolve();
164
+ return;
165
+ }
166
+
167
+ const removed = cookieManager.cookieEntries.splice(index, 1)[0];
168
+ logger.success(`已删除编号 ${index + 1} 的cookie (用户ID: ${removed.userId.substring(0, 8)}...)`);
169
+
170
+ // 重置当前索引
171
+ if (cookieManager.cookieEntries.length > 0) {
172
+ cookieManager.currentIndex = 0;
173
+ }
174
+
175
+ resolve();
176
+ });
177
+ });
178
+ }
179
+
180
+ // 保存cookie到文件
181
+ async function saveCookies() {
182
+ if (!cookieManager.initialized || cookieManager.cookieEntries.length === 0) {
183
+ logger.warning('没有可用的cookie,请先加载或添加cookie');
184
+ return;
185
+ }
186
+
187
+ return new Promise((resolve) => {
188
+ rl.question(chalk.yellow(`请输入保存文件路径 (默认: ${DEFAULT_COOKIE_FILE}): `), (filePath) => {
189
+ const path = filePath.trim() || DEFAULT_COOKIE_FILE;
190
+
191
+ rl.question(chalk.yellow('是否只保存有效的cookie? (y/n, 默认: y): '), (onlyValidInput) => {
192
+ const onlyValid = onlyValidInput.toLowerCase() !== 'n';
193
+
194
+ const success = cookieManager.saveToFile(path, onlyValid);
195
+ if (success) {
196
+ logger.success(`Cookie已保存到文件: ${path}`);
197
+ isSaveCookie = true;
198
+ }
199
+
200
+ resolve();
201
+ });
202
+ });
203
+ });
204
+ }
205
+
206
+ // 从文件加载cookie
207
+ async function loadCookies() {
208
+ return new Promise((resolve) => {
209
+ rl.question(chalk.yellow(`请输入cookie文件路径 (默认: ${DEFAULT_COOKIE_FILE}): `), async (filePath) => {
210
+ const path = filePath.trim() || DEFAULT_COOKIE_FILE;
211
+
212
+ logger.info(`正在从文件加载cookie: ${path}`);
213
+ const success = await cookieManager.loadFromFile(path);
214
+
215
+ if (success) {
216
+ logger.success(`成功从文件加载cookie,共 ${cookieManager.getValidCount()} 个有效cookie`);
217
+ } else {
218
+ logger.error(`从文件加载cookie失败`);
219
+ }
220
+
221
+ resolve();
222
+ });
223
+ });
224
+ }
225
+
226
+ // 主函数
227
+ async function main() {
228
+ // 显示欢迎信息
229
+ console.log(chalk.cyan('\nNotion Cookie 管理工具'));
230
+ console.log(chalk.cyan('====================\n'));
231
+
232
+ // 检查是否有环境变量中的cookie
233
+ const envCookie = process.env.NOTION_COOKIE;
234
+ if (envCookie) {
235
+ logger.info('检测到环境变量中的NOTION_COOKIE,正在初始化...');
236
+ await cookieManager.initialize(envCookie);
237
+ }
238
+
239
+ // 检查是否有环境变量中的cookie文件
240
+ const envCookieFile = process.env.COOKIE_FILE;
241
+ if (envCookieFile && !cookieManager.initialized) {
242
+ logger.info(`检测到环境变量中的COOKIE_FILE: ${envCookieFile},正在加载...`);
243
+ await cookieManager.loadFromFile(envCookieFile);
244
+ }
245
+
246
+ // 如果没有cookie,检查默认文件
247
+ if (!cookieManager.initialized && fs.existsSync(DEFAULT_COOKIE_FILE)) {
248
+ logger.info(`检测到默认cookie文件: ${DEFAULT_COOKIE_FILE},正在加载...`);
249
+ await cookieManager.loadFromFile(DEFAULT_COOKIE_FILE);
250
+ }
251
+
252
+ showHelp();
253
+
254
+ // 命令循环
255
+ while (true) {
256
+ const command = await new Promise((resolve) => {
257
+ rl.question(chalk.green('> '), (cmd) => {
258
+ resolve(cmd.trim().toLowerCase());
259
+ });
260
+ });
261
+
262
+ switch (command) {
263
+ case 'help':
264
+ showHelp();
265
+ break;
266
+ case 'list':
267
+ await listCookies();
268
+ break;
269
+ case 'add':
270
+ await addCookie();
271
+ break;
272
+ case 'validate':
273
+ await validateCookies();
274
+ break;
275
+ case 'remove':
276
+ await removeCookie();
277
+ break;
278
+ case 'save':
279
+ await saveCookies();
280
+ break;
281
+ case 'load':
282
+ await loadCookies();
283
+ break;
284
+ case 'exit':
285
+ case 'quit':
286
+ case 'q':
287
+ logger.info('感谢使用,再见!');
288
+ rl.close();
289
+ process.exit(0);
290
+ default:
291
+ logger.error(`未知命令: ${command}`);
292
+ logger.info('输入 "help" 查看可用命令');
293
+ }
294
+ }
295
+ }
296
+
297
+ // 启动程序
298
+ main().catch((error) => {
299
+ logger.error(`程序出错: ${error.message}`);
300
+ process.exit(1);
301
+ });
src/lightweight-client-express.js ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import express from 'express';
2
+ import dotenv from 'dotenv';
3
+ import { randomUUID } from 'crypto';
4
+ import { fileURLToPath } from 'url';
5
+ import { dirname, join } from 'path';
6
+ import chalk from 'chalk';
7
+ import {
8
+ ChatMessage, ChatCompletionRequest, Choice, ChoiceDelta, ChatCompletionChunk
9
+ } from './models.js';
10
+ import {
11
+ initialize,
12
+ streamNotionResponse,
13
+ buildNotionRequest,
14
+ INITIALIZED_SUCCESSFULLY
15
+ } from './lightweight-client.js';
16
+ import { proxyPool } from './ProxyPool.js';
17
+ import { cookieManager } from './CookieManager.js';
18
+
19
+ // 获取当前文件的目录路径
20
+ const __filename = fileURLToPath(import.meta.url);
21
+ const __dirname = dirname(__filename);
22
+
23
+ // 加载环境变量
24
+ dotenv.config({ path: join(dirname(__dirname), '.env') });
25
+
26
+ // 日志配置
27
+ const logger = {
28
+ info: (message) => console.log(chalk.blue(`[info] ${message}`)),
29
+ error: (message) => console.error(chalk.red(`[error] ${message}`)),
30
+ warning: (message) => console.warn(chalk.yellow(`[warn] ${message}`)),
31
+ success: (message) => console.log(chalk.green(`[success] ${message}`)),
32
+ request: (method, path, status, time) => {
33
+ const statusColor = status >= 500 ? chalk.red :
34
+ status >= 400 ? chalk.yellow :
35
+ status >= 300 ? chalk.cyan :
36
+ status >= 200 ? chalk.green : chalk.white;
37
+ console.log(`${chalk.magenta(`[${method}]`)} - ${path} ${statusColor(status)} ${chalk.gray(`${time}ms`)}`);
38
+ }
39
+ };
40
+
41
+ // 认证配置
42
+ const EXPECTED_TOKEN = process.env.PROXY_AUTH_TOKEN || "default_token";
43
+
44
+ // 创建Express应用
45
+ const app = express();
46
+ app.use(express.json({ limit: '50mb' }));
47
+ app.use(express.urlencoded({ extended: true, limit: '50mb' }));
48
+
49
+ // 请求日志中间件
50
+ app.use((req, res, next) => {
51
+ const start = Date.now();
52
+
53
+ // 保存原始的 end 方法
54
+ const originalEnd = res.end;
55
+
56
+ // 重写 end 方法以记录请求完成时间
57
+ res.end = function(...args) {
58
+ const duration = Date.now() - start;
59
+ logger.request(req.method, req.path, res.statusCode, duration);
60
+ return originalEnd.apply(this, args);
61
+ };
62
+
63
+ next();
64
+ });
65
+
66
+ // 认证中间件
67
+ function authenticate(req, res, next) {
68
+ const authHeader = req.headers.authorization;
69
+
70
+ if (!authHeader || !authHeader.startsWith('Bearer ')) {
71
+ return res.status(401).json({
72
+ error: {
73
+ message: "Authentication required. Please provide a valid Bearer token.",
74
+ type: "authentication_error"
75
+ }
76
+ });
77
+ }
78
+
79
+ const token = authHeader.split(' ')[1];
80
+
81
+ if (token !== EXPECTED_TOKEN) {
82
+ return res.status(401).json({
83
+ error: {
84
+ message: "Invalid authentication credentials",
85
+ type: "authentication_error"
86
+ }
87
+ });
88
+ }
89
+
90
+ next();
91
+ }
92
+
93
+ // API路由
94
+
95
+ // 获取模型列表
96
+ app.get('/v1/models', authenticate, (req, res) => {
97
+ // 返回可用模型列表
98
+ const modelList = {
99
+ data: [
100
+ { id: "openai-gpt-4.1" },
101
+ { id: "anthropic-opus-4" },
102
+ { id: "anthropic-sonnet-4" },
103
+ { id: "anthropic-sonnet-3.x-stable" }
104
+ ]
105
+ };
106
+
107
+ res.json(modelList);
108
+ });
109
+
110
+ // 聊天完成端点
111
+ app.post('/v1/chat/completions', authenticate, async (req, res) => {
112
+ try {
113
+ // 检查是否成功初始化
114
+ if (!INITIALIZED_SUCCESSFULLY) {
115
+ return res.status(500).json({
116
+ error: {
117
+ message: "系统未成功初始化。请检查您的NOTION_COOKIE是否有效。",
118
+ type: "server_error"
119
+ }
120
+ });
121
+ }
122
+
123
+ // 检查是否有可用的cookie
124
+ if (cookieManager.getValidCount() === 0) {
125
+ return res.status(500).json({
126
+ error: {
127
+ message: "没有可用的有效cookie。请检查您的NOTION_COOKIE配置。",
128
+ type: "server_error"
129
+ }
130
+ });
131
+ }
132
+
133
+ // 验证请求数据
134
+ const requestData = req.body;
135
+
136
+ if (!requestData.messages || !Array.isArray(requestData.messages) || requestData.messages.length === 0) {
137
+ return res.status(400).json({
138
+ error: {
139
+ message: "Invalid request: 'messages' field must be a non-empty array.",
140
+ type: "invalid_request_error"
141
+ }
142
+ });
143
+ }
144
+
145
+ // 构建Notion请求
146
+ const notionRequestBody = buildNotionRequest(requestData);
147
+
148
+ // 处理流式响应
149
+ if (requestData.stream) {
150
+ res.setHeader('Content-Type', 'text/event-stream');
151
+ res.setHeader('Cache-Control', 'no-cache');
152
+ res.setHeader('Connection', 'keep-alive');
153
+
154
+ logger.info(`开始流式响应`);
155
+ const stream = await streamNotionResponse(notionRequestBody);
156
+ stream.pipe(res);
157
+
158
+ // 处理客户端断开连接
159
+ req.on('close', () => {
160
+ stream.end();
161
+ });
162
+ } else {
163
+ // 非流式响应
164
+ // 创建一个内部流来收集完整响应
165
+ logger.info(`开始非流式响应`);
166
+ const chunks = [];
167
+ const stream = await streamNotionResponse(notionRequestBody);
168
+
169
+ return new Promise((resolve, reject) => {
170
+ stream.on('data', (chunk) => {
171
+ const chunkStr = chunk.toString();
172
+ if (chunkStr.startsWith('data: ') && !chunkStr.includes('[DONE]')) {
173
+ try {
174
+ const dataJson = chunkStr.substring(6).trim();
175
+ if (dataJson) {
176
+ const chunkData = JSON.parse(dataJson);
177
+ if (chunkData.choices && chunkData.choices[0].delta && chunkData.choices[0].delta.content) {
178
+ chunks.push(chunkData.choices[0].delta.content);
179
+ }
180
+ }
181
+ } catch (error) {
182
+ logger.error(`解析非流式响应块时出错: ${error}`);
183
+ }
184
+ }
185
+ });
186
+
187
+ stream.on('end', () => {
188
+ const fullResponse = {
189
+ id: `chatcmpl-${randomUUID()}`,
190
+ object: "chat.completion",
191
+ created: Math.floor(Date.now() / 1000),
192
+ model: requestData.model,
193
+ choices: [
194
+ {
195
+ index: 0,
196
+ message: {
197
+ role: "assistant",
198
+ content: chunks.join('')
199
+ },
200
+ finish_reason: "stop"
201
+ }
202
+ ],
203
+ usage: {
204
+ prompt_tokens: null,
205
+ completion_tokens: null,
206
+ total_tokens: null
207
+ }
208
+ };
209
+
210
+ res.json(fullResponse);
211
+ resolve();
212
+ });
213
+
214
+ stream.on('error', (error) => {
215
+ logger.error(`非流式响应出错: ${error}`);
216
+ reject(error);
217
+ });
218
+ });
219
+ }
220
+ } catch (error) {
221
+ logger.error(`聊天完成端点错误: ${error}`);
222
+ res.status(500).json({
223
+ error: {
224
+ message: `Internal server error: ${error.message}`,
225
+ type: "server_error"
226
+ }
227
+ });
228
+ }
229
+ });
230
+
231
+ // 健康检查端点
232
+ app.get('/health', (req, res) => {
233
+ res.json({
234
+ status: 'ok',
235
+ timestamp: new Date().toISOString(),
236
+ initialized: INITIALIZED_SUCCESSFULLY,
237
+ valid_cookies: cookieManager.getValidCount()
238
+ });
239
+ });
240
+
241
+ // Cookie状态查询端点
242
+ app.get('/cookies/status', authenticate, (req, res) => {
243
+ res.json({
244
+ total_cookies: cookieManager.getValidCount(),
245
+ cookies: cookieManager.getStatus()
246
+ });
247
+ });
248
+
249
+ // 启动服务器
250
+ const PORT = process.env.PORT || 7860;
251
+
252
+ // 初始化并启动服务器
253
+ initialize().then(() => {
254
+ app.listen(PORT, () => {
255
+ logger.info(`服务已启动 - 端口: ${PORT}`);
256
+ logger.info(`访问地址: http://localhost:${PORT}`);
257
+
258
+ if (INITIALIZED_SUCCESSFULLY) {
259
+ logger.success(`系统初始化状态: ✅`);
260
+ logger.success(`可用cookie数量: ${cookieManager.getValidCount()}`);
261
+ } else {
262
+ logger.warning(`系统初始化状态: ❌`);
263
+ logger.warning(`警告: 系统未成功初始化,API调用将无法正常工作`);
264
+ logger.warning(`请检查NOTION_COOKIE配置是否有效`);
265
+ }
266
+ });
267
+ }).catch((error) => {
268
+ logger.error(`初始化失败: ${error}`);
269
+ });
src/lightweight-client.js ADDED
@@ -0,0 +1,758 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import fetch from 'node-fetch';
2
+ import { JSDOM } from 'jsdom';
3
+ import dotenv from 'dotenv';
4
+ import { randomUUID } from 'crypto';
5
+ import { fileURLToPath } from 'url';
6
+ import { dirname, join } from 'path';
7
+ import { PassThrough } from 'stream';
8
+ import chalk from 'chalk';
9
+ import {
10
+ NotionTranscriptConfigValue,
11
+ NotionTranscriptContextValue, NotionTranscriptItem, NotionDebugOverrides,
12
+ NotionRequestBody, ChoiceDelta, Choice, ChatCompletionChunk, NotionTranscriptItemByuser
13
+ } from './models.js';
14
+ import { proxyPool } from './ProxyPool.js';
15
+ import { proxyServer } from './ProxyServer.js';
16
+ import { cookieManager } from './CookieManager.js';
17
+
18
+ // 获取当前文件的目录路径
19
+ const __filename = fileURLToPath(import.meta.url);
20
+ const __dirname = dirname(__filename);
21
+
22
+ // 加载环境变量
23
+ dotenv.config({ path: join(dirname(__dirname), '.env') });
24
+
25
+ // 日志配置
26
+ const logger = {
27
+ info: (message) => console.log(chalk.blue(`[info] ${message}`)),
28
+ error: (message) => console.error(chalk.red(`[error] ${message}`)),
29
+ warning: (message) => console.warn(chalk.yellow(`[warn] ${message}`)),
30
+ success: (message) => console.log(chalk.green(`[success] ${message}`)),
31
+ };
32
+
33
+ // 配置
34
+ const NOTION_API_URL = "https://www.notion.so/api/v3/runInferenceTranscript";
35
+ // 这些变量将由cookieManager动态提供
36
+ let currentCookieData = null;
37
+ const USE_NATIVE_PROXY_POOL = process.env.USE_NATIVE_PROXY_POOL === 'true';
38
+ const ENABLE_PROXY_SERVER = process.env.ENABLE_PROXY_SERVER === 'true';
39
+ let proxy = null;
40
+
41
+ // 代理配置
42
+ const PROXY_URL = process.env.PROXY_URL || "";
43
+
44
+ // 标记是否成功初始化
45
+ let INITIALIZED_SUCCESSFULLY = false;
46
+
47
+ // 注册进程退出事件,确保代理服务器在程序退出时关闭
48
+ process.on('exit', () => {
49
+ try {
50
+ if (proxyServer) {
51
+ proxyServer.stop();
52
+ }
53
+ } catch (error) {
54
+ logger.error(`程序退出时关闭代理服务器出错: ${error.message}`);
55
+ }
56
+ });
57
+
58
+ // 捕获意外退出信号
59
+ ['SIGINT', 'SIGTERM', 'SIGQUIT'].forEach(signal => {
60
+ process.on(signal, () => {
61
+ logger.info(`收到${signal}信号,正在关闭代理服务器...`);
62
+ try {
63
+ if (proxyServer) {
64
+ proxyServer.stop();
65
+ }
66
+ } catch (error) {
67
+ logger.error(`关闭代理服务器出错: ${error.message}`);
68
+ }
69
+ process.exit(0);
70
+ });
71
+ });
72
+
73
+ // 构建Notion请求
74
+ function buildNotionRequest(requestData) {
75
+ // 确保我们有当前的cookie数据
76
+ if (!currentCookieData) {
77
+ currentCookieData = cookieManager.getNext();
78
+ if (!currentCookieData) {
79
+ throw new Error('没有可用的cookie');
80
+ }
81
+ }
82
+
83
+ // 当前时间
84
+ const now = new Date();
85
+ // 格式化为ISO字符串,确保包含毫秒和时区
86
+ const isoString = now.toISOString();
87
+
88
+ // 生成随机名称,类似于Python版本
89
+ const randomWords = ["Project", "Workspace", "Team", "Studio", "Lab", "Hub", "Zone", "Space"];
90
+ const userName = `User${Math.floor(Math.random() * 900) + 100}`; // 生成100-999之间的随机数
91
+ const spaceName = `${randomWords[Math.floor(Math.random() * randomWords.length)]} ${Math.floor(Math.random() * 99) + 1}`;
92
+
93
+ // 创建transcript数组
94
+ const transcript = [];
95
+
96
+ // 添加配置项
97
+ if(requestData.model === 'anthropic-sonnet-3.x-stable'){
98
+ transcript.push(new NotionTranscriptItem({
99
+ type: "config",
100
+ value: new NotionTranscriptConfigValue({
101
+ })
102
+ }));
103
+ }else{
104
+ transcript.push(new NotionTranscriptItem({
105
+ type: "config",
106
+ value: new NotionTranscriptConfigValue({
107
+ model: requestData.model
108
+ })
109
+ }));
110
+ }
111
+
112
+
113
+ // 添加上下文项
114
+ transcript.push(new NotionTranscriptItem({
115
+ type: "context",
116
+ value: new NotionTranscriptContextValue({
117
+ userId: currentCookieData.userId,
118
+ spaceId: currentCookieData.spaceId,
119
+ surface: "home_module",
120
+ timezone: "America/Los_Angeles",
121
+ userName: userName,
122
+ spaceName: spaceName,
123
+ spaceViewId: randomUUID(),
124
+ currentDatetime: isoString
125
+ })
126
+ }));
127
+
128
+ // 添加agent-integration项
129
+ transcript.push(new NotionTranscriptItem({
130
+ type: "agent-integration"
131
+ }));
132
+
133
+ // 添加消息
134
+ for (const message of requestData.messages) {
135
+ // 处理消息内容,确保格式一致
136
+ let content = message.content;
137
+
138
+ // 处理内容为数组的情况
139
+ if (Array.isArray(content)) {
140
+ let textContent = "";
141
+ for (const part of content) {
142
+ if (part && typeof part === 'object' && part.type === 'text') {
143
+ if (typeof part.text === 'string') {
144
+ textContent += part.text;
145
+ }
146
+ }
147
+ }
148
+ content = textContent || ""; // 使用提取的文本或空字符串
149
+ } else if (typeof content !== 'string') {
150
+ content = ""; // 如果不是字符串或数组,则默认为空字符串
151
+ }
152
+
153
+ if (message.role === "system") {
154
+ // 系统消息作为用户消息添加
155
+ transcript.push(new NotionTranscriptItemByuser({
156
+ type: "user",
157
+ value: [[content]],
158
+ userId: currentCookieData.userId,
159
+ createdAt: message.createdAt || isoString
160
+ }));
161
+ } else if (message.role === "user") {
162
+ // 用户消息
163
+ transcript.push(new NotionTranscriptItemByuser({
164
+ type: "user",
165
+ value: [[content]],
166
+ userId: currentCookieData.userId,
167
+ createdAt: message.createdAt || isoString
168
+ }));
169
+ } else if (message.role === "assistant") {
170
+ // 助手消息
171
+ transcript.push(new NotionTranscriptItem({
172
+ type: "markdown-chat",
173
+ value: content,
174
+ traceId: message.traceId || randomUUID(),
175
+ createdAt: message.createdAt || isoString
176
+ }));
177
+ }
178
+ }
179
+
180
+ // 创建请求体
181
+ return new NotionRequestBody({
182
+ spaceId: currentCookieData.spaceId,
183
+ transcript: transcript,
184
+ createThread: true,
185
+ traceId: randomUUID(),
186
+ debugOverrides: new NotionDebugOverrides({
187
+ cachedInferences: {},
188
+ annotationInferences: {},
189
+ emitInferences: false
190
+ }),
191
+ generateTitle: false,
192
+ saveAllThreadOperations: false
193
+ });
194
+ }
195
+
196
+ // 流式处理Notion响应
197
+ async function streamNotionResponse(notionRequestBody) {
198
+ // 确保我们有当前的cookie数据
199
+ if (!currentCookieData) {
200
+ currentCookieData = cookieManager.getNext();
201
+ if (!currentCookieData) {
202
+ throw new Error('没有可用的cookie');
203
+ }
204
+ }
205
+
206
+ // 创建流
207
+ const stream = new PassThrough();
208
+
209
+ // 添加初始数据,确保连接建立
210
+ stream.write(':\n\n'); // 发送一个空注释行,保持连接活跃
211
+
212
+ // 设置HTTP头模板
213
+ const headers = {
214
+ 'Content-Type': 'application/json',
215
+ 'accept': 'application/x-ndjson',
216
+ 'accept-language': 'en-US,en;q=0.9',
217
+ 'notion-audit-log-platform': 'web',
218
+ 'notion-client-version': '23.13.0.3686',
219
+ 'origin': 'https://www.notion.so',
220
+ 'referer': 'https://www.notion.so/chat',
221
+ 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36',
222
+ 'x-notion-active-user-header': currentCookieData.userId,
223
+ 'x-notion-space-id': currentCookieData.spaceId
224
+ };
225
+
226
+ // 设置超时处理,确保流不会无限等待
227
+ const timeoutId = setTimeout(() => {
228
+ logger.warning(`请求超时,30秒内未收到响应`);
229
+ try {
230
+ // 发送结束消息
231
+ const endChunk = new ChatCompletionChunk({
232
+ choices: [
233
+ new Choice({
234
+ delta: new ChoiceDelta({ content: "请求超时,未收到Notion响应。" }),
235
+ finish_reason: "timeout"
236
+ })
237
+ ]
238
+ });
239
+ stream.write(`data: ${JSON.stringify(endChunk)}\n\n`);
240
+ stream.write('data: [DONE]\n\n');
241
+ stream.end();
242
+ } catch (error) {
243
+ logger.error(`发送超时消息时出错: ${error}`);
244
+ stream.end();
245
+ }
246
+ }, 30000); // 30秒超时
247
+
248
+ // 启动fetch处理
249
+ fetchNotionResponse(
250
+ stream,
251
+ notionRequestBody,
252
+ headers,
253
+ NOTION_API_URL,
254
+ currentCookieData.cookie,
255
+ timeoutId
256
+ ).catch((error) => {
257
+ logger.error(`流处理出错: ${error}`);
258
+ clearTimeout(timeoutId); // 清除超时计时器
259
+
260
+ try {
261
+ // 发送错误消息
262
+ const errorChunk = new ChatCompletionChunk({
263
+ choices: [
264
+ new Choice({
265
+ delta: new ChoiceDelta({ content: `处理请求时出错: ${error.message}` }),
266
+ finish_reason: "error"
267
+ })
268
+ ]
269
+ });
270
+ stream.write(`data: ${JSON.stringify(errorChunk)}\n\n`);
271
+ stream.write('data: [DONE]\n\n');
272
+ } catch (e) {
273
+ logger.error(`发送错误消息时出错: ${e}`);
274
+ } finally {
275
+ stream.end();
276
+ }
277
+ });
278
+
279
+ return stream;
280
+ }
281
+
282
+ // 使用fetch调用Notion API并处理流式响应
283
+ async function fetchNotionResponse(chunkQueue, notionRequestBody, headers, notionApiUrl, notionCookie, timeoutId) {
284
+ let responseReceived = false;
285
+ let dom = null;
286
+
287
+ try {
288
+ // 创建JSDOM实例模拟浏览器环境
289
+ dom = new JSDOM("", {
290
+ url: "https://www.notion.so",
291
+ referrer: "https://www.notion.so/chat",
292
+ contentType: "text/html",
293
+ includeNodeLocations: true,
294
+ storageQuota: 10000000,
295
+ pretendToBeVisual: true,
296
+ userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36"
297
+ });
298
+
299
+ // 设置全局对象
300
+ const { window } = dom;
301
+
302
+ // 使用更安全的方式设置全局对象
303
+ try {
304
+ if (!global.window) {
305
+ global.window = window;
306
+ }
307
+
308
+ if (!global.document) {
309
+ global.document = window.document;
310
+ }
311
+
312
+ // 安全地设置navigator
313
+ if (!global.navigator) {
314
+ try {
315
+ Object.defineProperty(global, 'navigator', {
316
+ value: window.navigator,
317
+ writable: true,
318
+ configurable: true
319
+ });
320
+ } catch (navError) {
321
+ logger.warning(`无法设置navigator: ${navError.message},继续执行`);
322
+ // 继续执行,不会中断流程
323
+ }
324
+ }
325
+ } catch (globalError) {
326
+ logger.warning(`设置全局对象时出错: ${globalError.message}`);
327
+ }
328
+
329
+ // 设置cookie
330
+ document.cookie = notionCookie;
331
+
332
+ // 创建fetch选项
333
+ const fetchOptions = {
334
+ method: 'POST',
335
+ headers: {
336
+ ...headers,
337
+ 'user-agent': window.navigator.userAgent,
338
+ 'Cookie': notionCookie
339
+ },
340
+ body: JSON.stringify(notionRequestBody),
341
+ };
342
+
343
+ // 添加代理配置(如果有)
344
+ if (USE_NATIVE_PROXY_POOL) {
345
+ proxy = proxyPool.getProxy();
346
+ if (proxy !== null)
347
+ {
348
+ const { HttpsProxyAgent } = await import('https-proxy-agent');
349
+ fetchOptions.agent = new HttpsProxyAgent(proxy.full);
350
+ logger.info(`使用代理: ${proxy.full}`);
351
+ }
352
+ else{
353
+ logger.warning(`没有可用代理`);
354
+ }
355
+ } else if(PROXY_URL) {
356
+ const { HttpsProxyAgent } = await import('https-proxy-agent');
357
+ fetchOptions.agent = new HttpsProxyAgent(PROXY_URL);
358
+ logger.info(`使用代理: ${PROXY_URL}`);
359
+ }
360
+ let response = null;
361
+ // 发送请求
362
+ if (ENABLE_PROXY_SERVER){
363
+ response = await fetch('http://127.0.0.1:10655/proxy', {
364
+ method: 'POST',
365
+ body: JSON.stringify({
366
+ method: 'POST',
367
+ url: notionApiUrl,
368
+ headers: fetchOptions.headers,
369
+ body: fetchOptions.body,
370
+ stream:true
371
+ }),
372
+ });
373
+ }else{
374
+ response = await fetch(notionApiUrl, fetchOptions);
375
+ }
376
+
377
+ // 检查是否收到401错误(未授权)
378
+ if (response.status === 401) {
379
+ logger.error(`收到401未授权错误,cookie可能已失效`);
380
+ // 标记当前cookie为无效
381
+ cookieManager.markAsInvalid(currentCookieData.userId);
382
+ // 尝试获取下一个cookie
383
+ currentCookieData = cookieManager.getNext();
384
+
385
+ if (!currentCookieData) {
386
+ throw new Error('所有cookie均已失效,无法继续请求');
387
+ }
388
+
389
+ // 使用新cookie重新构建请求体
390
+ const newRequestBody = buildNotionRequest({
391
+ model: notionRequestBody.transcript[0]?.value?.model || '',
392
+ messages: [] // 这里应该根据实际情况重构消息
393
+ });
394
+
395
+ // 使用新cookie重试请求
396
+ return fetchNotionResponse(
397
+ chunkQueue,
398
+ newRequestBody,
399
+ {
400
+ ...headers,
401
+ 'x-notion-active-user-header': currentCookieData.userId,
402
+ 'x-notion-space-id': currentCookieData.spaceId
403
+ },
404
+ notionApiUrl,
405
+ currentCookieData.cookie,
406
+ timeoutId
407
+ );
408
+ }
409
+
410
+ if (!response.ok) {
411
+ throw new Error(`HTTP error! status: ${response.status}`);
412
+ }
413
+
414
+ // 处理流式响应
415
+ if (!response.body) {
416
+ throw new Error("Response body is null");
417
+ }
418
+
419
+ // 创建流读取器
420
+ const reader = response.body;
421
+ let buffer = '';
422
+
423
+ // 处理数据块
424
+ reader.on('data', (chunk) => {
425
+ try {
426
+ // 标记已收到响应
427
+ if (!responseReceived) {
428
+ responseReceived = true;
429
+ logger.info(`已连接Notion API`);
430
+ clearTimeout(timeoutId); // 清除超时计时器
431
+ }
432
+
433
+ // 解码数据
434
+ const text = chunk.toString('utf8');
435
+ buffer += text;
436
+
437
+ // 按行分割并处理完整的JSON对象
438
+ const lines = buffer.split('\n');
439
+ buffer = lines.pop() || ''; // 保留最后一行(可能不完整)
440
+
441
+ for (const line of lines) {
442
+ if (!line.trim()) continue;
443
+
444
+ try {
445
+ const jsonData = JSON.parse(line);
446
+
447
+ // 提取内容
448
+ if (jsonData?.type === "markdown-chat" && typeof jsonData?.value === "string") {
449
+ const content = jsonData.value;
450
+ if (!content) continue;
451
+
452
+ // 创建OpenAI格式的块
453
+ const chunk = new ChatCompletionChunk({
454
+ choices: [
455
+ new Choice({
456
+ delta: new ChoiceDelta({ content }),
457
+ finish_reason: null
458
+ })
459
+ ]
460
+ });
461
+
462
+ // 添加到队列
463
+ const dataStr = `data: ${JSON.stringify(chunk)}\n\n`;
464
+ chunkQueue.write(dataStr);
465
+ } else if (jsonData?.recordMap) {
466
+ // 忽略recordMap响应
467
+ } else {
468
+ // 忽略其他类型响应
469
+ }
470
+ } catch (jsonError) {
471
+ logger.error(`解析JSON出错: ${jsonError}`);
472
+ }
473
+ }
474
+ } catch (error) {
475
+ logger.error(`处理数据块出错: ${error}`);
476
+ }
477
+ });
478
+
479
+ // 处理流结束
480
+ reader.on('end', () => {
481
+ try {
482
+ logger.info(`响应完成`);
483
+ if (cookieManager.getValidCount() > 1){
484
+ // 尝试切换到下一个cookie
485
+ currentCookieData = cookieManager.getNext();
486
+ logger.info(`切换到下一个cookie: ${currentCookieData.userId}`);
487
+ }
488
+
489
+ // 如果没有收到任何响应,发送一个提示消息
490
+ if (!responseReceived) {
491
+ logger.warning(`未从Notion收到内容响应,请更换ip重试`);
492
+ if (USE_NATIVE_PROXY_POOL) {
493
+ proxyPool.removeProxy(proxy.ip, proxy.port);
494
+ }
495
+
496
+ const noContentChunk = new ChatCompletionChunk({
497
+ choices: [
498
+ new Choice({
499
+ delta: new ChoiceDelta({ content: "未从Notion收到内容响应,请更换ip重试。" }),
500
+ finish_reason: "no_content"
501
+ })
502
+ ]
503
+ });
504
+ chunkQueue.write(`data: ${JSON.stringify(noContentChunk)}\n\n`);
505
+ }
506
+
507
+ // 创建结束块
508
+ const endChunk = new ChatCompletionChunk({
509
+ choices: [
510
+ new Choice({
511
+ delta: new ChoiceDelta({ content: null }),
512
+ finish_reason: "stop"
513
+ })
514
+ ]
515
+ });
516
+
517
+ // 添加到队列
518
+ chunkQueue.write(`data: ${JSON.stringify(endChunk)}\n\n`);
519
+ chunkQueue.write('data: [DONE]\n\n');
520
+
521
+ // 清除超时计时器(如果尚未清除)
522
+ if (timeoutId) clearTimeout(timeoutId);
523
+
524
+ // 清理全局对象
525
+ try {
526
+ if (global.window) delete global.window;
527
+ if (global.document) delete global.document;
528
+
529
+ // 安全地删除navigator
530
+ if (global.navigator) {
531
+ try {
532
+ delete global.navigator;
533
+ } catch (navError) {
534
+ // 如果无法删除,尝试将其设置为undefined
535
+ try {
536
+ Object.defineProperty(global, 'navigator', {
537
+ value: undefined,
538
+ writable: true,
539
+ configurable: true
540
+ });
541
+ } catch (defineError) {
542
+ logger.warning(`无法清理navigator: ${defineError.message}`);
543
+ }
544
+ }
545
+ }
546
+ } catch (cleanupError) {
547
+ logger.warning(`清理全局对象时出错: ${cleanupError.message}`);
548
+ }
549
+
550
+ // 结束流
551
+ chunkQueue.end();
552
+ } catch (error) {
553
+ logger.error(`Error in stream end handler: ${error}`);
554
+ if (timeoutId) clearTimeout(timeoutId);
555
+
556
+ // 清理全局对象
557
+ try {
558
+ if (global.window) delete global.window;
559
+ if (global.document) delete global.document;
560
+
561
+ // 安全地删除navigator
562
+ if (global.navigator) {
563
+ try {
564
+ delete global.navigator;
565
+ } catch (navError) {
566
+ // 如果无法删除,尝试将其设置为undefined
567
+ try {
568
+ Object.defineProperty(global, 'navigator', {
569
+ value: undefined,
570
+ writable: true,
571
+ configurable: true
572
+ });
573
+ } catch (defineError) {
574
+ logger.warning(`无法清理navigator: ${defineError.message}`);
575
+ }
576
+ }
577
+ }
578
+ } catch (cleanupError) {
579
+ logger.warning(`清理全局对象时出错: ${cleanupError.message}`);
580
+ }
581
+
582
+ chunkQueue.end();
583
+ }
584
+ });
585
+
586
+ // 处理错误
587
+ reader.on('error', (error) => {
588
+ logger.error(`Stream error: ${error}`);
589
+ if (timeoutId) clearTimeout(timeoutId);
590
+
591
+ // 清理全局对象
592
+ try {
593
+ if (global.window) delete global.window;
594
+ if (global.document) delete global.document;
595
+
596
+ // 安全地删除navigator
597
+ if (global.navigator) {
598
+ try {
599
+ delete global.navigator;
600
+ } catch (navError) {
601
+ // 如果无法删除,尝试将其设置为undefined
602
+ try {
603
+ Object.defineProperty(global, 'navigator', {
604
+ value: undefined,
605
+ writable: true,
606
+ configurable: true
607
+ });
608
+ } catch (defineError) {
609
+ logger.warning(`无法清理navigator: ${defineError.message}`);
610
+ }
611
+ }
612
+ }
613
+ } catch (cleanupError) {
614
+ logger.warning(`清理全局对象时出错: ${cleanupError.message}`);
615
+ }
616
+
617
+ try {
618
+ const errorChunk = new ChatCompletionChunk({
619
+ choices: [
620
+ new Choice({
621
+ delta: new ChoiceDelta({ content: `流读取错误: ${error.message}` }),
622
+ finish_reason: "error"
623
+ })
624
+ ]
625
+ });
626
+ chunkQueue.write(`data: ${JSON.stringify(errorChunk)}\n\n`);
627
+ chunkQueue.write('data: [DONE]\n\n');
628
+ } catch (e) {
629
+ logger.error(`Error sending error message: ${e}`);
630
+ } finally {
631
+ chunkQueue.end();
632
+ }
633
+ });
634
+ } catch (error) {
635
+ logger.error(`Notion API请求失败: ${error}`);
636
+ // 清理全局对象
637
+ try {
638
+ if (global.window) delete global.window;
639
+ if (global.document) delete global.document;
640
+
641
+ // 安全地删除navigator
642
+ if (global.navigator) {
643
+ try {
644
+ delete global.navigator;
645
+ } catch (navError) {
646
+ // 如果无法删除,尝试将其设置为undefined
647
+ try {
648
+ Object.defineProperty(global, 'navigator', {
649
+ value: undefined,
650
+ writable: true,
651
+ configurable: true
652
+ });
653
+ } catch (defineError) {
654
+ logger.warning(`无法清理navigator: ${defineError.message}`);
655
+ }
656
+ }
657
+ }
658
+ } catch (cleanupError) {
659
+ logger.warning(`清理全局对象时出错: ${cleanupError.message}`);
660
+ }
661
+
662
+ if (timeoutId) clearTimeout(timeoutId);
663
+ if (chunkQueue) chunkQueue.end();
664
+
665
+ // 确保在错误情况下也触发流结束
666
+ try {
667
+ if (!responseReceived && chunkQueue) {
668
+ const errorChunk = new ChatCompletionChunk({
669
+ choices: [
670
+ new Choice({
671
+ delta: new ChoiceDelta({ content: `Notion API请求失败: ${error.message}` }),
672
+ finish_reason: "error"
673
+ })
674
+ ]
675
+ });
676
+ chunkQueue.write(`data: ${JSON.stringify(errorChunk)}\n\n`);
677
+ chunkQueue.write('data: [DONE]\n\n');
678
+ }
679
+ } catch (e) {
680
+ logger.error(`发送错误消息时出错: ${e}`);
681
+ }
682
+
683
+ throw error; // 重新抛出错误以便上层捕获
684
+ }
685
+ }
686
+
687
+ // 应用初始化
688
+ async function initialize() {
689
+ logger.info(`初始化Notion配置...`);
690
+
691
+ // 启动代理服务器
692
+ try {
693
+ await proxyServer.start();
694
+ } catch (error) {
695
+ logger.error(`启动代理服务器失败: ${error.message}`);
696
+ }
697
+
698
+ // 初始化cookie管理器
699
+ let initResult = false;
700
+
701
+ // 检查是否配置了cookie文件
702
+ const cookieFilePath = process.env.COOKIE_FILE;
703
+ if (cookieFilePath) {
704
+ logger.info(`检测到COOKIE_FILE配置: ${cookieFilePath}`);
705
+ initResult = await cookieManager.loadFromFile(cookieFilePath);
706
+
707
+ if (!initResult) {
708
+ logger.error(`从文件加载cookie失败,尝试使用环境变量中的NOTION_COOKIE`);
709
+ }
710
+ }
711
+
712
+ // 如果文件加载失败或未配置文件,尝试从环境变量加载
713
+ if (!initResult) {
714
+ const cookiesString = process.env.NOTION_COOKIE;
715
+ if (!cookiesString) {
716
+ logger.error(`错误: 未设置NOTION_COOKIE环境变量或COOKIE_FILE路径,应用无法正常工作`);
717
+ logger.error(`请在.env文件中设置有效的NOTION_COOKIE值或COOKIE_FILE路径`);
718
+ INITIALIZED_SUCCESSFULLY = false;
719
+ return;
720
+ }
721
+
722
+ logger.info(`正在从环境变量初始化cookie管理器...`);
723
+ initResult = await cookieManager.initialize(cookiesString);
724
+
725
+ if (!initResult) {
726
+ logger.error(`初始化cookie管理器失败,应用无法正常工作`);
727
+ INITIALIZED_SUCCESSFULLY = false;
728
+ return;
729
+ }
730
+ }
731
+
732
+ // 获取第一个可用的cookie数据
733
+ currentCookieData = cookieManager.getNext();
734
+ if (!currentCookieData) {
735
+ logger.error(`没有可用的cookie,应用无法正常工作`);
736
+ INITIALIZED_SUCCESSFULLY = false;
737
+ return;
738
+ }
739
+
740
+ logger.success(`成功初始化cookie管理器,共有 ${cookieManager.getValidCount()} 个有效cookie`);
741
+ logger.info(`当前使用的cookie对应的用户ID: ${currentCookieData.userId}`);
742
+ logger.info(`当前使用的cookie对应的空间ID: ${currentCookieData.spaceId}`);
743
+
744
+ if (process.env.USE_NATIVE_PROXY_POOL === 'true') {
745
+ logger.info(`正在初始化本地代理池...`);
746
+ await proxyPool.initialize();
747
+ }
748
+
749
+ INITIALIZED_SUCCESSFULLY = true;
750
+ }
751
+
752
+ // 导出函数
753
+ export {
754
+ initialize,
755
+ streamNotionResponse,
756
+ buildNotionRequest,
757
+ INITIALIZED_SUCCESSFULLY
758
+ };
src/models.js ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { randomUUID } from 'crypto';
2
+
3
+ // 输入模型 (OpenAI-like)
4
+ export class ChatMessage {
5
+ constructor({
6
+ id = generateCustomId(),
7
+ role,
8
+ content,
9
+ userId = null,
10
+ createdAt = null,
11
+ traceId = null
12
+ }) {
13
+ this.id = id;
14
+ this.role = role; // "system", "user", "assistant"
15
+ this.content = content;
16
+ this.userId = userId;
17
+ this.createdAt = createdAt;
18
+ this.traceId = traceId;
19
+ }
20
+ }
21
+
22
+ export class ChatCompletionRequest {
23
+ constructor({
24
+ messages,
25
+ model = "notion-proxy",
26
+ stream = false,
27
+ notion_model = "anthropic-opus-4"
28
+ }) {
29
+ this.messages = messages;
30
+ this.model = model;
31
+ this.stream = stream;
32
+ this.notion_model = notion_model;
33
+ }
34
+ }
35
+
36
+ // Notion 模型
37
+ export class NotionTranscriptConfigValue {
38
+ constructor({
39
+ type = "markdown-chat",
40
+ model
41
+ }) {
42
+ this.type = type;
43
+ this.model = model;
44
+ }
45
+ }
46
+
47
+
48
+ export class NotionTranscriptContextValue {
49
+ constructor({
50
+ userId,
51
+ spaceId,
52
+ surface = "home_module",
53
+ timezone = "America/Los_Angeles",
54
+ userName,
55
+ spaceName,
56
+ spaceViewId,
57
+ currentDatetime
58
+ }) {
59
+ this.userId = userId;
60
+ this.spaceId = spaceId;
61
+ this.surface = surface;
62
+ this.timezone = timezone;
63
+ this.userName = userName;
64
+ this.spaceName = spaceName;
65
+ this.spaceViewId = spaceViewId;
66
+ this.currentDatetime = currentDatetime;
67
+ }
68
+ }
69
+
70
+ export class NotionTranscriptItem {
71
+ constructor({
72
+ id = generateCustomId(),
73
+ type,
74
+ value = null,
75
+
76
+ }) {
77
+ this.id = id;
78
+ this.type = type; // "markdown-chat", "agent-integration", "context"
79
+ this.value = value;
80
+ }
81
+ }
82
+
83
+ export class NotionTranscriptItemByuser {
84
+ constructor({
85
+ id = generateCustomId(),
86
+ type,
87
+ value = null,
88
+ userId,
89
+ createdAt
90
+
91
+ }) {
92
+ this.id = id;
93
+ this.type = type; // "config", "user"
94
+ this.value = value;
95
+ this.userId = userId;
96
+ this.createdAt = createdAt;
97
+ }
98
+ }
99
+
100
+ export class NotionDebugOverrides {
101
+ constructor({
102
+ cachedInferences = {},
103
+ annotationInferences = {},
104
+ emitInferences = false
105
+ }) {
106
+ this.cachedInferences = cachedInferences;
107
+ this.annotationInferences = annotationInferences;
108
+ this.emitInferences = emitInferences;
109
+ }
110
+ }
111
+
112
+ export function generateCustomId() {
113
+ // 创建固定部分
114
+ const prefix1 = '2036702a';
115
+ const prefix2 = '4d19';
116
+ const prefix5 = '00aa';
117
+
118
+ // 生成随机十六进制字符
119
+ function randomHex(length) {
120
+ return Array(length).fill(0).map(() =>
121
+ Math.floor(Math.random() * 16).toString(16)
122
+ ).join('');
123
+ }
124
+
125
+ // 组合所有部分
126
+ const part3 = '80' + randomHex(2); // 8xxx
127
+ const part4 = randomHex(4); // xxxx
128
+ const part5 = prefix5 + randomHex(8); // 00aaxxxxxxxx
129
+
130
+ return `${prefix1}-${prefix2}-${part3}-${part4}-${part5}`;
131
+ }
132
+
133
+ export class NotionRequestBody {
134
+ constructor({
135
+ traceId = randomUUID(),
136
+ spaceId,
137
+ transcript,
138
+ createThread = false,
139
+ debugOverrides = new NotionDebugOverrides({}),
140
+ generateTitle = true,
141
+ saveAllThreadOperations = true,
142
+ }) {
143
+ this.traceId = traceId;
144
+ this.spaceId = spaceId;
145
+ this.transcript = transcript;
146
+ this.createThread = createThread;
147
+ this.debugOverrides = debugOverrides;
148
+ this.generateTitle = generateTitle;
149
+ this.saveAllThreadOperations = saveAllThreadOperations;
150
+ }
151
+ }
152
+
153
+ // 输出模型 (OpenAI SSE)
154
+ export class ChoiceDelta {
155
+ constructor({
156
+ content = null
157
+ }) {
158
+ this.content = content;
159
+ }
160
+ }
161
+
162
+ export class Choice {
163
+ constructor({
164
+ index = 0,
165
+ delta,
166
+ finish_reason = null
167
+ }) {
168
+ this.index = index;
169
+ this.delta = delta;
170
+ this.finish_reason = finish_reason;
171
+ }
172
+ }
173
+
174
+ export class ChatCompletionChunk {
175
+ constructor({
176
+ id = `chatcmpl-${randomUUID()}`,
177
+ object = "chat.completion.chunk",
178
+ created = Math.floor(Date.now() / 1000),
179
+ model = "notion-proxy",
180
+ choices
181
+ }) {
182
+ this.id = id;
183
+ this.object = object;
184
+ this.created = created;
185
+ this.model = model;
186
+ this.choices = choices;
187
+ }
188
+ }
189
+
190
+ // 模型列表端点 /v1/models
191
+ export class Model {
192
+ constructor({
193
+ id,
194
+ object = "model",
195
+ created = Math.floor(Date.now() / 1000),
196
+ owned_by = "notion"
197
+ }) {
198
+ this.id = id;
199
+ this.object = object;
200
+ this.created = created;
201
+ this.owned_by = owned_by;
202
+ }
203
+ }
204
+
205
+ export class ModelList {
206
+ constructor({
207
+ object = "list",
208
+ data
209
+ }) {
210
+ this.object = object;
211
+ this.data = data;
212
+ }
213
+ }
src/proxy/chrome_proxy_server_android_arm64 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f4855fc6df77b627a346d0a52beb158e0f6b35ab035bb72f80f7e0f090eb13e7
3
+ size 12777353
src/proxy/chrome_proxy_server_linux_amd64 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cfb52ae72313bbfaf22c430b7c180456fbb59ce2a84f8738a63cb7e3be0a8691
3
+ size 12762272
src/proxy/chrome_proxy_server_windows_amd64.exe ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:530200aa125db2ef7bc39bb852d0a41acf538757c29585ec7bde0530f1a31629
3
+ size 12875776