修改环境变量名与程序变量名一致

This commit is contained in:
beanjs 2024-09-28 14:36:55 +08:00
parent de08c873b0
commit 36e1f231c6
3 changed files with 98 additions and 98 deletions

View File

@ -33,18 +33,18 @@ export class GotifyNotification extends NotificationBaseInfo {
}
export class GoCqHttpBotNotification extends NotificationBaseInfo {
public goCqHttpBotUrl = '';
public goCqHttpBotToken = '';
public goCqHttpBotQq = '';
public gobotUrl = '';
public gobotToken = '';
public gobotQq = '';
}
export class ServerChanNotification extends NotificationBaseInfo {
public serverChanKey = '';
public pushKey = '';
}
export class PushDeerNotification extends NotificationBaseInfo {
public pushDeerKey = '';
public pushDeerUrl = '';
public deerKey = '';
public deerUrl = '';
}
export class ChatNotification extends NotificationBaseInfo {
@ -63,27 +63,27 @@ export class BarkNotification extends NotificationBaseInfo {
}
export class TelegramBotNotification extends NotificationBaseInfo {
public telegramBotToken = '';
public telegramBotUserId = '';
public telegramBotProxyHost = '';
public telegramBotProxyPort = '';
public telegramBotProxyAuth = '';
public telegramBotApiHost = 'https://api.telegram.org';
public tgBotToken = '';
public tgUserId = '';
public tgProxyHost = '';
public tgProxyPort = '';
public tgProxyAuth = '';
public tgApiHost = 'https://api.telegram.org';
}
export class DingtalkBotNotification extends NotificationBaseInfo {
public dingtalkBotToken = '';
public dingtalkBotSecret = '';
public ddBotToken = '';
public ddBotSecret = '';
}
export class WeWorkBotNotification extends NotificationBaseInfo {
public weWorkBotKey = '';
public weWorkOrigin = '';
public qywxKey = '';
public qywxOrigin = '';
}
export class WeWorkAppNotification extends NotificationBaseInfo {
public weWorkAppKey = '';
public weWorkOrigin = '';
public qywxKey = '';
public qywxOrigin = '';
}
export class AibotkNotification extends NotificationBaseInfo {
@ -93,7 +93,7 @@ export class AibotkNotification extends NotificationBaseInfo {
}
export class IGotNotification extends NotificationBaseInfo {
public iGotPushKey = '';
public igotPushKey = '';
}
export class PushPlusNotification extends NotificationBaseInfo {
@ -108,14 +108,14 @@ export class WePlusBotNotification extends NotificationBaseInfo {
}
export class EmailNotification extends NotificationBaseInfo {
public emailService: string = '';
public emailUser: string = '';
public emailPass: string = '';
public smtpService: string = '';
public smtpName: string = '';
public smtpPassword: string = '';
}
export class PushMeNotification extends NotificationBaseInfo {
public pushMeKey: string = '';
public pushMeUrl: string = '';
public pushmeKey: string = '';
public pushmeUrl: string = '';
}
export class ChronocatNotification extends NotificationBaseInfo {
@ -136,7 +136,7 @@ export class WebhookNotification extends NotificationBaseInfo {
}
export class LarkNotification extends NotificationBaseInfo {
public larkKey = '';
public fskey = '';
}
export interface NotificationInfo

View File

@ -130,13 +130,13 @@ export default class NotificationService {
}
private async goCqHttpBot() {
const { goCqHttpBotQq, goCqHttpBotToken, goCqHttpBotUrl } = this.params;
const { gobotQq, gobotToken, gobotUrl } = this.params;
try {
const res: any = await got
.post(`${goCqHttpBotUrl}?${goCqHttpBotQq}`, {
.post(`${gobotUrl}?${gobotQq}`, {
...this.gotOption,
json: { message: `${this.title}\n${this.content}` },
headers: { Authorization: 'Bearer ' + goCqHttpBotToken },
headers: { Authorization: 'Bearer ' + gobotToken },
})
.json();
if (res.retcode === 0) {
@ -150,10 +150,10 @@ export default class NotificationService {
}
private async serverChan() {
const { serverChanKey } = this.params;
const url = serverChanKey.startsWith('SCT')
? `https://sctapi.ftqq.com/${serverChanKey}.send`
: `https://sc.ftqq.com/${serverChanKey}.send`;
const { pushKey } = this.params;
const url = pushKey.startsWith('SCT')
? `https://sctapi.ftqq.com/${pushKey}.send`
: `https://sc.ftqq.com/${pushKey}.send`;
try {
const res: any = await got
.post(url, {
@ -173,13 +173,13 @@ export default class NotificationService {
}
private async pushDeer() {
const { pushDeerKey, pushDeerUrl } = this.params;
const url = pushDeerUrl || `https://api2.pushdeer.com/message/push`;
const { deerKey, deerUrl } = this.params;
const url = deerUrl || `https://api2.pushdeer.com/message/push`;
try {
const res: any = await got
.post(url, {
...this.gotOption,
body: `pushkey=${pushDeerKey}&text=${encodeURIComponent(
body: `pushkey=${deerKey}&text=${encodeURIComponent(
this.title,
)}&desp=${encodeURIComponent(this.content)}&type=markdown`,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
@ -263,25 +263,25 @@ export default class NotificationService {
private async telegramBot() {
const {
telegramBotApiHost,
telegramBotProxyAuth,
telegramBotProxyHost,
telegramBotProxyPort,
telegramBotToken,
telegramBotUserId,
tgApiHost,
tgProxyAuth,
tgProxyHost,
tgProxyPort,
tgBotToken,
tgUserId,
} = this.params;
const authStr = telegramBotProxyAuth ? `${telegramBotProxyAuth}@` : '';
const authStr = tgProxyAuth ? `${tgProxyAuth}@` : '';
const url = `${
telegramBotApiHost ? telegramBotApiHost : 'https://api.telegram.org'
}/bot${telegramBotToken}/sendMessage`;
tgApiHost ? tgApiHost : 'https://api.telegram.org'
}/bot${tgBotToken}/sendMessage`;
let agent;
if (telegramBotProxyHost && telegramBotProxyPort) {
if (tgProxyHost && tgProxyPort) {
const options: any = {
keepAlive: true,
keepAliveMsecs: 1000,
maxSockets: 256,
maxFreeSockets: 256,
proxy: `http://${authStr}${telegramBotProxyHost}:${telegramBotProxyPort}`,
proxy: `http://${authStr}${tgProxyHost}:${tgProxyPort}`,
};
const httpAgent = new HttpProxyAgent(options);
const httpsAgent = new HttpsProxyAgent(options);
@ -294,7 +294,7 @@ export default class NotificationService {
const res: any = await got
.post(url, {
...this.gotOption,
body: `chat_id=${telegramBotUserId}&text=${this.title}\n\n${this.content}&disable_web_page_preview=true`,
body: `chat_id=${tgUserId}&text=${this.title}\n\n${this.content}&disable_web_page_preview=true`,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
agent,
})
@ -310,16 +310,16 @@ export default class NotificationService {
}
private async dingtalkBot() {
const { dingtalkBotSecret, dingtalkBotToken } = this.params;
const { ddBotSecret, ddBotToken } = this.params;
let secretParam = '';
if (dingtalkBotSecret) {
if (ddBotSecret) {
const dateNow = Date.now();
const hmac = crypto.createHmac('sha256', dingtalkBotSecret);
hmac.update(`${dateNow}\n${dingtalkBotSecret}`);
const hmac = crypto.createHmac('sha256', ddBotSecret);
hmac.update(`${dateNow}\n${ddBotSecret}`);
const result = encodeURIComponent(hmac.digest('base64'));
secretParam = `&timestamp=${dateNow}&sign=${result}`;
}
const url = `https://oapi.dingtalk.com/robot/send?access_token=${dingtalkBotToken}${secretParam}`;
const url = `https://oapi.dingtalk.com/robot/send?access_token=${ddBotToken}${secretParam}`;
try {
const res: any = await got
.post(url, {
@ -343,9 +343,9 @@ export default class NotificationService {
}
private async weWorkBot() {
const { weWorkBotKey, weWorkOrigin = 'https://qyapi.weixin.qq.com' } =
const { qywxKey, qywxOrigin = 'https://qyapi.weixin.qq.com' } =
this.params;
const url = `${weWorkOrigin}/cgi-bin/webhook/send?key=${weWorkBotKey}`;
const url = `${qywxOrigin}/cgi-bin/webhook/send?key=${qywxKey}`;
try {
const res: any = await got
.post(url, {
@ -369,11 +369,11 @@ export default class NotificationService {
}
private async weWorkApp() {
const { weWorkAppKey, weWorkOrigin = 'https://qyapi.weixin.qq.com' } =
const { qywxKey, qywxOrigin = 'https://qyapi.weixin.qq.com' } =
this.params;
const [corpid, corpsecret, touser, agentid, thumb_media_id = '1'] =
weWorkAppKey.split(',');
const url = `${weWorkOrigin}/cgi-bin/gettoken`;
qywxKey.split(',');
const url = `${qywxOrigin}/cgi-bin/gettoken`;
const tokenRes: any = await got
.post(url, {
...this.gotOption,
@ -425,7 +425,7 @@ export default class NotificationService {
try {
const res: any = await got
.post(
`${weWorkOrigin}/cgi-bin/message/send?access_token=${tokenRes.access_token}`,
`${qywxOrigin}/cgi-bin/message/send?access_token=${tokenRes.access_token}`,
{
...this.gotOption,
json: {
@ -497,8 +497,8 @@ export default class NotificationService {
}
private async iGot() {
const { iGotPushKey } = this.params;
const url = `https://push.hellyw.com/${iGotPushKey.toLowerCase()}`;
const { igotPushKey } = this.params;
const url = `https://push.hellyw.com/${igotPushKey.toLowerCase()}`;
try {
const res: any = await got
.post(url, {
@ -581,15 +581,15 @@ export default class NotificationService {
}
private async lark() {
let { larkKey } = this.params;
let { fskey } = this.params;
if (!larkKey.startsWith('http')) {
larkKey = `https://open.feishu.cn/open-apis/bot/v2/hook/${larkKey}`;
if (!fskey.startsWith('http')) {
fskey = `https://open.feishu.cn/open-apis/bot/v2/hook/${fskey}`;
}
try {
const res: any = await got
.post(larkKey, {
.post(fskey, {
...this.gotOption,
json: {
msg_type: 'text',
@ -609,20 +609,20 @@ export default class NotificationService {
}
private async email() {
const { emailPass, emailService, emailUser } = this.params;
const { smtpPassword, smtpService, smtpName } = this.params;
try {
const transporter = nodemailer.createTransport({
service: emailService,
service: smtpService,
auth: {
user: emailUser,
pass: emailPass,
user: smtpName,
pass: smtpPassword,
},
});
const info = await transporter.sendMail({
from: `"青龙快讯" <${emailUser}>`,
to: `${emailUser}`,
from: `"青龙快讯" <${smtpName}>`,
to: `${smtpName}`,
subject: `${this.title}`,
html: `${this.content.replace(/\n/g, '<br/>')}`,
});
@ -640,12 +640,12 @@ export default class NotificationService {
}
private async pushMe() {
const { pushMeKey, pushMeUrl } = this.params;
const { pushmeKey, pushmeUrl } = this.params;
try {
const res: any = await got.post(pushMeUrl || 'https://push.i-i.me/', {
const res: any = await got.post(pushmeUrl || 'https://push.i-i.me/', {
...this.gotOption,
json: {
push_key: pushMeKey,
push_key: pushmeKey,
title: this.title,
content: this.content,
},

View File

@ -128,15 +128,15 @@ export default {
],
goCqHttpBot: [
{
label: 'goCqHttpBotUrl',
label: 'gobotUrl',
tip: intl.get(
'推送到个人QQ: http://127.0.0.1/send_private_msghttp://127.0.0.1/send_group_msg',
),
required: true,
},
{ label: 'goCqHttpBotToken', tip: intl.get('访问密钥'), required: true },
{ label: 'gobotToken', tip: intl.get('访问密钥'), required: true },
{
label: 'goCqHttpBotQq',
label: 'gobotQq',
tip: intl.get(
'如果GOBOT_URL设置 /send_private_msg 则需要填入 user_id=个人QQ 相反如果是 /send_group_msg 则需要填入 group_id=QQ群',
),
@ -145,19 +145,19 @@ export default {
],
serverChan: [
{
label: 'serverChanKey',
label: 'pushKey',
tip: intl.get('Server酱SENDKEY'),
required: true,
},
],
pushDeer: [
{
label: 'pushDeerKey',
label: 'deerKey',
tip: intl.get('PushDeer的Keyhttps://github.com/easychen/pushdeer'),
required: true,
},
{
label: 'pushDeerUrl',
label: 'deerUrl',
tip: intl.get(
'PushDeer的自架API endpoint默认是 https://api2.pushdeer.com/message/push',
),
@ -198,40 +198,40 @@ export default {
],
telegramBot: [
{
label: 'telegramBotToken',
label: 'tgBotToken',
tip: intl.get(
'telegram机器人的token例如1077xxx4424:AAFjv0FcqxxxxxxgEMGfi22B4yh15R5uw',
),
required: true,
},
{
label: 'telegramBotUserId',
label: 'tgUserId',
tip: intl.get('telegram用户的id例如129xxx206'),
required: true,
},
{ label: 'telegramBotProxyHost', tip: intl.get('代理IP') },
{ label: 'telegramBotProxyPort', tip: intl.get('代理端口') },
{ label: 'tgProxyHost', tip: intl.get('代理IP') },
{ label: 'tgProxyPort', tip: intl.get('代理端口') },
{
label: 'telegramBotProxyAuth',
label: 'tgProxyAuth',
tip: intl.get(
'telegram代理配置认证参数用户名与密码用英文冒号连接 user:password',
),
},
{
label: 'telegramBotApiHost',
label: 'tgApiHost',
tip: intl.get('telegram api自建的反向代理地址默认tg官方api'),
},
],
dingtalkBot: [
{
label: 'dingtalkBotToken',
label: 'ddBotToken',
tip: intl.get(
'钉钉机器人webhook token例如5a544165465465645d0f31dca676e7bd07415asdasd',
),
required: true,
},
{
label: 'dingtalkBotSecret',
label: 'ddBotSecret',
tip: intl.get(
'密钥机器人安全设置页面加签一栏下面显示的SEC开头的字符串',
),
@ -239,27 +239,27 @@ export default {
],
weWorkBot: [
{
label: 'weWorkBotKey',
label: 'qywxKey',
tip: intl.get(
'企业微信机器人的webhook(详见文档 https://work.weixin.qq.com/api/doc/90000/90136/91770)例如693a91f6-7xxx-4bc4-97a0-0ec2sifa5aaa',
),
required: true,
},
{
label: 'weWorkOrigin',
label: 'qywxOrigin',
tip: intl.get('企业微信代理地址'),
},
],
weWorkApp: [
{
label: 'weWorkAppKey',
label: 'qywxKey',
tip: intl.get(
'corpid、corpsecret、touser(注:多个成员ID使用|隔开)、agentid、消息类型(选填,不填默认文本消息类型) 注意用,号隔开(英文输入法的逗号)例如wwcfrs,B-76WERQ,qinglong,1000001,2COat',
),
required: true,
},
{
label: 'weWorkOrigin',
label: 'qywxOrigin',
tip: intl.get('企业微信代理地址'),
},
],
@ -291,7 +291,7 @@ export default {
],
iGot: [
{
label: 'iGotPushKey',
label: 'igotPushKey',
tip: intl.get(
'iGot的信息推送key例如https://push.hellyw.com/XXXXXXXX',
),
@ -336,7 +336,7 @@ export default {
],
lark: [
{
label: 'larkKey',
label: 'fskey',
tip: intl.get(
'飞书群组机器人https://www.feishu.cn/hc/zh-CN/articles/360024984973',
),
@ -345,23 +345,23 @@ export default {
],
email: [
{
label: 'emailService',
label: 'smtpService',
tip: intl.get(
'邮箱服务名称比如126、163、Gmail、QQ等支持列表https://github.com/nodemailer/nodemailer/blob/master/lib/well-known/services.json',
),
required: true,
},
{ label: 'emailUser', tip: intl.get('邮箱地址'), required: true },
{ label: 'emailPass', tip: intl.get('SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定'), required: true },
{ label: 'smtpName', tip: intl.get('邮箱地址'), required: true },
{ label: 'smtpPassword', tip: intl.get('SMTP 登录密码,也可能为特殊口令,视具体邮件服务商说明而定'), required: true },
],
pushMe: [
{
label: 'pushMeKey',
label: 'pushmeKey',
tip: intl.get('PushMe的Keyhttps://push.i-i.me/'),
required: true,
},
{
label: 'pushMeUrl',
label: 'pushmeUrl',
tip: intl.get('自建的PushMeServer消息接口地址例如http://127.0.0.1:3010不填则使用官方消息接口'),
required: false,
},