mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 14:26:07 +08:00
JavaScript 通知文件 tunnel 替换为 hpagent,移除 scripts 目录下 package.json
This commit is contained in:
parent
d2cf482d11
commit
563457cf1b
|
@ -15,19 +15,6 @@ pm2 l &>/dev/null
|
|||
|
||||
echo -e "======================2. 安装依赖========================\n"
|
||||
patch_version
|
||||
if [[ $PipMirror ]]; then
|
||||
pip3 config set global.index-url $PipMirror
|
||||
fi
|
||||
current_npm_registry=$(cd && pnpm config get registry)
|
||||
is_equal_registry=$(echo $current_npm_registry | grep "${NpmMirror}")
|
||||
if [[ "$is_equal_registry" == "" ]]; then
|
||||
cd && pnpm config set registry $NpmMirror
|
||||
pnpm install -g
|
||||
fi
|
||||
if [[ ! -s $dir_scripts/package.json ]] || [[ $(diff $dir_sample/package.json $dir_scripts/package.json) ]]; then
|
||||
cp -f $dir_sample/package.json $dir_scripts/package.json
|
||||
npm_install_2 $dir_scripts
|
||||
fi
|
||||
echo
|
||||
|
||||
echo -e "======================3. 启动nginx========================\n"
|
||||
|
|
|
@ -96,7 +96,8 @@
|
|||
"uuid": "^8.3.2",
|
||||
"winston": "^3.6.0",
|
||||
"winston-daily-rotate-file": "^4.7.1",
|
||||
"yargs": "^17.3.1"
|
||||
"yargs": "^17.3.1",
|
||||
"tough-cookie": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ant-design/icons": "^4.7.0",
|
||||
|
|
|
@ -112,6 +112,9 @@ dependencies:
|
|||
toad-scheduler:
|
||||
specifier: ^1.6.0
|
||||
version: 1.6.1
|
||||
tough-cookie:
|
||||
specifier: ^4.0.0
|
||||
version: 4.0.0
|
||||
typedi:
|
||||
specifier: ^0.10.0
|
||||
version: 0.10.0
|
||||
|
@ -12635,6 +12638,10 @@ packages:
|
|||
resolution: {integrity: sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==}
|
||||
dev: true
|
||||
|
||||
/psl@1.9.0:
|
||||
resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==}
|
||||
dev: false
|
||||
|
||||
/pstree.remy@1.1.8:
|
||||
resolution: {integrity: sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==}
|
||||
|
||||
|
@ -12665,7 +12672,6 @@ packages:
|
|||
/punycode@2.3.0:
|
||||
resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==}
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/qiankun@2.10.8:
|
||||
resolution: {integrity: sha512-5w6QeM1INFavJdIWfSoDIVv2InV8MEojauvY5tY9Biu8hhE5Rml/HM2t/Y60kZcuOpgy/HGX+tcc6NkQuzDoCg==}
|
||||
|
@ -15424,6 +15430,15 @@ packages:
|
|||
nopt: 1.0.10
|
||||
dev: true
|
||||
|
||||
/tough-cookie@4.0.0:
|
||||
resolution: {integrity: sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==}
|
||||
engines: {node: '>=6'}
|
||||
dependencies:
|
||||
psl: 1.9.0
|
||||
punycode: 2.3.0
|
||||
universalify: 0.1.2
|
||||
dev: false
|
||||
|
||||
/tr46@0.0.3:
|
||||
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
|
||||
dev: false
|
||||
|
@ -15755,7 +15770,6 @@ packages:
|
|||
/universalify@0.1.2:
|
||||
resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==}
|
||||
engines: {node: '>= 4.0.0'}
|
||||
dev: true
|
||||
|
||||
/universalify@2.0.0:
|
||||
resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
const querystring = require('querystring');
|
||||
const got = require('got');
|
||||
const $ = new Env();
|
||||
const timeout = 15000;// 超时时间(单位毫秒)
|
||||
const timeout = 15000; // 超时时间(单位毫秒)
|
||||
// =======================================gotify通知设置区域==============================================
|
||||
// gotify_url 填写gotify地址,如https://push.example.de:8080
|
||||
// gotify_token 填写gotify的消息应用token
|
||||
|
@ -27,7 +27,7 @@ let GOTIFY_PRIORITY = 0;
|
|||
// gobot_qq 填写推送到个人QQ或者QQ群号
|
||||
// go-cqhttp相关API https://docs.go-cqhttp.org/api
|
||||
let GOBOT_URL = ''; // 推送到个人QQ: http://127.0.0.1/send_private_msg 群:http://127.0.0.1/send_group_msg
|
||||
let GOBOT_TOKEN = '';// 访问密钥
|
||||
let GOBOT_TOKEN = ''; // 访问密钥
|
||||
let GOBOT_QQ = ''; // 如果GOBOT_URL设置 /send_private_msg 则需要填入 user_id=个人QQ 相反如果是 /send_group_msg 则需要填入 group_id=QQ群
|
||||
|
||||
// =======================================微信server酱通知设置区域===========================================
|
||||
|
@ -69,9 +69,9 @@ let TG_BOT_TOKEN = '';
|
|||
// (环境变量名 TG_USER_ID)
|
||||
let TG_USER_ID = '';
|
||||
// tg推送HTTP代理设置(不懂可忽略,telegram机器人通知推送功能中非必填)
|
||||
let TG_PROXY_HOST = '';// 例如:127.0.0.1(环境变量名:TG_PROXY_HOST)
|
||||
let TG_PROXY_PORT = '';// 例如:1080(环境变量名:TG_PROXY_PORT)
|
||||
let TG_PROXY_AUTH = '';// tg代理配置认证参数
|
||||
let TG_PROXY_HOST = ''; // 例如:127.0.0.1(环境变量名:TG_PROXY_HOST)
|
||||
let TG_PROXY_PORT = ''; // 例如:1080(环境变量名:TG_PROXY_PORT)
|
||||
let TG_PROXY_AUTH = ''; // tg代理配置认证参数
|
||||
// Telegram api自建的反向代理地址(不懂可忽略,telegram机器人通知推送功能中非必填),默认tg官方api(环境变量名:TG_API_HOST)
|
||||
let TG_API_HOST = 'https://api.telegram.org';
|
||||
// =======================================钉钉机器人通知设置区域===========================================
|
||||
|
@ -157,7 +157,7 @@ let PUSHME_KEY = '';
|
|||
// CHRONOCAT_QQ 个人:user_id=个人QQ 群则填入group_id=QQ群 多个用英文;隔开同时支持个人和群
|
||||
// CHRONOCAT相关API https://chronocat.vercel.app/install/docker/official/
|
||||
let CHRONOCAT_URL = ''; // CHRONOCAT Red协议连接地址
|
||||
let CHRONOCAT_TOKEN = '';// CHRONOCAT 生成的访问密钥
|
||||
let CHRONOCAT_TOKEN = ''; // CHRONOCAT 生成的访问密钥
|
||||
let CHRONOCAT_QQ = ''; // 个人:user_id=个人QQ 群则填入group_id=QQ群 多个用英文;隔开同时支持个人和群 如:user_id=xxx;group_id=xxxx;group_id=xxxxx
|
||||
|
||||
// =======================================自定义通知设置区域=======================================
|
||||
|
@ -219,7 +219,7 @@ if (process.env.BARK_PUSH) {
|
|||
process.env.BARK_PUSH.indexOf('https') > -1 ||
|
||||
process.env.BARK_PUSH.indexOf('http') > -1
|
||||
) {
|
||||
// 兼容BARK自建用户
|
||||
// 兼容BARK自建用户
|
||||
BARK_PUSH = process.env.BARK_PUSH;
|
||||
} else {
|
||||
BARK_PUSH = `https://api.day.app/${process.env.BARK_PUSH}`;
|
||||
|
@ -245,7 +245,7 @@ if (process.env.BARK_PUSH) {
|
|||
BARK_PUSH.indexOf('https') === -1 &&
|
||||
BARK_PUSH.indexOf('http') === -1
|
||||
) {
|
||||
// 兼容BARK本地用户只填写设备码的情况
|
||||
// 兼容BARK本地用户只填写设备码的情况
|
||||
BARK_PUSH = `https://api.day.app/${BARK_PUSH}`;
|
||||
}
|
||||
}
|
||||
|
@ -366,8 +366,8 @@ async function sendNotify(
|
|||
params = {},
|
||||
author = '\n\n本通知 By:https://github.com/whyour/qinglong',
|
||||
) {
|
||||
// 提供6种通知
|
||||
desp += author;// 增加作者信息,防止被贩卖等
|
||||
// 提供6种通知
|
||||
desp += author; // 增加作者信息,防止被贩卖等
|
||||
|
||||
// 根据标题跳过一些消息推送,环境变量:SKIP_PUSH_TITLE 用回车分隔
|
||||
let skipTitle = process.env.SKIP_PUSH_TITLE;
|
||||
|
@ -379,28 +379,28 @@ async function sendNotify(
|
|||
}
|
||||
|
||||
await Promise.all([
|
||||
serverNotify(text, desp),// 微信server酱
|
||||
pushPlusNotify(text, desp),// pushplus(推送加)
|
||||
serverNotify(text, desp), // 微信server酱
|
||||
pushPlusNotify(text, desp), // pushplus(推送加)
|
||||
]);
|
||||
// 由于上述两种微信通知需点击进去才能查看到详情,故text(标题内容)携带了账号序号以及昵称信息,方便不点击也可知道是哪个京东哪个活动
|
||||
// 由于上述两种微信通知需点击进去才能查看到详情,故text(标题内容)携带了账号序号以及昵称信息,方便不点击也可知道是哪个京东哪个活动
|
||||
text = text.match(/.*?(?=\s?-)/g) ? text.match(/.*?(?=\s?-)/g)[0] : text;
|
||||
await Promise.all([
|
||||
BarkNotify(text, desp, params),// iOS Bark APP
|
||||
tgBotNotify(text, desp),// telegram 机器人
|
||||
ddBotNotify(text, desp),// 钉钉机器人
|
||||
qywxBotNotify(text, desp),// 企业微信机器人
|
||||
qywxamNotify(text, desp),// 企业微信应用消息推送
|
||||
iGotNotify(text, desp, params),// iGot
|
||||
gobotNotify(text, desp),// go-cqhttp
|
||||
gotifyNotify(text, desp),// gotify
|
||||
ChatNotify(text, desp),// synolog chat
|
||||
PushDeerNotify(text, desp),// PushDeer
|
||||
aibotkNotify(text, desp),// 智能微秘书
|
||||
fsBotNotify(text, desp),// 飞书机器人
|
||||
smtpNotify(text, desp),// SMTP 邮件
|
||||
pushMeNotify(text, desp, params),// PushMe
|
||||
BarkNotify(text, desp, params), // iOS Bark APP
|
||||
tgBotNotify(text, desp), // telegram 机器人
|
||||
ddBotNotify(text, desp), // 钉钉机器人
|
||||
qywxBotNotify(text, desp), // 企业微信机器人
|
||||
qywxamNotify(text, desp), // 企业微信应用消息推送
|
||||
iGotNotify(text, desp, params), // iGot
|
||||
gobotNotify(text, desp), // go-cqhttp
|
||||
gotifyNotify(text, desp), // gotify
|
||||
ChatNotify(text, desp), // synolog chat
|
||||
PushDeerNotify(text, desp), // PushDeer
|
||||
aibotkNotify(text, desp), // 智能微秘书
|
||||
fsBotNotify(text, desp), // 飞书机器人
|
||||
smtpNotify(text, desp), // SMTP 邮件
|
||||
pushMeNotify(text, desp, params), // PushMe
|
||||
chronocatNotify(text, desp), // Chronocat
|
||||
webhookNotify(text, desp),// 自定义通知
|
||||
webhookNotify(text, desp), // 自定义通知
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -482,7 +482,7 @@ function gobotNotify(text, desp) {
|
|||
function serverNotify(text, desp) {
|
||||
return new Promise((resolve) => {
|
||||
if (SCKEY) {
|
||||
// 微信server酱推送通知一个\n不会换行,需要两个\n才能换行,故做此替换
|
||||
// 微信server酱推送通知一个\n不会换行,需要两个\n才能换行,故做此替换
|
||||
desp = desp.replace(/[\n\r]/g, '\n\n');
|
||||
const options = {
|
||||
url: SCKEY.includes('SCT')
|
||||
|
@ -501,7 +501,7 @@ function serverNotify(text, desp) {
|
|||
console.log(err);
|
||||
} else {
|
||||
data = JSON.parse(data);
|
||||
// server酱和Server酱·Turbo版的返回json格式不太一样
|
||||
// server酱和Server酱·Turbo版的返回json格式不太一样
|
||||
if (data.errno === 0 || data.data.errno === 0) {
|
||||
console.log('server酱发送通知消息成功🎉\n');
|
||||
} else if (data.errno === 1024) {
|
||||
|
@ -657,15 +657,19 @@ function tgBotNotify(text, desp) {
|
|||
timeout,
|
||||
};
|
||||
if (TG_PROXY_HOST && TG_PROXY_PORT) {
|
||||
const tunnel = require('tunnel');
|
||||
const { HttpProxyAgent, HttpsProxyAgent } = require('hpagent');
|
||||
const options = {
|
||||
keepAlive: true,
|
||||
keepAliveMsecs: 1000,
|
||||
maxSockets: 256,
|
||||
maxFreeSockets: 256,
|
||||
proxy: `http://${TG_PROXY_AUTH}${TG_PROXY_HOST}:${TG_PROXY_PORT}`,
|
||||
};
|
||||
const httpAgent = new HttpProxyAgent(options);
|
||||
const httpsAgent = new HttpsProxyAgent(options);
|
||||
const agent = {
|
||||
https: tunnel.httpsOverHttp({
|
||||
proxy: {
|
||||
host: TG_PROXY_HOST,
|
||||
port: TG_PROXY_PORT * 1,
|
||||
proxyAuth: TG_PROXY_AUTH,
|
||||
},
|
||||
}),
|
||||
http: httpAgent,
|
||||
https: httpsAgent,
|
||||
};
|
||||
Object.assign(options, { agent });
|
||||
}
|
||||
|
@ -885,7 +889,7 @@ function qywxamNotify(text, desp) {
|
|||
};
|
||||
}
|
||||
if (!QYWX_AM_AY[4]) {
|
||||
// 如不提供第四个参数,则默认进行文本消息类型推送
|
||||
// 如不提供第四个参数,则默认进行文本消息类型推送
|
||||
options = {
|
||||
msgtype: 'text',
|
||||
text: {
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"name": "dependence",
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"got": "^11.5.1",
|
||||
"nodemailer": "^6.8.0",
|
||||
"tough-cookie": "^4.0.0",
|
||||
"tunnel": "0.0.6",
|
||||
"ws": "^7.4.3"
|
||||
}
|
||||
}
|
|
@ -9,9 +9,6 @@ reset_env() {
|
|||
npm_install_2 $dir_root
|
||||
echo -e "---> 青龙依赖安装完成\n"
|
||||
|
||||
echo -e "---> 3. 开始安装脚本依赖\n"
|
||||
cp -f $dir_sample/package.json $dir_scripts/package.json
|
||||
npm_install_2 $dir_scripts
|
||||
echo -e "---> 脚本依赖安装完成\n"
|
||||
}
|
||||
|
||||
|
|
|
@ -300,11 +300,6 @@ update_qinglong_static() {
|
|||
|
||||
check_update_dep() {
|
||||
echo -e "\n开始检测依赖...\n"
|
||||
if [[ ! -s $dir_scripts/package.json ]] || [[ $(diff $dir_sample/package.json $dir_scripts/package.json) ]]; then
|
||||
cp -f $dir_sample/package.json $dir_scripts/package.json
|
||||
npm_install_2 $dir_scripts
|
||||
fi
|
||||
|
||||
if [[ $(diff $dir_root/package.json ${dir_tmp}/qinglong-${primary_branch}/package.json) ]]; then
|
||||
npm_install_2 "${dir_tmp}/qinglong-${primary_branch}"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue
Block a user