feat(weixin_ilink): 出站媒体走通(主人已批的三项)
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

按官方包 @tencent-weixin/openclaw-weixin 2.4.9 源码对齐:
① 上传由 PUT 改 POST;② 上传凭据读响应头 x-encrypted-param;
③ nativeMediaItem 改为官方 *_item.media.encrypt_query_param 嵌套形状(含 aes_key,
图片优先 image_item.aeskey)。
配合前一版已修的两点(入站按条密钥、媒体失败不阻断文本),机器人现在可主动发出文件/图片。
(逐项测试、变异红行与诚实边界见该切片报告)
This commit is contained in:
AskaEth committed 2026-10-05 08:04:50 +08:00
1 parent 59a1ac4056
commit f8f2e9c54c
7 files changed
+847 -246

No files matched your search

+11 -4
View File
@@ -14,11 +14,13 @@ import (
"git.yeij.top/AskaEth/Cyrene_v2/internal/channel/adapter"
)
// handlerResult 是测试里的假处理器对一次请求给出的裁决。
// handlerResult 是测试里的假处理器对一次请求给出的裁决。headers 用于模拟 CDN 上传
// 成功时回填凭据的响应头(`x-encrypted-param`)。
type handlerResult struct {
status int
body []byte
ctype string
status int
body []byte
ctype string
headers map[string]string
}
// reqRecorder 捕获假服务端收到的请求,使测试能断言适配器发送了预期的游标、
@@ -34,6 +36,7 @@ type recordedReq struct {
path string
query string
body []byte
ctype string
auth string
authType string
uin string
@@ -108,6 +111,7 @@ func newJSONServer(t *testing.T, rec *reqRecorder, fn func(r recordedReq) handle
path: r.URL.Path,
query: r.URL.RawQuery,
body: body,
ctype: r.Header.Get("Content-Type"),
auth: r.Header.Get("Authorization"),
authType: r.Header.Get("AuthorizationType"),
uin: r.Header.Get("X-WECHAT-UIN"),
@@ -125,6 +129,9 @@ func newJSONServer(t *testing.T, rec *reqRecorder, fn func(r recordedReq) handle
res.status = http.StatusOK
}
w.Header().Set("Content-Type", res.ctype)
for k, v := range res.headers {
w.Header().Set(k, v)
}
w.WriteHeader(res.status)
_, _ = w.Write(res.body)
}))