Files
crawler-plugin/frontend-vue/tests/青果账密拼提取链接.test.ts
T
huangzd1997 3f827cc9af fix(user-secret): 青果链接改官方口径 share.proxy.qg.net 的 key+pwd 查询串
用户明确:青果只做密码鉴权档,白名单档不做。拼装规则随之改为
https://share.proxy.qg.net/get?key=..&pwd=..,不再用 userinfo。
2026-10-31 22:31:49 +08:00

28 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { test } from 'node:test'
import assert from 'node:assert/strict'
import { composeQingguoLink, QINGGUO_EXTRACT_URL } from '../src/shared/utils/qingguo-link.ts'
/**
* 青果没有「提取链接」可填,用户只给 key(Authkey)/ pwd(Authpwd),链接必须由前端拼
* (2026-10-31 用户拍板;官方口径 `https://share.proxy.qg.net/get?key=…&pwd=…`)。
* 拼不出来或拼错,用户就会在「填了账密」之后仍被商标检测的前置检查判成「未配置代理」。
*/
test('青果按密码鉴权拼出 key+pwd 的提取链接', () => {
assert.equal(composeQingguoLink('40F79A90', 'S3cret'),
`${QINGGUO_EXTRACT_URL}?key=40F79A90&pwd=S3cret`)
})
test('只有 key 时也拼得出来(不猜白名单档,缺 pwd 就只带 key)', () => {
assert.equal(composeQingguoLink(' 40F79A90 ', ''), `${QINGGUO_EXTRACT_URL}?key=40F79A90`)
})
test('没填 key 就不拼链接(空串=没配置,不许拼一条必然失败的链接)', () => {
assert.equal(composeQingguoLink('', 'pwd'), '')
assert.equal(composeQingguoLink(' ', 'pwd'), '')
})
test('key/pwd 里的特殊字符要编码,不能把查询串拼坏', () => {
const link = composeQingguoLink('a&b=c', 'p@ss:1')
assert.ok(link.endsWith('?key=a%26b%3Dc&pwd=p%40ss%3A1'), link)
})