From b9d824730963600d8ed11ac78fc0b548c9bf0d32 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Sat, 20 Jun 2026 02:10:12 +0800 Subject: [PATCH] fix(qzone): complete re_feeds param set + correct qzreferrer/topicId honesty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adversarial review (NEEDS-FIXES) — the high-risk parts (topicId base hostUin_tid, uin/hostUin not swapped, format=fs, platformid=52) verified correct against 3 community impls; the gaps: - Added the re_feeds param family all 3 impls send and the publish sibling already sends for this CGI family: feedsType=100, private=0, paramstr=1, richtype/richval/isSignIn=''. Tests assert the load-bearing ones. - qzreferrer used hostUin; all impls use the commenter's own uin → selfUin. - topicId __1 suffix is impl-dependent (2/3 include it, 1 omits); kept as default but the comment now flags the suffix specifically as the unverified piece (base shape is confirmed), and the test no longer presents it as canonical. --- packages/protocol/src/web/qzone.ts | 21 ++++++++++++++++----- packages/protocol/tests/web/qzone.test.ts | 10 +++++++++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/packages/protocol/src/web/qzone.ts b/packages/protocol/src/web/qzone.ts index 092ad326..468be817 100644 --- a/packages/protocol/src/web/qzone.ts +++ b/packages/protocol/src/web/qzone.ts @@ -548,12 +548,16 @@ export async function setQzoneLike( // ─────────────── 评论说说 (comment) — emotion_cgi_re_feeds ─────────────── // Posts a comment on a 说说 owned by `hostUin`, as the bot (`selfUin`). Same -// form-POST mechanics as publish/delete. The `topicId` keys the target feed -// as `___1`. Success is `code 0` (throw on non-zero code/ +// form-POST mechanics + param family (paramstr/richtype/richval) as +// publishQzoneMsg. The `topicId` keys the target feed as `_`; +// the trailing `__1` suffix is CONFIRMED on 2/3 community impls but a third +// omits it, so the suffix specifically is the unverified piece (the base +// shape is confirmed). `uin`=commenter(self), `hostUin`=feed owner — verified +// not-swapped across 3 impls. Success is `code 0` (throw on non-zero code/ // subcode); the new comment id is returned best-effort (the response field // name varies — commentid/commentId — so a missing id is NOT a failure when -// code is 0). WRITE OP — rate-limit. topicId shape + comment-id field are -// EXTRAPOLATED from community impls, pending a live capture. +// code is 0). WRITE OP — rate-limit. The topicId `__1` suffix + comment-id +// field are extrapolated, pending a live capture. interface RawCommentResponse { code?: number; @@ -597,13 +601,20 @@ export async function commentQzoneMsg( const bkn = getBknFromCookie(cookieObject); const url = `https://h5.qzone.qq.com/proxy/domain/taotao.qzone.qq.com/cgi-bin/emotion_cgi_re_feeds?g_tk=${bkn}`; const body = new URLSearchParams({ - qzreferrer: `https://user.qzone.qq.com/${hostUin}`, + // qzreferrer carries the commenter's (self) space, matching the impls. + qzreferrer: `https://user.qzone.qq.com/${selfUin}`, inCharset: 'utf-8', outCharset: 'utf-8', hostUin, format: 'fs', ref: 'feeds', topicId: `${hostUin}_${tid}__1`, + feedsType: '100', + private: '0', + paramstr: '1', + richtype: '', + richval: '', + isSignIn: '', uin: selfUin, content, plat: 'qzone', diff --git a/packages/protocol/tests/web/qzone.test.ts b/packages/protocol/tests/web/qzone.test.ts index dbedd861..d39ed22b 100644 --- a/packages/protocol/tests/web/qzone.test.ts +++ b/packages/protocol/tests/web/qzone.test.ts @@ -371,12 +371,20 @@ describe('qzone / commentQzoneMsg (HTTP layer)', () => { expect(h['Content-Type']).toBe('application/x-www-form-urlencoded'); expect(h.Cookie).toContain('p_skey=PSK'); const form = new URLSearchParams(body as string); - // topicId keys the target feed as ___1; uin=commenter(self) + // topicId base _ is confirmed; the __1 suffix is on 2/3 + // impls (one omits it) — kept as the default, not asserted as canonical. expect(form.get('topicId')).toBe('20002_TIDX__1'); + // uin=commenter(self), hostUin=feed owner — verified not-swapped expect(form.get('uin')).toBe('10000'); expect(form.get('hostUin')).toBe('20002'); expect(form.get('content')).toBe('说得好 & 顶'); expect(form.get('format')).toBe('fs'); + // qzreferrer carries the commenter's own space (matches the impls) + expect(form.get('qzreferrer')).toBe('https://user.qzone.qq.com/10000'); + // the re_feeds param family (3/3 impls) the publish sibling also sends + expect(form.get('feedsType')).toBe('100'); + expect(form.get('private')).toBe('0'); + expect(form.get('paramstr')).toBe('1'); }); it('resolves with empty comment_id on success when the response carries no id (field name varies)', async () => {