fix(qzone): complete re_feeds param set + correct qzreferrer/topicId honesty

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.
This commit is contained in:
DrSmoothl committed 2026-06-20 02:10:12 +08:00
1 parent 95f24ffc4a
commit b9d8247309
2 files changed
+25 -6

No files matched your search

+16 -5
View File
@@ -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 `<hostUin>_<tid>__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 `<hostUin>_<tid>`;
// 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',
+9 -1
View File
@@ -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 <hostUin>_<tid>__1; uin=commenter(self)
// topicId base <hostUin>_<tid> 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 () => {