onebots 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 未在进程启动时通过 -r 加载的适配器,其 registerSchema 不会执行,
3
+ * Web 管理端拉取 /api/config/schema 时 adapters 会缺项,导致无法选平台、无表单项。
4
+ * 此处预设与各适配器 index.ts 中 registerSchema 保持一致(变更时请同步修改)。
5
+ */
6
+ import type { Schema } from "@onebots/core";
7
+ export declare const ADAPTER_SCHEMA_PRESETS: Record<string, Schema>;
8
+ //# sourceMappingURL=adapter-schema-presets.d.ts.map
@@ -0,0 +1,118 @@
1
+ export const ADAPTER_SCHEMA_PRESETS = {
2
+ "wecom-kf": {
3
+ account_id: { type: "string", required: true, label: "账号标识" },
4
+ corp_id: { type: "string", required: true, label: "企业 ID" },
5
+ corp_secret: { type: "string", required: true, label: "自建应用 Secret(已授权微信客服 API)" },
6
+ token: { type: "string", required: true, label: "回调 Token" },
7
+ encoding_aes_key: { type: "string", required: true, label: "EncodingAESKey" },
8
+ open_kfid: { type: "string", label: "默认客服 open_kfid" },
9
+ agent_id: { type: "string", label: "应用 AgentId(上传临时素材时必填)" },
10
+ enable_sync_poll: { type: "boolean", label: "启用无 token 轮询 sync_msg(易触发频次限制)" },
11
+ sync_poll_interval_ms: { type: "number", label: "轮询间隔(毫秒)" },
12
+ cursor_store_path: { type: "string", label: "sync_msg 游标 JSON 文件路径" },
13
+ },
14
+ icqq: {
15
+ account_id: { type: "string", required: true, label: "QQ 号" },
16
+ password: { type: "string", label: "密码(可选/支持扫码)" },
17
+ protocol: {
18
+ platform: { type: "number", enum: [1, 2, 3, 4, 5, 6], default: 2, label: "登录平台" },
19
+ ver: { type: "string", label: "APK 版本" },
20
+ sign_api_addr: { type: "string", label: "签名服务器地址" },
21
+ data_dir: { type: "string", label: "数据目录" },
22
+ log_config: { type: "object", label: "log4js 配置" },
23
+ ignore_self: { type: "boolean", default: true, label: "过滤自己消息" },
24
+ resend: { type: "boolean", default: true, label: "风控分片发送" },
25
+ reconn_interval: { type: "number", default: 5, label: "重连间隔(秒)" },
26
+ cache_group_member: { type: "boolean", default: true, label: "缓存群员列表" },
27
+ auto_server: { type: "boolean", default: true, label: "自动选择服务器" },
28
+ ffmpeg_path: { type: "string", label: "ffmpeg 路径" },
29
+ ffprobe_path: { type: "string", label: "ffprobe 路径" },
30
+ },
31
+ },
32
+ line: {
33
+ account_id: { type: "string", required: true, label: "账号标识" },
34
+ channel_access_token: { type: "string", required: true, label: "Channel Access Token" },
35
+ channel_secret: { type: "string", required: true, label: "Channel Secret" },
36
+ proxy: {
37
+ url: { type: "string", label: "代理地址" },
38
+ username: { type: "string", label: "代理用户名" },
39
+ password: { type: "string", label: "代理密码" },
40
+ },
41
+ },
42
+ email: {
43
+ account_id: { type: "string", required: true, label: "账号标识" },
44
+ from: { type: "string", required: true, label: "发件人邮箱" },
45
+ fromName: { type: "string", label: "发件人名称" },
46
+ smtp: {
47
+ host: { type: "string", required: true, label: "SMTP 主机" },
48
+ port: { type: "number", default: 587, label: "SMTP 端口" },
49
+ secure: { type: "boolean", default: true, label: "TLS" },
50
+ requireTLS: { type: "boolean", default: true, label: "STARTTLS" },
51
+ user: { type: "string", required: true, label: "SMTP 用户名" },
52
+ password: { type: "string", required: true, label: "SMTP 密码" },
53
+ proxy: {
54
+ url: { type: "string", label: "代理地址" },
55
+ username: { type: "string", label: "代理用户名" },
56
+ password: { type: "string", label: "代理密码" },
57
+ },
58
+ },
59
+ imap: {
60
+ host: { type: "string", required: true, label: "IMAP 主机" },
61
+ port: { type: "number", default: 993, label: "IMAP 端口" },
62
+ tls: { type: "boolean", default: true, label: "TLS" },
63
+ user: { type: "string", required: true, label: "IMAP 用户名" },
64
+ password: { type: "string", required: true, label: "IMAP 密码" },
65
+ proxy: {
66
+ url: { type: "string", label: "代理地址" },
67
+ username: { type: "string", label: "代理用户名" },
68
+ password: { type: "string", label: "代理密码" },
69
+ },
70
+ pollInterval: { type: "number", default: 30000, label: "轮询间隔(毫秒)" },
71
+ mailbox: { type: "string", default: "INBOX", label: "邮箱文件夹" },
72
+ },
73
+ },
74
+ whatsapp: {
75
+ account_id: { type: "string", required: true, label: "账号标识" },
76
+ businessAccountId: { type: "string", required: true, label: "Business Account ID" },
77
+ phoneNumberId: { type: "string", required: true, label: "Phone Number ID" },
78
+ accessToken: { type: "string", required: true, label: "Access Token" },
79
+ webhookVerifyToken: { type: "string", required: true, label: "Webhook 验证令牌" },
80
+ apiVersion: { type: "string", default: "v21.0", label: "API 版本" },
81
+ proxy: {
82
+ url: { type: "string", label: "代理地址" },
83
+ username: { type: "string", label: "代理用户名" },
84
+ password: { type: "string", label: "代理密码" },
85
+ },
86
+ webhook: {
87
+ url: { type: "string", label: "Webhook URL" },
88
+ fields: { type: "array", label: "订阅字段" },
89
+ },
90
+ },
91
+ zulip: {
92
+ account_id: { type: "string", required: true, label: "账号标识" },
93
+ serverUrl: { type: "string", required: true, label: "服务器地址" },
94
+ email: { type: "string", required: true, label: "邮箱地址" },
95
+ apiKey: { type: "string", required: true, label: "API Key" },
96
+ proxy: {
97
+ url: { type: "string", label: "代理地址" },
98
+ username: { type: "string", label: "代理用户名" },
99
+ password: { type: "string", label: "代理密码" },
100
+ },
101
+ websocket: {
102
+ enabled: { type: "boolean", default: true, label: "启用 WebSocket" },
103
+ reconnectInterval: { type: "number", default: 3000, label: "重连间隔(毫秒)" },
104
+ maxReconnectAttempts: { type: "number", default: 10, label: "最大重连次数" },
105
+ },
106
+ },
107
+ mock: {
108
+ account_id: { type: "string", required: true, label: "账号标识" },
109
+ nickname: { type: "string", label: "用户名" },
110
+ avatar: { type: "string", label: "头像 URL" },
111
+ auto_events: { type: "boolean", label: "自动生成事件" },
112
+ event_interval: { type: "number", label: "事件间隔(毫秒)" },
113
+ latency: { type: "number", label: "模拟延迟(毫秒)" },
114
+ friends: { type: "array", label: "预定义好友列表" },
115
+ groups: { type: "array", label: "预定义群组列表" },
116
+ },
117
+ };
118
+ //# sourceMappingURL=adapter-schema-presets.js.map
@@ -1,4 +1,5 @@
1
1
  import { BaseAppConfigSchema, AdapterRegistry, ProtocolRegistry } from '@onebots/core';
2
+ import { ADAPTER_SCHEMA_PRESETS } from './adapter-schema-presets.js';
2
3
  /**
3
4
  * App 层配置 Schema(可在此扩展)
4
5
  */
@@ -65,7 +66,9 @@ export const getAppConfigSchema = () => {
65
66
  ...general,
66
67
  ...ProtocolRegistry.getAllSchemas(),
67
68
  };
69
+ // 预设补全未 -r 加载的适配器 schema,供 Web 配置页使用;已加载时以 Registry 为准(覆盖预设)
68
70
  const adapters = {
71
+ ...ADAPTER_SCHEMA_PRESETS,
69
72
  ...AdapterRegistry.getAllSchemas(),
70
73
  };
71
74
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onebots",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "OneBots 整合适配器和协议,提供HTTP/WebSocket服务",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -43,7 +43,7 @@
43
43
  "commander": "^14.0.3",
44
44
  "koa-static": "^5.0.0",
45
45
  "@onebots/core": "1.0.4",
46
- "@onebots/web": "1.0.4"
46
+ "@onebots/web": "1.0.5"
47
47
  },
48
48
  "repository": {
49
49
  "type": "git",