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 () => {