diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 0fcd84e..d097386 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -6,6 +6,7 @@ on: schedule: - cron: '0 */2 * * *' env: + MY_CONFIG: ${{ secrets.MY_CONFIG }} PAT: ${{ secrets.PAT }} SCKEY: ${{ secrets.SCKEY }} SENDKEY: ${{ secrets.SENDKEY }} diff --git a/.github/workflows/clear.yml b/.github/workflows/clear.yml index 715816b..3e756e6 100644 --- a/.github/workflows/clear.yml +++ b/.github/workflows/clear.yml @@ -6,6 +6,7 @@ on: schedule: - cron: '0 17 1 * *' env: + MY_CONFIG: ${{ secrets.MY_CONFIG }} CLEAR: ${{ secrets.CLEAR }} PAT: ${{ secrets.PAT }} SCKEY: ${{ secrets.SCKEY }} diff --git a/lib/HttpRequest.js b/lib/HttpRequest.js index d826049..283e903 100644 --- a/lib/HttpRequest.js +++ b/lib/HttpRequest.js @@ -33,7 +33,7 @@ * @property {RequestConfig} [config] 设置 * @property {Proxy} [proxy] 代理 * @property {Object.} [query] 查询选项 - * @property {Object.} [contents] 内容 + * @property {Object. | string} [contents] 内容 * @property {HttpHeaders} [headers] 请求头 * @property {SuccessCb} success 成功回调 * @property {FailureCb} failure 失败回调 @@ -79,7 +79,7 @@ function HttpRequest(detail) { }; if (!headers["user-agent"]) headers["user-agent"] = DEFAULT_UA; if (query) options.path += (thisURL.search ? '&' : '?') + stringify(query); - if (contents) options.headers['content-length'] = Buffer.byteLength(content, 'utf-8').toString(); + if (content) options.headers['content-length'] = Buffer.byteLength(content, 'utf-8').toString(); if (proxy) { options.headers.host = thisURL.host; [options.hostname, options.port] = proxy.host ? @@ -147,6 +147,7 @@ function HttpRequest(detail) { */ function formatContents(type, contents) { if (/application\/json/i.test(type)) return JSON.stringify(contents); + if (/text\/plain/i.test(type)) return contents; if (contents) return stringify(contents) return contents; } diff --git a/lib/sendNotify.js b/lib/sendNotify.js index d40b0db..9b78b12 100644 --- a/lib/sendNotify.js +++ b/lib/sendNotify.js @@ -263,16 +263,13 @@ function coolPush(text, desp) { HttpRequest({ method: 'POST', url: `https://push.xuthus.cc/${QQ_MODE}/${QQ_SKEY}`, - contents: { - title: text, - desc: desp - }, + contents: `${text}\n${desp}`, config: { retry: false }, headers: { accept: 'application/json, text/plain, */*', - 'content-type': 'application/json' + "content-type": "text/plain", }, success: res => { try { @@ -280,7 +277,7 @@ function coolPush(text, desp) { if (data.code === 200) { console.log(`酷推发送${pushMode(QQ_MODE)}通知消息成功\n`) } else if (data.code === 400) { - console.log(`QQ酷推(Cool Push)发送${pushMode(QQ_MODE)}推送失败:${data.msg}\n`) + console.log(`QQ酷推(Cool Push)发送${pushMode(QQ_MODE)}推送失败:${data}\n`) } else { console.log(`酷推推送异常: ${data.msg}`); }