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:
9 files changed
+409
No files matched your search
@@ -10,6 +10,7 @@ import { InteractionApi } from './interaction';
|
||||
import { MessageApi } from './message';
|
||||
import { MiscApi } from './misc';
|
||||
import { ProfileApi } from './profile';
|
||||
import { QzoneApi } from './qzone';
|
||||
import { WebApi } from './web';
|
||||
|
||||
export interface ApiHub {
|
||||
@@ -23,6 +24,8 @@ export interface ApiHub {
|
||||
readonly groupFile: GroupFileApi;
|
||||
/** Group photo album: list/upload/comment/like/delete + media listing. */
|
||||
readonly groupAlbum: GroupAlbumApi;
|
||||
/** Personal QQ-Zone (个人空间): 说说 list + (future) publish/like/comment. */
|
||||
readonly qzone: QzoneApi;
|
||||
/** Interactive engagement: poke / like / reaction / essence / emoji-like-list. */
|
||||
readonly interaction: InteractionApi;
|
||||
/** Friend roster mutations: handleRequest / delete / setRemark. */
|
||||
@@ -54,6 +57,7 @@ export function buildApiHub(ctx: BridgeContext): ApiHub {
|
||||
groupAdmin: new GroupAdminApi(ctx),
|
||||
groupFile: new GroupFileApi(ctx),
|
||||
groupAlbum: new GroupAlbumApi(ctx),
|
||||
qzone: new QzoneApi(ctx),
|
||||
interaction: new InteractionApi(ctx),
|
||||
friend: new FriendApi(ctx),
|
||||
profile: new ProfileApi(ctx),
|
||||
@@ -78,5 +82,6 @@ export { InteractionApi } from './interaction';
|
||||
export { MessageApi } from './message';
|
||||
export { MiscApi } from './misc';
|
||||
export { ProfileApi } from './profile';
|
||||
export { QzoneApi } from './qzone';
|
||||
export { WebApi } from './web';
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { getQzoneMsgList, type QzoneMsgListResult } from '@snowluma/protocol/web/qzone';
|
||||
import type { BridgeContext } from '../bridge-context';
|
||||
|
||||
/**
|
||||
* Personal QQ-Zone (个人空间) web API: 说说 (feed) read/write, likes,
|
||||
* comments — all over the cookie-backed qzone.qq.com CGIs, reusing the same
|
||||
* `getCookies('qzone.qq.com')` plumbing as GroupAlbumApi. Distinct from the
|
||||
* group-album surface, which lives on GroupAlbumApi.
|
||||
*/
|
||||
export class QzoneApi {
|
||||
constructor(private readonly ctx: BridgeContext) { }
|
||||
|
||||
/**
|
||||
* 获取说说列表。`targetUin` 省略时取机器人自己的空间。
|
||||
* `pos` 为起始偏移,`num` 为本页数量(服务端上限约 20/页)。
|
||||
*/
|
||||
async getMsgList(targetUin?: number, pos = 0, num = 20): Promise<QzoneMsgListResult> {
|
||||
const uin = targetUin && targetUin > 0 ? targetUin.toString() : this.ctx.identity.uin;
|
||||
const cookieObject = await this.ctx.apis.web.getCookies('qzone.qq.com');
|
||||
return getQzoneMsgList(cookieObject, uin, pos, num);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user