mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-04 21:01:17 +08:00
fix: 更改酷推信息格式
This commit is contained in:
parent
3c55ae6a70
commit
cb0788489b
1
.github/workflows/check.yml
vendored
1
.github/workflows/check.yml
vendored
@ -6,6 +6,7 @@ on:
|
||||
schedule:
|
||||
- cron: '0 */2 * * *'
|
||||
env:
|
||||
MY_CONFIG: ${{ secrets.MY_CONFIG }}
|
||||
PAT: ${{ secrets.PAT }}
|
||||
SCKEY: ${{ secrets.SCKEY }}
|
||||
SENDKEY: ${{ secrets.SENDKEY }}
|
||||
|
||||
1
.github/workflows/clear.yml
vendored
1
.github/workflows/clear.yml
vendored
@ -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 }}
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
* @property {RequestConfig} [config] 设置
|
||||
* @property {Proxy} [proxy] 代理
|
||||
* @property {Object.<string, string|number>} [query] 查询选项
|
||||
* @property {Object.<string, string|number>} [contents] 内容
|
||||
* @property {Object.<string, string|number> | 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;
|
||||
}
|
||||
|
||||
@ -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}`);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user