Skip to content
This repository was archived by the owner on Aug 2, 2020. It is now read-only.

Commit 16bad5f

Browse files
committed
Add config schema
1 parent 4a8ba9c commit 16bad5f

File tree

1 file changed

+354
-0
lines changed

1 file changed

+354
-0
lines changed

config-schema.json

Lines changed: 354 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,354 @@
1+
{
2+
"definitions": {},
3+
"$schema": "",
4+
"$id": "https://cqhttp.cc/config-schema.json",
5+
"type": "object",
6+
"title": "CQHTTP 配置",
7+
"properties": {
8+
"host": {
9+
"$id": "#/properties/host",
10+
"type": "string",
11+
"title": "HTTP 服务器 IP",
12+
"description": "HTTP 服务器监听的 IP",
13+
"default": "[::]",
14+
"examples": [
15+
"127.0.0.1",
16+
"0.0.0.0"
17+
],
18+
"pattern": "^(.*)$"
19+
},
20+
"port": {
21+
"$id": "#/properties/port",
22+
"type": "integer",
23+
"title": "HTTP 服务器端口",
24+
"description": "HTTP 服务器监听的端口",
25+
"default": 5700
26+
},
27+
"use_http": {
28+
"$id": "#/properties/use_http",
29+
"type": "boolean",
30+
"title": "使用 HTTP 接口",
31+
"description": "是否开启 HTTP 接口,即通过 HTTP 调用 API",
32+
"default": true
33+
},
34+
"ws_host": {
35+
"$id": "#/properties/ws_host",
36+
"type": "string",
37+
"title": "WebSocket 服务器 IP",
38+
"description": "WebSocket 服务器监听的 IP",
39+
"default": "[::]",
40+
"examples": [
41+
"127.0.0.1",
42+
"0.0.0.0"
43+
],
44+
"pattern": "^(.*)$"
45+
},
46+
"ws_port": {
47+
"$id": "#/properties/ws_port",
48+
"type": "integer",
49+
"title": "WebSocket 服务器端口",
50+
"description": "WebSocket 服务器监听的端口",
51+
"default": 6700
52+
},
53+
"use_ws": {
54+
"$id": "#/properties/use_ws",
55+
"type": "boolean",
56+
"title": "使用 WebSocket 服务器",
57+
"description": "是否开启 WebSocket 服务器,可用于调用 API 和推送事件",
58+
"default": false
59+
},
60+
"ws_reverse_url": {
61+
"$id": "#/properties/ws_reverse_url",
62+
"type": "string",
63+
"title": "反向 WebSocket URL",
64+
"description": "反向 WebSocket Event 和事件上报的共用地址",
65+
"default": "",
66+
"examples": [
67+
"ws://127.0.0.1:8080/ws/"
68+
],
69+
"pattern": "^([wW][sS][sS]?:\\/\\/(.*))?$"
70+
},
71+
"ws_reverse_api_url": {
72+
"$id": "#/properties/ws_reverse_api_url",
73+
"type": "string",
74+
"title": "反向 WebSocket API URL",
75+
"description": "反向 WebSocket API 地址,如果为空,则使用 ws_reverse_url 指定的值",
76+
"default": "",
77+
"examples": [
78+
"ws://127.0.0.1:8080/ws/api/"
79+
],
80+
"pattern": "^([wW][sS][sS]?:\\/\\/(.*))?$"
81+
},
82+
"ws_reverse_event_url": {
83+
"$id": "#/properties/ws_reverse_event_url",
84+
"type": "string",
85+
"title": "反向 WebSocket 事件 URL",
86+
"description": "反向 WebSocket 事件上报地址,如果为空,则使用 ws_reverse_url 指定的值",
87+
"default": "",
88+
"examples": [
89+
"ws://127.0.0.1:8080/ws/event/"
90+
],
91+
"pattern": "^([wW][sS][sS]?:\\/\\/(.*))?$"
92+
},
93+
"ws_reverse_reconnect_interval": {
94+
"$id": "#/properties/ws_reverse_reconnect_interval",
95+
"type": "integer",
96+
"title": "反向 WebSocket 重连间隔",
97+
"description": "反向 WebSocket 客户端断线重连间隔,单位毫秒",
98+
"default": 3000
99+
},
100+
"ws_reverse_reconnect_on_code_1000": {
101+
"$id": "#/properties/ws_reverse_reconnect_on_code_1000",
102+
"type": "boolean",
103+
"title": "反向 WebSocket 在 1000 关闭码时重连",
104+
"description": "是否在关闭状态码为 1000 的时候重连",
105+
"default": true
106+
},
107+
"ws_reverse_use_universal_client": {
108+
"$id": "#/properties/ws_reverse_use_universal_client",
109+
"type": "boolean",
110+
"title": "反向 WebSocket 使用 Universal 客户端",
111+
"description": "是否使用 Universal 客户端(使用单个连接传输事件数据和 API 请求)",
112+
"default": false
113+
},
114+
"use_ws_reverse": {
115+
"$id": "#/properties/use_ws_reverse",
116+
"type": "boolean",
117+
"title": "使用反向 WebSocket 服务",
118+
"description": "是否使用反向 WebSocket 服务,即插件作为 WebSocket 客户端主动连接指定的 API 和事件上报地址",
119+
"default": false
120+
},
121+
"post_url": {
122+
"$id": "#/properties/post_url",
123+
"type": "string",
124+
"title": "HTTP 上报 URL",
125+
"description": "消息和事件的上报地址,通过 POST 方式请求,数据以 JSON 格式发送",
126+
"default": "",
127+
"examples": [
128+
"http://127.0.0.1:8080/"
129+
],
130+
"pattern": "^([hH][tT][tT][pP][sS]?:\\/\\/(.*))?$"
131+
},
132+
"post_timeout": {
133+
"$id": "#/properties/post_timeout",
134+
"type": "integer",
135+
"title": "HTTP 上报超时",
136+
"description": "HTTP 上报(即访问 post_url)的超时时间,单位秒,0 表示不设置超时",
137+
"default": 0,
138+
"examples": [
139+
20
140+
]
141+
},
142+
"access_token": {
143+
"$id": "#/properties/access_token",
144+
"type": "string",
145+
"title": "API 访问 token",
146+
"description": "API 访问 token,如果不为空,则会在接收到请求时验证 Authorization 请求头是否为 Bearer xxxxxxxx,xxxxxxxx 为 access token",
147+
"default": "",
148+
"pattern": "^(.*)$"
149+
},
150+
"secret": {
151+
"$id": "#/properties/secret",
152+
"type": "string",
153+
"title": "上报数据签名密钥",
154+
"description": "上报数据签名密钥,如果不为空,则会在 HTTP 上报时对 HTTP 正文进行 HMAC SHA1 哈希,使用 secret 的值作为密钥,计算出的哈希值放在上报的 X-Signature 请求头,例如 X-Signature: sha1=f9ddd4863ace61e64f462d41ca311e3d2c1176e2",
155+
"default": "",
156+
"pattern": "^(.*)$"
157+
},
158+
"post_message_format": {
159+
"$id": "#/properties/post_message_format",
160+
"type": "string",
161+
"title": "上报消息格式",
162+
"default": "string",
163+
"examples": [
164+
"string",
165+
"array"
166+
],
167+
"pattern": "^(string|array)$"
168+
},
169+
"serve_data_files": {
170+
"$id": "#/properties/serve_data_files",
171+
"type": "boolean",
172+
"title": "提供请求 data 目录的文件的功能",
173+
"description": "是否提供请求 data 目录的文件的功能",
174+
"default": false
175+
},
176+
"enable_cors": {
177+
"$id": "#/properties/enable_cors",
178+
"type": "boolean",
179+
"title": "允许跨域请求",
180+
"description": "是否允许跨域请求",
181+
"default": false
182+
},
183+
"update_source": {
184+
"$id": "#/properties/update_source",
185+
"type": "string",
186+
"title": "更新源",
187+
"description": "更新源,可选 global/github 和 china/coding",
188+
"default": "china",
189+
"examples": [
190+
"global",
191+
"github",
192+
"china",
193+
"coding"
194+
],
195+
"pattern": "^(.*)$"
196+
},
197+
"update_channel": {
198+
"$id": "#/properties/update_channel",
199+
"type": "string",
200+
"title": "更新通道",
201+
"description": "更新通道,目前有 stable、beta、alpha 三个",
202+
"default": "stable",
203+
"examples": [
204+
"stable",
205+
"beta",
206+
"alpha"
207+
],
208+
"pattern": "^(stable|beta|alpha)$"
209+
},
210+
"auto_check_update": {
211+
"$id": "#/properties/auto_check_update",
212+
"type": "boolean",
213+
"title": "自动检查更新",
214+
"description": "是否自动检查更新(每次启用插件时检查),不启用的情况下,仍然可以在 酷Q 应用菜单中手动检查更新",
215+
"default": false
216+
},
217+
"auto_perform_update": {
218+
"$id": "#/properties/auto_perform_update",
219+
"type": "boolean",
220+
"title": "自动执行更新",
221+
"description": "是否自动执行更新,仅在 auto_check_update 启用时有效,若启用,则插件将在自动检查到更新后,自动下载新版本(需要手动重启 酷Q 以生效)",
222+
"default": false
223+
},
224+
"thread_pool_size": {
225+
"$id": "#/properties/thread_pool_size",
226+
"type": "integer",
227+
"title": "工作线程池大小",
228+
"description": "工作线程池大小,用于异步 API 调用、反向 WebSocket API 调用和一些其它小的异步任务,应根据计算机性能和实际需求适当调节,若设为 0,则使用 CPU 核心数 * 2 + 1",
229+
"default": 4
230+
},
231+
"server_thread_pool_size": {
232+
"$id": "#/properties/server_thread_pool_size",
233+
"type": "integer",
234+
"title": "API 服务器线程池大小",
235+
"description": "API 服务器线程池大小,用于异步处理请求(HTTP 和 WebSocket),应根据计算机性能和实际需求适当调节,若设为 0,则使用 CPU 核心数 * 2 + 1",
236+
"default": 4
237+
},
238+
"convert_unicode_emoji": {
239+
"$id": "#/properties/convert_unicode_emoji",
240+
"type": "boolean",
241+
"title": "在 CQ:emoji 和实际的 Unicode 之间进行转换",
242+
"description": "是否在 CQ:emoji 和实际的 Unicode 之间进行转换,转换可能耗更多时间,但日常情况下影响不大,如果你的机器人需要处理非常大段的消息(上千字),且对性能有要求,可以考虑关闭转换",
243+
"default": true
244+
},
245+
"event_filter": {
246+
"$id": "#/properties/event_filter",
247+
"type": "string",
248+
"title": "事件过滤规则文件",
249+
"description": "指定事件过滤规则文件,见 事件过滤器,留空将不开启事件过滤器",
250+
"default": "",
251+
"examples": [
252+
"filter.json"
253+
],
254+
"pattern": "^(.*)$"
255+
},
256+
"enable_backward_compatibility": {
257+
"$id": "#/properties/enable_backward_compatibility",
258+
"type": "boolean",
259+
"title": "启用旧版兼容性",
260+
"description": "是否启用旧版兼容性,启用时事件上报的数据将和 3.x 版本保持兼容",
261+
"default": false
262+
},
263+
"show_log_console": {
264+
"$id": "#/properties/show_log_console",
265+
"type": "boolean",
266+
"title": "显示日志输出控制台",
267+
"description": "是否显示日志输出控制台",
268+
"default": true
269+
},
270+
"max_log_file_size": {
271+
"$id": "#/properties/max_log_file_size",
272+
"type": "integer",
273+
"title": "最大单日志文件大小",
274+
"description": "最大单日志文件大小,单位字节,默认 6 MB",
275+
"default": 6291456
276+
},
277+
"max_log_files": {
278+
"$id": "#/properties/max_log_files",
279+
"type": "integer",
280+
"title": "最大日志文件备份数量",
281+
"description": "最大日志文件备份数量(采用日志轮替机制)",
282+
"default": 1
283+
},
284+
"log_level": {
285+
"$id": "#/properties/log_level",
286+
"type": "string",
287+
"title": "日志等级",
288+
"description": "日志文件和日志控制台的日志等级,可选 debug、info、warning、error、fatal",
289+
"default": "",
290+
"examples": [
291+
"debug",
292+
"info",
293+
"warning",
294+
"error",
295+
"fatal"
296+
],
297+
"pattern": "^(debug|info|warning|error|fatal)$"
298+
},
299+
"use_extension": {
300+
"$id": "#/properties/use_extension",
301+
"type": "boolean",
302+
"title": "启用扩展机制",
303+
"description": "是否启用扩展机制",
304+
"default": false
305+
},
306+
"disable_coolq_log": {
307+
"$id": "#/properties/disable_coolq_log",
308+
"type": "boolean",
309+
"title": "禁用 酷Q 原生日志",
310+
"description": "是否禁用 酷Q 原生日志,由于使用 酷Q 原生日志可能会导致快速重启时插件卡死,所以默认禁用,如果你不在乎重启时卡死,并且需要在 酷Q 原生日志窗口查看插件的日志,可以将此项设为 false",
311+
"default": true
312+
},
313+
"online_status_detection_method": {
314+
"$id": "#/properties/online_status_detection_method",
315+
"type": "string",
316+
"title": "QQ 在线状态检测方式",
317+
"description": "QQ 在线状态检测方式,默认(get_stranger_info)通过陌生人查询接口判断,设为 log_db 可切换成从 酷Q 的日志数据库判断,具体区别见 其 API 说明",
318+
"default": "get_stranger_info",
319+
"examples": [
320+
"get_stranger_info",
321+
"log_db"
322+
],
323+
"pattern": "^(get_stranger_info|log_db)$"
324+
},
325+
"enable_heartbeat": {
326+
"$id": "#/properties/enable_heartbeat",
327+
"type": "boolean",
328+
"title": "启用心跳机制",
329+
"description": "是否启用心跳机制,启用时会产生类型为 heartbeat 的元事件",
330+
"default": false
331+
},
332+
"heartbeat_interval": {
333+
"$id": "#/properties/heartbeat_interval",
334+
"type": "integer",
335+
"title": "产生心跳元事件的间隔",
336+
"description": "产生心跳元事件的时间间隔,单位毫秒",
337+
"default": 15000
338+
},
339+
"enable_rate_limited_actions": {
340+
"$id": "#/properties/enable_rate_limited_actions",
341+
"type": "boolean",
342+
"title": "启用限速 API 调用的支持",
343+
"description": "是否启用限速 API 调用的支持",
344+
"default": false
345+
},
346+
"rate_limit_interval": {
347+
"$id": "#/properties/rate_limit_interval",
348+
"type": "integer",
349+
"title": "限速 API 调用的排队间隔",
350+
"description": "限速 API 调用的排队间隔时间,单位毫秒",
351+
"default": 500
352+
}
353+
}
354+
}

0 commit comments

Comments
 (0)