@zhin.js/adapter-icqq 1.1.22 → 1.1.24
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 +52 -0
- package/lib/icqq-inbound.d.ts +2 -6
- package/lib/icqq-inbound.js +5 -30
- package/lib/outbound-media.js +10 -4
- package/package.json +21 -22
- package/pages/index/index.js +1 -2
- package/pages/index/index.ts +1 -2
- package/plugin.js +7 -5
- package/src/icqq-inbound.ts +13 -32
- package/src/outbound-media.ts +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# @zhin.js/adapter-icqq
|
|
2
2
|
|
|
3
|
+
## 1.1.24
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cbf1fb1: Unify Console page blueprints (`definePageBlueprint`, `defineAdapterPage`, `defineCommentReviewPage`, `projectBlueprintToImCard`, `projectBlueprintToCliPanel`) into `@zhin.js/console-contract` and `@zhin.js/page`, add zero-esbuild pure Blueprint synthesis + static client bundle mounting to `@zhin.js/pagemanager`, remove `@zhin.js/client` (React 19) and `.tsx` from all 30 server-side plugins and adapters (including `bilibili` and `juejin`), and remove legacy Era-1 Koa `PageManager` code.
|
|
8
|
+
- Updated dependencies [cbf1fb1]
|
|
9
|
+
- Updated dependencies [008ccad]
|
|
10
|
+
- Updated dependencies [a1f1028]
|
|
11
|
+
- @zhin.js/console-contract@1.1.4
|
|
12
|
+
- @zhin.js/page@1.1.16
|
|
13
|
+
- @zhin.js/core@1.1.58
|
|
14
|
+
- @zhin.js/im-contract@1.1.13
|
|
15
|
+
- @zhin.js/adapter@1.1.30
|
|
16
|
+
- @zhin.js/adapter-onebot-events@0.0.3
|
|
17
|
+
- @zhin.js/tool@1.1.17
|
|
18
|
+
- @zhin.js/agent-feature@1.1.15
|
|
19
|
+
- @zhin.js/feature-kit@1.1.14
|
|
20
|
+
- @zhin.js/permission@1.1.14
|
|
21
|
+
- @zhin.js/skill@1.1.15
|
|
22
|
+
|
|
23
|
+
## 1.1.23
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- bc6ccb1: Deep audit bug fixes and 7 architectural improvements:
|
|
28
|
+
- Sink Agent Turn ingress pipeline from `@zhin.js/cli` into `@zhin.js/agent/runtime` (`plugin-runtime/ingress/`) and decompose `ingress-route.ts` into modular pipeline stages.
|
|
29
|
+
- Bind Session State Plane (`JsxButtonRegistry`, `InteractionRuntime`, `RuntimeInteractiveRouter`) to `PluginIncarnationRef` so active buttons and interactions survive unrelated-plugin HMR while expiring when the owning plugin reloads, and support per-conversation fallback numbering (`numberingScope: 'conversation'`).
|
|
30
|
+
- Establish `conversation_events` as the canonical message SSOT and reference `conversation_event_id`, `conversation_key`, `platform_message_id`, and `message_key` in `agent_messages` (`AGENT_MESSAGE_QUERY_VERSION = 2`), threading `conversationSequence` across inbound and outbound delivery receipts.
|
|
31
|
+
- Push down `DatabaseContextRepository` and `DatabaseScheduleJobStorage` full-session/full-table memory scans to indexed SQL queries.
|
|
32
|
+
- Add kernel-level inbound `replyTo` and `mentioned` auto-promotion (`promoteInboundMessagePayload`) plus reusable `InboundDeduper` and `TtlLookupCache` primitives in `@zhin.js/adapter`.
|
|
33
|
+
- Add `MiddlewareContext.dispatch` (`InboundDispatchSummary`) and `onAfterDispatch` hooks for `after-dispatch` middlewares, and support incremental rendering of in-place `envelope.payload` array mutations in `OutboundDeliveryRuntime`.
|
|
34
|
+
- Unify `HistoryWindowTracker` and `AgentCompactionRuntime` token/message budgets (`resolveUnifiedHistoryAndCompactionBudget`).
|
|
35
|
+
- Fix schema validation, database transaction connection cleanup and SQLite WAL mode, schedule timer wheel head-of-line blocking, security policy bash read paths and subagent guard propagation, group merge window permission carrier handoff, micro-compact namespaced tool matching, and WebSocket force-close / inbound segment mapping across adapters.
|
|
36
|
+
- Updated dependencies [3a8504b]
|
|
37
|
+
- Updated dependencies [6163abc]
|
|
38
|
+
- Updated dependencies [fed2c27]
|
|
39
|
+
- Updated dependencies [bc6ccb1]
|
|
40
|
+
- Updated dependencies [72b5a12]
|
|
41
|
+
- Updated dependencies [4427e72]
|
|
42
|
+
- Updated dependencies [22bd14a]
|
|
43
|
+
- @zhin.js/agent-feature@1.1.14
|
|
44
|
+
- @zhin.js/core@1.1.57
|
|
45
|
+
- @zhin.js/client@1.1.25
|
|
46
|
+
- @zhin.js/page@1.1.15
|
|
47
|
+
- @zhin.js/im-contract@1.1.12
|
|
48
|
+
- @zhin.js/adapter@1.1.29
|
|
49
|
+
- @zhin.js/feature-kit@1.1.13
|
|
50
|
+
- @zhin.js/tool@1.1.16
|
|
51
|
+
- @zhin.js/adapter-onebot-events@0.0.2
|
|
52
|
+
- @zhin.js/permission@1.1.13
|
|
53
|
+
- @zhin.js/skill@1.1.14
|
|
54
|
+
|
|
3
55
|
## 1.1.22
|
|
4
56
|
|
|
5
57
|
### Patch Changes
|
package/lib/icqq-inbound.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* icqq 入站事件归一化(post_type / message_type / message 段)
|
|
3
3
|
*/
|
|
4
4
|
import { type MessageSegment } from "zhin.js";
|
|
5
|
+
import { InboundMessageDeduper } from "zhin.js/adapter";
|
|
5
6
|
import type { GroupRole } from "./types.js";
|
|
6
7
|
/** 守护进程推送的通用事件壳 */
|
|
7
8
|
export interface IcqqEventBase {
|
|
@@ -163,9 +164,4 @@ export declare function resolveIcqqQuoteIdFromEvent(data: IcqqMessageEvent): str
|
|
|
163
164
|
export declare function resolveInboundContent(data: IcqqMessageEvent): MessageSegment[];
|
|
164
165
|
export declare function normalizeIcqqInboundMessage(data: IcqqMessageEvent): NormalizedIcqqInbound | null;
|
|
165
166
|
/** 按 message_id 去重(多路 subscribe 会收到同一消息多次) */
|
|
166
|
-
export
|
|
167
|
-
private readonly seen;
|
|
168
|
-
shouldProcess(messageId: string): boolean;
|
|
169
|
-
clear(): void;
|
|
170
|
-
}
|
|
171
|
-
export {};
|
|
167
|
+
export { InboundMessageDeduper };
|
package/lib/icqq-inbound.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* icqq 入站事件归一化(post_type / message_type / message 段)
|
|
3
3
|
*/
|
|
4
4
|
import { toCanonicalSegments } from "zhin.js";
|
|
5
|
+
import { InboundMessageDeduper, promoteInboundMessagePayload } from "zhin.js/adapter";
|
|
5
6
|
import { parseCqMessage, icqqMediaRefFromString } from "./cq-message.js";
|
|
6
7
|
import { extractForwardResidFromJsonElement } from "./forward-msg.js";
|
|
7
8
|
/**
|
|
@@ -32,7 +33,6 @@ export async function resolveIcqqInboundMedia(elements, resolver) {
|
|
|
32
33
|
}
|
|
33
34
|
}));
|
|
34
35
|
}
|
|
35
|
-
const DEDUPE_TTL_MS = 120_000;
|
|
36
36
|
const ICQQ_GROUP_ROLES = new Set(["owner", "admin", "member"]);
|
|
37
37
|
/** 从 sender.role 解析群成员角色(供 Message.$sender → resolveSenderRoles) */
|
|
38
38
|
export function parseIcqqSenderGroupRole(sender) {
|
|
@@ -51,14 +51,8 @@ export function isIcqqBotMentioned(input) {
|
|
|
51
51
|
const uin = String(input.uin ?? "").trim();
|
|
52
52
|
if (!uin)
|
|
53
53
|
return false;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
continue;
|
|
57
|
-
const data = (seg.data ?? {});
|
|
58
|
-
const target = String(data.qq ?? data.user_id ?? data.id ?? data.target ?? "").trim();
|
|
59
|
-
if (target && target !== "all" && Number(target) === Number(uin)) {
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
54
|
+
if (promoteInboundMessagePayload({ segments: input.content ?? [] }, uin).mentioned === true) {
|
|
55
|
+
return true;
|
|
62
56
|
}
|
|
63
57
|
const raw = input.rawMessage ?? "";
|
|
64
58
|
if (!raw)
|
|
@@ -648,10 +642,7 @@ function mergeReplyFromSource(content, data) {
|
|
|
648
642
|
];
|
|
649
643
|
}
|
|
650
644
|
function quoteIdFromSegments(content) {
|
|
651
|
-
|
|
652
|
-
const data = reply?.data;
|
|
653
|
-
const value = data?.message_id ?? data?.id;
|
|
654
|
-
return value == null || !String(value).trim() ? undefined : String(value).trim();
|
|
645
|
+
return promoteInboundMessagePayload({ segments: content }, undefined).replyTo?.id;
|
|
655
646
|
}
|
|
656
647
|
export function resolveInboundContent(data) {
|
|
657
648
|
const fromElements = icqqElementsToSegments(data.message);
|
|
@@ -701,20 +692,4 @@ export function normalizeIcqqInboundMessage(data) {
|
|
|
701
692
|
};
|
|
702
693
|
}
|
|
703
694
|
/** 按 message_id 去重(多路 subscribe 会收到同一消息多次) */
|
|
704
|
-
export
|
|
705
|
-
seen = new Map();
|
|
706
|
-
shouldProcess(messageId) {
|
|
707
|
-
const now = Date.now();
|
|
708
|
-
for (const [id, t] of this.seen) {
|
|
709
|
-
if (now - t > DEDUPE_TTL_MS)
|
|
710
|
-
this.seen.delete(id);
|
|
711
|
-
}
|
|
712
|
-
if (this.seen.has(messageId))
|
|
713
|
-
return false;
|
|
714
|
-
this.seen.set(messageId, now);
|
|
715
|
-
return true;
|
|
716
|
-
}
|
|
717
|
-
clear() {
|
|
718
|
-
this.seen.clear();
|
|
719
|
-
}
|
|
720
|
-
}
|
|
695
|
+
export { InboundMessageDeduper };
|
package/lib/outbound-media.js
CHANGED
|
@@ -43,21 +43,27 @@ export function prepareIcqqOutboundMedia(content, mode = "file") {
|
|
|
43
43
|
return seg;
|
|
44
44
|
const d = data;
|
|
45
45
|
const media = d.media;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
let b64 = "";
|
|
47
|
+
let mime = "";
|
|
48
|
+
if (isMediaRef(media) && media.kind === "base64") {
|
|
49
|
+
b64 = media.value.replace(/^base64:\/\//, "");
|
|
50
|
+
mime = media.mime_type ?? "";
|
|
51
|
+
}
|
|
52
|
+
else if (typeof d.file === "string" && d.file.startsWith("base64://")) {
|
|
53
|
+
b64 = d.file.slice("base64://".length);
|
|
54
|
+
}
|
|
49
55
|
if (!b64)
|
|
50
56
|
return seg;
|
|
51
57
|
if (type !== "image" && type !== "record" && type !== "audio" && type !== "video") {
|
|
52
58
|
return seg;
|
|
53
59
|
}
|
|
54
|
-
const mime = media.mime_type ?? "";
|
|
55
60
|
const filePath = spoolBase64ToFile(b64, mime || (type === "image" ? "image/jpeg" : type === "video" ? "video/mp4" : "audio/mpeg"), type === "record" || type === "audio" ? "audio" : type);
|
|
56
61
|
createdFiles.push(filePath);
|
|
57
62
|
return {
|
|
58
63
|
type,
|
|
59
64
|
data: {
|
|
60
65
|
...d,
|
|
66
|
+
...(typeof d.file === "string" && d.file.startsWith("base64://") ? { file: filePath } : {}),
|
|
61
67
|
media: {
|
|
62
68
|
kind: "path",
|
|
63
69
|
value: filePath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/adapter-icqq",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.24",
|
|
4
4
|
"description": "Zhin.js ICQQ adapter — direct connection to @icqqjs/icqq",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -33,29 +33,28 @@
|
|
|
33
33
|
"directory": "plugins/adapters/icqq"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@zhin.js/adapter-onebot-events": "0.0.
|
|
37
|
-
"@zhin.js/adapter": "1.1.
|
|
38
|
-
"@zhin.js/agent-feature": "1.1.
|
|
39
|
-
"@zhin.js/
|
|
40
|
-
"@zhin.js/
|
|
41
|
-
"@zhin.js/
|
|
42
|
-
"@zhin.js/
|
|
43
|
-
"@zhin.js/im-contract": "1.1.11",
|
|
36
|
+
"@zhin.js/adapter-onebot-events": "0.0.3",
|
|
37
|
+
"@zhin.js/adapter": "1.1.30",
|
|
38
|
+
"@zhin.js/agent-feature": "1.1.15",
|
|
39
|
+
"@zhin.js/console-contract": "1.1.4",
|
|
40
|
+
"@zhin.js/core": "1.1.58",
|
|
41
|
+
"@zhin.js/feature-kit": "1.1.14",
|
|
42
|
+
"@zhin.js/im-contract": "1.1.13",
|
|
44
43
|
"@zhin.js/logger": "1.1.2",
|
|
45
|
-
"@zhin.js/page": "1.1.
|
|
46
|
-
"@zhin.js/permission": "1.1.
|
|
47
|
-
"@zhin.js/skill": "1.1.
|
|
48
|
-
"@zhin.js/tool": "1.1.
|
|
44
|
+
"@zhin.js/page": "1.1.16",
|
|
45
|
+
"@zhin.js/permission": "1.1.14",
|
|
46
|
+
"@zhin.js/skill": "1.1.15",
|
|
47
|
+
"@zhin.js/tool": "1.1.17"
|
|
49
48
|
},
|
|
50
49
|
"peerDependencies": {
|
|
51
50
|
"@icqqjs/icqq": "^1.12.2",
|
|
52
51
|
"zod": "^4.0.0",
|
|
53
|
-
"@zhin.js/adapter": "^1.1.
|
|
54
|
-
"@zhin.js/agent": "^1.1.
|
|
55
|
-
"@zhin.js/command": "^1.1.
|
|
56
|
-
"@zhin.js/core": "^1.1.
|
|
57
|
-
"@zhin.js/prompt-section": "^1.1.
|
|
58
|
-
"zhin.js": "^1.1.
|
|
52
|
+
"@zhin.js/adapter": "^1.1.30",
|
|
53
|
+
"@zhin.js/agent": "^1.1.49",
|
|
54
|
+
"@zhin.js/command": "^1.1.16",
|
|
55
|
+
"@zhin.js/core": "^1.1.58",
|
|
56
|
+
"@zhin.js/prompt-section": "^1.1.14",
|
|
57
|
+
"zhin.js": "^1.1.23"
|
|
59
58
|
},
|
|
60
59
|
"peerDependenciesMeta": {
|
|
61
60
|
"@icqqjs/icqq": {
|
|
@@ -83,9 +82,9 @@
|
|
|
83
82
|
"typescript": "^6.0.3",
|
|
84
83
|
"vitest": "^4.1.10",
|
|
85
84
|
"zod": "^4.4.3",
|
|
86
|
-
"@zhin.js/agent": "1.1.
|
|
87
|
-
"@zhin.js/prompt-section": "1.1.
|
|
88
|
-
"zhin.js": "1.1.
|
|
85
|
+
"@zhin.js/agent": "1.1.49",
|
|
86
|
+
"@zhin.js/prompt-section": "1.1.14",
|
|
87
|
+
"zhin.js": "1.1.23"
|
|
89
88
|
},
|
|
90
89
|
"files": [
|
|
91
90
|
"adapters",
|
package/pages/index/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
-
import { definePage } from '@zhin.js/console-contract';
|
|
3
|
-
import { createAdapterConsolePage } from '@zhin.js/client';
|
|
2
|
+
import { definePage, createAdapterConsolePage } from '@zhin.js/console-contract';
|
|
4
3
|
export const meta = definePage({
|
|
5
4
|
title: 'ICQQ',
|
|
6
5
|
titleI18n: { en: 'ICQQ' },
|
package/pages/index/index.ts
CHANGED
package/plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
-
import { definePlugin
|
|
2
|
+
import { definePlugin } from 'zhin.js';
|
|
3
3
|
import { permissionHostToken, createSceneRolePlatformChecker } from '@zhin.js/permission';
|
|
4
4
|
import { registerSensitiveExecCommand } from '@zhin.js/agent';
|
|
5
5
|
import { createIcqqConsoleRpc } from "./lib/console.js";
|
|
@@ -11,14 +11,16 @@ export default definePlugin({
|
|
|
11
11
|
displayName: 'ICQQ Adapter',
|
|
12
12
|
},
|
|
13
13
|
setup(context) {
|
|
14
|
-
context.resources.provide(pluginConsoleRpcToken, createIcqqConsoleRpc(() => context.config.get()));
|
|
15
14
|
const disposePlatform = context.resources.has(permissionHostToken)
|
|
16
15
|
? context.resources.use(permissionHostToken).registerPlatform('icqq', createSceneRolePlatformChecker())
|
|
17
16
|
: undefined;
|
|
18
17
|
const disposeExecRule = registerSensitiveExecCommand(icqqSensitiveExecRule);
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
return {
|
|
19
|
+
consoleRpc: createIcqqConsoleRpc(() => context.config.get()),
|
|
20
|
+
dispose: () => {
|
|
21
|
+
disposeExecRule();
|
|
22
|
+
disposePlatform?.();
|
|
23
|
+
},
|
|
22
24
|
};
|
|
23
25
|
},
|
|
24
26
|
});
|
package/src/icqq-inbound.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* icqq 入站事件归一化(post_type / message_type / message 段)
|
|
3
3
|
*/
|
|
4
4
|
import { toCanonicalSegments, type MessageSegment } from "zhin.js";
|
|
5
|
+
import { InboundMessageDeduper, promoteInboundMessagePayload } from "zhin.js/adapter";
|
|
5
6
|
import { parseCqMessage, icqqMediaRefFromString } from "./cq-message.js";
|
|
6
7
|
import { extractForwardResidFromJsonElement } from "./forward-msg.js";
|
|
7
8
|
import type { GroupRole } from "./types.js";
|
|
@@ -141,8 +142,6 @@ export interface NormalizedIcqqInbound {
|
|
|
141
142
|
raw: IcqqMessageEvent;
|
|
142
143
|
}
|
|
143
144
|
|
|
144
|
-
const DEDUPE_TTL_MS = 120_000;
|
|
145
|
-
|
|
146
145
|
const ICQQ_GROUP_ROLES = new Set<GroupRole>(["owner", "admin", "member"]);
|
|
147
146
|
|
|
148
147
|
/** 从 sender.role 解析群成员角色(供 Message.$sender → resolveSenderRoles) */
|
|
@@ -167,15 +166,13 @@ export function isIcqqBotMentioned(input: {
|
|
|
167
166
|
}): boolean {
|
|
168
167
|
const uin = String(input.uin ?? "").trim();
|
|
169
168
|
if (!uin) return false;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
return true;
|
|
178
|
-
}
|
|
169
|
+
if (
|
|
170
|
+
promoteInboundMessagePayload<{ segments: readonly MessageSegment[]; mentioned?: boolean }>(
|
|
171
|
+
{ segments: input.content ?? [] },
|
|
172
|
+
uin,
|
|
173
|
+
).mentioned === true
|
|
174
|
+
) {
|
|
175
|
+
return true;
|
|
179
176
|
}
|
|
180
177
|
const raw = input.rawMessage ?? "";
|
|
181
178
|
if (!raw) return false;
|
|
@@ -805,10 +802,10 @@ function mergeReplyFromSource(
|
|
|
805
802
|
}
|
|
806
803
|
|
|
807
804
|
function quoteIdFromSegments(content: readonly MessageSegment[]): string | undefined {
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
805
|
+
return promoteInboundMessagePayload<{ segments: readonly MessageSegment[]; replyTo?: { readonly id: string } }>(
|
|
806
|
+
{ segments: content },
|
|
807
|
+
undefined,
|
|
808
|
+
).replyTo?.id;
|
|
812
809
|
}
|
|
813
810
|
|
|
814
811
|
export function resolveInboundContent(
|
|
@@ -863,20 +860,4 @@ export function normalizeIcqqInboundMessage(
|
|
|
863
860
|
}
|
|
864
861
|
|
|
865
862
|
/** 按 message_id 去重(多路 subscribe 会收到同一消息多次) */
|
|
866
|
-
export
|
|
867
|
-
private readonly seen = new Map<string, number>();
|
|
868
|
-
|
|
869
|
-
shouldProcess(messageId: string): boolean {
|
|
870
|
-
const now = Date.now();
|
|
871
|
-
for (const [id, t] of this.seen) {
|
|
872
|
-
if (now - t > DEDUPE_TTL_MS) this.seen.delete(id);
|
|
873
|
-
}
|
|
874
|
-
if (this.seen.has(messageId)) return false;
|
|
875
|
-
this.seen.set(messageId, now);
|
|
876
|
-
return true;
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
clear(): void {
|
|
880
|
-
this.seen.clear();
|
|
881
|
-
}
|
|
882
|
-
}
|
|
863
|
+
export { InboundMessageDeduper };
|
package/src/outbound-media.ts
CHANGED
|
@@ -68,14 +68,19 @@ export function prepareIcqqOutboundMedia(
|
|
|
68
68
|
if (!data || typeof data !== "object") return seg;
|
|
69
69
|
const d = data as Record<string, unknown>;
|
|
70
70
|
const media = d.media;
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
let b64 = "";
|
|
72
|
+
let mime = "";
|
|
73
|
+
if (isMediaRef(media) && media.kind === "base64") {
|
|
74
|
+
b64 = media.value.replace(/^base64:\/\//, "");
|
|
75
|
+
mime = media.mime_type ?? "";
|
|
76
|
+
} else if (typeof d.file === "string" && d.file.startsWith("base64://")) {
|
|
77
|
+
b64 = d.file.slice("base64://".length);
|
|
78
|
+
}
|
|
73
79
|
if (!b64) return seg;
|
|
74
80
|
if (type !== "image" && type !== "record" && type !== "audio" && type !== "video") {
|
|
75
81
|
return seg;
|
|
76
82
|
}
|
|
77
83
|
|
|
78
|
-
const mime = media.mime_type ?? "";
|
|
79
84
|
const filePath = spoolBase64ToFile(
|
|
80
85
|
b64,
|
|
81
86
|
mime || (type === "image" ? "image/jpeg" : type === "video" ? "video/mp4" : "audio/mpeg"),
|
|
@@ -86,6 +91,7 @@ export function prepareIcqqOutboundMedia(
|
|
|
86
91
|
type,
|
|
87
92
|
data: {
|
|
88
93
|
...d,
|
|
94
|
+
...(typeof d.file === "string" && d.file.startsWith("base64://") ? { file: filePath } : {}),
|
|
89
95
|
media: {
|
|
90
96
|
kind: "path",
|
|
91
97
|
value: filePath,
|