fix: support pingmeapp com capture domain

This commit is contained in:
2026-05-31 13:14:31 +08:00
parent af653a8aac
commit 711a9d3c6d
3 changed files with 16 additions and 9 deletions
+9 -5
View File
@@ -5,8 +5,9 @@
* https://gitea.chickliu.fun/Hermes/qx/raw/branch/main/conf/pingme.conf
*
* 输出格式严格对齐当前 NiuPanel 正确 CK
* {"url":"https://api.pingmeapp.net/app/queryBalanceAndBonus?...","headers":{...}}
* {"url":"https://api.pingmeapp.com/app/queryBalanceAndBonus?...","headers":{...}}
*
* 兼容 api.pingmeapp.com 与 api.pingmeapp.net。
* 注意:pingme_multi.js 会从 url 自行解析查询参数并重算 sign,正确 CK 不需要 paramsRaw。
* 安全:不上传 CK,不请求第三方;仅在 QX 本地保存最近一次抓取结果。
*/
@@ -37,7 +38,7 @@ function hasQuery(url) {
return String(url || '').indexOf('?') >= 0 && String(url || '').split('?')[1].length > 0
}
function buildHeaders(headers) {
function buildHeaders(headers, sourceUrl) {
// 严格按现有正确 pingme_ck.json 的 header 形状输出。
// 保留 Host/Connection/Accept-Encoding,因为当前正确 CK 就是这个集合;
// pingme_multi.js 后续会覆盖 Host 与 Accept-Encoding,不会影响执行。
@@ -47,7 +48,10 @@ function buildHeaders(headers) {
const v = getHeader(headers, name)
if (v !== undefined && v !== null && String(v) !== '') out[name] = String(v)
})
if (!out.Host) out.Host = 'api.pingmeapp.net'
if (!out.Host) {
const m = String(sourceUrl || '').match(/^https?:\/\/([^/]+)/i)
out.Host = m ? m[1] : 'api.pingmeapp.com'
}
if (!out.Accept) out.Accept = '*/*'
return out
}
@@ -55,7 +59,7 @@ function buildHeaders(headers) {
function buildRecord(req) {
return {
url: String(req.url || ''),
headers: buildHeaders(req.headers || {})
headers: buildHeaders(req.headers || {}, req.url)
}
}
@@ -67,7 +71,7 @@ function main() {
}
const url = String(req.url || '')
if (!/^https?:\/\/api\.pingmeapp\.net\/app\/queryBalanceAndBonus(?:\?|$)/.test(url)) {
if (!/^https?:\/\/api\.pingmeapp\.(?:net|com)\/app\/queryBalanceAndBonus(?:\?|$)/.test(url)) {
notify('等待正确接口', '请打开 PingMe 触发 queryBalanceAndBonus 接口')
return done()
}