diff --git a/conf/pingme.conf b/conf/pingme.conf index 7e917cf..47820c4 100644 --- a/conf/pingme.conf +++ b/conf/pingme.conf @@ -1,6 +1,7 @@ -hostname = api.pingmeapp.net +hostname = api.pingmeapp.net, api.pingmeapp.com # PingMe:抓取 NiuPanel pingme_multi.js 所需账号配置 # 现有正确 CK 格式只包含 {"url":"...","headers":{...}},不额外输出 paramsRaw +# 兼容 api.pingmeapp.net 与 api.pingmeapp.com # 使用说明见 docs/pingme-capture.md -^https?:\/\/api\.pingmeapp\.net\/app\/queryBalanceAndBonus(?:\?|$) url script-request-header https://gitea.chickliu.fun/Hermes/qx/raw/branch/main/js/pingme_capture.js +^https?:\/\/api\.pingmeapp\.(?:net|com)\/app\/queryBalanceAndBonus(?:\?|$) url script-request-header https://gitea.chickliu.fun/Hermes/qx/raw/branch/main/js/pingme_capture.js diff --git a/docs/pingme-capture.md b/docs/pingme-capture.md index b8749ad..70b4ed9 100644 --- a/docs/pingme-capture.md +++ b/docs/pingme-capture.md @@ -11,6 +11,7 @@ https://gitea.chickliu.fun/Hermes/qx/raw/branch/main/conf/pingme.conf 这个 QX 重写监听 PingMe 官方余额接口: ```text +api.pingmeapp.com/app/queryBalanceAndBonus api.pingmeapp.net/app/queryBalanceAndBonus ``` @@ -19,7 +20,7 @@ api.pingmeapp.net/app/queryBalanceAndBonus 抓到后生成 NiuPanel 任务 `pingme_multi.js` 当前正确 CK 同款账号 JSON 对象: ```json -{"url":"https://api.pingmeapp.net/app/queryBalanceAndBonus?...","headers":{"Host":"api.pingmeapp.net","Connection":"keep-alive","Accept":"*/*","User-Agent":"...","Accept-Language":"...","Accept-Encoding":"..."}} +{"url":"https://api.pingmeapp.com/app/queryBalanceAndBonus?...","headers":{"Host":"api.pingmeapp.com","Connection":"keep-alive","Accept":"*/*","User-Agent":"...","Accept-Language":"...","Accept-Encoding":"..."}} ``` 注意:当前正确 CK **不包含** `paramsRaw`。`pingme_multi.js` 会从 `url` 里的查询字符串自行解析参数并重算 `sign`。 @@ -48,6 +49,7 @@ NiuPanel 当前任务读取位置: 3. 确认 hostname 包含: ```text + api.pingmeapp.com api.pingmeapp.net ``` @@ -71,4 +73,4 @@ NiuPanel 当前任务读取位置: - 仓库不提交任何真实 CK、token、设备 ID 或 headers 明文。 - 脚本不上传数据,不请求第三方,只在 QX 本地保存最近一次抓取结果 `pingme_ck_last` 并弹窗展示。 -- 重写范围只包含 `api.pingmeapp.net` 的 `queryBalanceAndBonus` 接口。 +- 重写范围只包含 `api.pingmeapp.com` / `api.pingmeapp.net` 的 `queryBalanceAndBonus` 接口。 diff --git a/js/pingme_capture.js b/js/pingme_capture.js index 63e032f..54beced 100644 --- a/js/pingme_capture.js +++ b/js/pingme_capture.js @@ -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() }