@zhin.js/adapter-icqq 5.0.1 → 6.0.0
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.
- package/CHANGELOG.md +21 -0
- package/README.md +30 -2
- package/client/LoginAssistPanel.tsx +38 -3
- package/dist/index.js +2 -2
- package/lib/adapter.d.ts +1 -0
- package/lib/adapter.d.ts.map +1 -1
- package/lib/adapter.js +2 -1
- package/lib/adapter.js.map +1 -1
- package/lib/endpoint.d.ts.map +1 -1
- package/lib/endpoint.js +28 -6
- package/lib/endpoint.js.map +1 -1
- package/lib/icqq-inbound.d.ts +7 -0
- package/lib/icqq-inbound.d.ts.map +1 -1
- package/lib/icqq-inbound.js +24 -1
- package/lib/icqq-inbound.js.map +1 -1
- package/lib/icqq-login-assist-bridge.d.ts +5 -0
- package/lib/icqq-login-assist-bridge.d.ts.map +1 -0
- package/lib/icqq-login-assist-bridge.js +148 -0
- package/lib/icqq-login-assist-bridge.js.map +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/login-assist-routes.d.ts +7 -0
- package/lib/login-assist-routes.d.ts.map +1 -0
- package/lib/login-assist-routes.js +29 -0
- package/lib/login-assist-routes.js.map +1 -0
- package/lib/login-ipc-contract.d.ts +44 -0
- package/lib/login-ipc-contract.d.ts.map +1 -0
- package/lib/login-ipc-contract.js +35 -0
- package/lib/login-ipc-contract.js.map +1 -0
- package/lib/protocol.d.ts +32 -1
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +23 -0
- package/lib/protocol.js.map +1 -1
- package/lib/typing-indicator.d.ts.map +1 -1
- package/lib/typing-indicator.js +4 -0
- package/lib/typing-indicator.js.map +1 -1
- package/package.json +13 -13
- package/src/adapter.ts +2 -1
- package/src/endpoint.ts +35 -6
- package/src/icqq-inbound.ts +36 -2
- package/src/icqq-login-assist-bridge.ts +196 -0
- package/src/index.ts +2 -0
- package/src/login-assist-routes.ts +39 -0
- package/src/login-ipc-contract.ts +52 -0
- package/src/protocol.ts +32 -1
- package/src/typing-indicator.ts +4 -0
package/src/protocol.ts
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* CLI 与守护进程通过 Unix Domain Socket 通信,
|
|
5
5
|
* 使用 JSON + 换行符(\n)分隔的文本协议。
|
|
6
|
+
*
|
|
7
|
+
* 通信流程(@icqqjs/cli `src/daemon/protocol.ts`):
|
|
8
|
+
* 1. CLI 连接 Socket → auth(token)
|
|
9
|
+
* 2. 认证通过后发送 IpcRequest → 等待 IpcResponse
|
|
10
|
+
* 3. 认证通过后自动接收 icqq 事件推送(IpcEvent),断开连接自动停止
|
|
11
|
+
*
|
|
12
|
+
* 登录相关:**推送**走 IpcEvent(`system.login.*`),续传 invoke 见 `login-ipc-contract.ts`。
|
|
6
13
|
*/
|
|
7
14
|
|
|
8
15
|
/** CLI → Daemon 请求 */
|
|
@@ -20,10 +27,18 @@ export type IpcResponse = {
|
|
|
20
27
|
error?: string;
|
|
21
28
|
};
|
|
22
29
|
|
|
23
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Daemon → CLI 事件推送(icqq client.em 分发的全部事件)
|
|
32
|
+
*
|
|
33
|
+
* 登录/重连时推送 `system.login.*`(如 `system.login.auth` 含 url + device),
|
|
34
|
+
* 语义在 `event` 字段,不在 OneBot 式 `post_type` 里。
|
|
35
|
+
*/
|
|
24
36
|
export type IpcEvent = {
|
|
37
|
+
/** 固定为 `"*"`,客户端应忽略,由本地 handler 按 `event` 过滤 */
|
|
25
38
|
id: string;
|
|
39
|
+
/** icqq 事件名,如 `system.login.auth`、`message.group.normal` */
|
|
26
40
|
event: string;
|
|
41
|
+
/** icqq 事件 toJSON 后的 plain object */
|
|
27
42
|
data: unknown;
|
|
28
43
|
};
|
|
29
44
|
|
|
@@ -53,6 +68,7 @@ export interface IpcGuildMessageEventData {
|
|
|
53
68
|
*/
|
|
54
69
|
export const Actions = {
|
|
55
70
|
PING: "ping",
|
|
71
|
+
LOGOUT: "logout",
|
|
56
72
|
|
|
57
73
|
// ── 列表查询 ──
|
|
58
74
|
LIST_FRIENDS: "list_friends",
|
|
@@ -66,7 +82,10 @@ export const Actions = {
|
|
|
66
82
|
GET_GROUP_INFO: "get_group_info",
|
|
67
83
|
GET_GROUP_MEMBER_INFO: "get_group_member_info",
|
|
68
84
|
GET_STRANGER_INFO: "get_stranger_info",
|
|
85
|
+
LIST_STRANGERS: "list_strangers",
|
|
86
|
+
GET_PROFILE: "get_profile",
|
|
69
87
|
GET_STATUS: "get_status",
|
|
88
|
+
GET_ONLINE_STATUS: "get_online_status",
|
|
70
89
|
GET_SELF_PROFILE: "get_self_profile",
|
|
71
90
|
|
|
72
91
|
// ── 消息发送 ──
|
|
@@ -78,6 +97,8 @@ export const Actions = {
|
|
|
78
97
|
GET_MSG: "get_msg",
|
|
79
98
|
HISTORY_PRIVATE: "history_private",
|
|
80
99
|
HISTORY_GROUP: "history_group",
|
|
100
|
+
HISTORY_BY_MSG_ID: "history_by_msg_id",
|
|
101
|
+
SEND_LONG_MSG: "send_long_msg",
|
|
81
102
|
MARK_READ: "mark_read",
|
|
82
103
|
DELETE_MSG: "delete_msg",
|
|
83
104
|
|
|
@@ -165,6 +186,9 @@ export const Actions = {
|
|
|
165
186
|
SEND_PRIVATE_FILE: "send_private_file",
|
|
166
187
|
SEND_GROUP_FILE: "send_group_file",
|
|
167
188
|
FRIEND_RECALL_FILE: "friend_recall_file",
|
|
189
|
+
FRIEND_FORWARD_FILE: "friend_forward_file",
|
|
190
|
+
SEARCH_SAME_GROUP: "search_same_group",
|
|
191
|
+
SEND_CONTACT_SHARE: "send_contact_share",
|
|
168
192
|
GFS_UPLOAD: "gfs_upload",
|
|
169
193
|
|
|
170
194
|
// ── 群消息表态 ──
|
|
@@ -179,6 +203,7 @@ export const Actions = {
|
|
|
179
203
|
GUILD_LIST: "guild_list",
|
|
180
204
|
GUILD_INFO: "guild_info",
|
|
181
205
|
GUILD_CHANNELS: "guild_channels",
|
|
206
|
+
GET_CHANNEL_INFO: "get_channel_info",
|
|
182
207
|
GUILD_MEMBERS: "guild_members",
|
|
183
208
|
GUILD_SEND_MSG: "guild_send_msg",
|
|
184
209
|
GUILD_RECALL_MSG: "guild_recall_msg",
|
|
@@ -208,7 +233,13 @@ export const Actions = {
|
|
|
208
233
|
GET_CLIENT_KEY: "get_client_key",
|
|
209
234
|
GET_PSKEY: "get_pskey",
|
|
210
235
|
UID2UIN: "uid2uin",
|
|
236
|
+
UID2UINS: "uid2uins",
|
|
211
237
|
UIN2UID: "uin2uid",
|
|
238
|
+
UIN2UIDS: "uin2uids",
|
|
239
|
+
GET_COOKIES: "get_cookies",
|
|
240
|
+
GET_CSRF_TOKEN: "get_csrf_token",
|
|
241
|
+
REFRESH_NT_PIC_RKEY: "refresh_nt_pic_rkey",
|
|
242
|
+
SEND_DISCUSS_MSG: "send_discuss_msg",
|
|
212
243
|
|
|
213
244
|
// ── 视频/加好友设置 ──
|
|
214
245
|
GET_VIDEO_URL: "get_video_url",
|
package/src/typing-indicator.ts
CHANGED
|
@@ -113,10 +113,14 @@ export class ICQQTypingIndicatorManager {
|
|
|
113
113
|
} else if (options.userId) {
|
|
114
114
|
this.endpoint.logger.debug('[ICQQ:TypingIndicator] sending private message', {
|
|
115
115
|
userId: options.userId,
|
|
116
|
+
groupId: options.groupId,
|
|
116
117
|
});
|
|
117
118
|
return await this.endpoint.$sendMessage({
|
|
118
119
|
type: 'private',
|
|
119
120
|
id: options.userId,
|
|
121
|
+
...(options.groupId
|
|
122
|
+
? { parent: { type: 'group' as const, id: options.groupId } }
|
|
123
|
+
: {}),
|
|
120
124
|
context: 'icqq',
|
|
121
125
|
endpoint: this.endpoint.$id,
|
|
122
126
|
content: [{ type: 'text', data: { text: content } }],
|