feat(qzone): get_qzone_msg_list — read personal Qzone 说说 list via web API

First slice of personal QQ-Zone (个人空间) support, an exclusive feature
vs NapCat/SL (both only do group albums). Read-only to prove out the
auth+parse chain before write ops (publish/like/comment).

- protocol/web/qzone.ts: getQzoneMsgList over taotao.qzone.qq.com's
  emotion_cgi_msglist_v6 (h5.qzone proxy), reusing the same cookie/g_tk
  plumbing as group-album. JSONP-tolerant parse; throws on auth failure
  rather than swallowing to [] (mirrors group-signin contract).
- core: QzoneApi bridge class wired into ApiHub.
- onebot: get_qzone_msg_list action (target_uin/pos/num), regenerated
  MCP catalog + new 空间 doc category.
- HTTP-layer tests lock URL/params, JSONP stripping, field mapping, and
  the throw-on-auth-failure paths (9 cases, all green).

Exact CGI params/response fields to be re-confirmed against a live
capture when extending (same maintenance posture as group-album).
This commit is contained in:
DrSmoothl committed 2026-06-20 01:11:07 +08:00
1 parent d38a0a4c1b
commit 61b4bd04a6
9 files changed
+409

No files matched your search

+2
View File
@@ -22,6 +22,7 @@ import { actions as groupFileActions } from './actions/group-file';
import { actions as requestActions } from './actions/request';
import { actions as extendedActions } from './actions/extended';
import { actions as groupAlbumActions } from './actions/group-album';
import { actions as qzoneActions } from './actions/qzone';
type AnySpec = ActionSpec<Record<string, Field<unknown>>>;
@@ -36,6 +37,7 @@ const GROUPS: ReadonlyArray<{ category: string; specs: readonly AnySpec[] }> = [
{ category: '请求', specs: requestActions },
{ category: '扩展', specs: extendedActions },
{ category: '群相册', specs: groupAlbumActions },
{ category: '空间', specs: qzoneActions },
];
/** Every declarative action's doc (with category), sorted by name. */
+33
View File
@@ -0,0 +1,33 @@
import { defineAction, registerActions, f } from '../action-kit';
import type { ApiActionContext, ApiHandler } from '../api-handler';
import type { JsonValue } from '../types';
import { RETCODE, failedResponse, okResponse } from '../types';
export const actions = [
// get_qzone_msg_list — 获取 QQ 空间说说列表。无 go-cqhttp 标准,自定义命名。
// 默认取机器人自己的空间;传 target_uin 可查看指定账号(需有权限)。
// 复用 qzone.qq.com 的 cookie/g_tk 基建(与群相册同源),纯 web,无 trpc。
defineAction({
name: 'get_qzone_msg_list',
readOnly: true,
summary: '获取 QQ 空间说说列表(默认机器人自己的空间)',
params: {
target_uin: f.uint().describe('目标 QQ 号,省略则取机器人自己').optional(),
pos: f.int({ min: 0 }).describe('起始偏移').default(0),
num: f.int({ min: 1, max: 100 }).describe('本页数量').default(20),
},
run: async (p, ctx) => {
try {
const res = await ctx.bridge.apis.qzone.getMsgList(p.target_uin, p.pos, p.num);
return okResponse(res as unknown as JsonValue);
} catch (error) {
const message = error instanceof Error ? error.message : 'failed to get qzone msg list';
return failedResponse(RETCODE.INTERNAL_ERROR, message);
}
},
}),
];
export function register(h: ApiHandler, ctx: ApiActionContext): void {
registerActions(h, ctx, actions);
}
+2
View File
@@ -9,6 +9,7 @@ import { register as registerGroupFile } from './actions/group-file';
import { register as registerGroupInfo } from './actions/group-info';
import { register as registerInfo } from './actions/info';
import { register as registerMessage } from './actions/message';
import { register as registerQzone } from './actions/qzone';
import { register as registerRequest } from './actions/request';
import type { ForwardPreviewMeta } from './modules/message-actions';
import type { JsonObject, JsonValue, MessageMeta } from './types';
@@ -114,6 +115,7 @@ export class ApiHandler {
registerRequest(this, context);
registerExtended(this, context);
registerGroupAlbum(this, context);
registerQzone(this, context);
}
registerAction(action: string, handler: ActionHandler): void {