mirror of
https://github.com/whyour/qinglong.git
synced 2026-08-10 11:24:33 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6485e6b420 | |||
| 82ce0173a8 | |||
| 7412a201f4 | |||
| 073de76a4a | |||
| c61d1aa828 |
+1
-1
@@ -130,7 +130,7 @@ export default (app: Router) => {
|
|||||||
originFilename: Joi.string().optional().allow(''),
|
originFilename: Joi.string().optional().allow(''),
|
||||||
directory: Joi.string().optional().allow(''),
|
directory: Joi.string().optional().allow(''),
|
||||||
file: Joi.string().optional().allow(''),
|
file: Joi.string().optional().allow(''),
|
||||||
}),
|
}).unknown(true),
|
||||||
}),
|
}),
|
||||||
async (req: Request, res: Response, next: NextFunction) => {
|
async (req: Request, res: Response, next: NextFunction) => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
+20
-4
@@ -482,9 +482,13 @@ function tgBotNotify(text, desp) {
|
|||||||
timeout,
|
timeout,
|
||||||
};
|
};
|
||||||
if (TG_PROXY_HOST && TG_PROXY_PORT) {
|
if (TG_PROXY_HOST && TG_PROXY_PORT) {
|
||||||
|
let proxyHost = TG_PROXY_HOST;
|
||||||
|
if (TG_PROXY_AUTH && !TG_PROXY_HOST.includes('@')) {
|
||||||
|
proxyHost = `${TG_PROXY_AUTH}@${TG_PROXY_HOST}`;
|
||||||
|
}
|
||||||
let agent;
|
let agent;
|
||||||
agent = new ProxyAgent({
|
agent = new ProxyAgent({
|
||||||
uri: `http://${TG_PROXY_AUTH}${TG_PROXY_HOST}:${TG_PROXY_PORT}`,
|
uri: `http://${proxyHost}:${TG_PROXY_PORT}`,
|
||||||
});
|
});
|
||||||
options.dispatcher = agent;
|
options.dispatcher = agent;
|
||||||
}
|
}
|
||||||
@@ -992,7 +996,10 @@ function fsBotNotify(text, desp) {
|
|||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const { FSKEY, FSSECRET } = push_config;
|
const { FSKEY, FSSECRET } = push_config;
|
||||||
if (FSKEY) {
|
if (FSKEY) {
|
||||||
const body = { msg_type: 'text', content: { text: `${text}\n\n${desp}` } };
|
const body = {
|
||||||
|
msg_type: 'text',
|
||||||
|
content: { text: `${text}\n\n${desp}` },
|
||||||
|
};
|
||||||
|
|
||||||
// Add signature if secret is provided
|
// Add signature if secret is provided
|
||||||
// Note: Feishu's signature algorithm uses timestamp+"\n"+secret as the HMAC key
|
// Note: Feishu's signature algorithm uses timestamp+"\n"+secret as the HMAC key
|
||||||
@@ -1278,7 +1285,15 @@ function ntfyNotify(text, desp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const { NTFY_URL, NTFY_TOPIC, NTFY_PRIORITY, NTFY_TOKEN, NTFY_USERNAME, NTFY_PASSWORD, NTFY_ACTIONS } = push_config;
|
const {
|
||||||
|
NTFY_URL,
|
||||||
|
NTFY_TOPIC,
|
||||||
|
NTFY_PRIORITY,
|
||||||
|
NTFY_TOKEN,
|
||||||
|
NTFY_USERNAME,
|
||||||
|
NTFY_PASSWORD,
|
||||||
|
NTFY_ACTIONS,
|
||||||
|
} = push_config;
|
||||||
if (NTFY_TOPIC) {
|
if (NTFY_TOPIC) {
|
||||||
const options = {
|
const options = {
|
||||||
url: `${NTFY_URL || 'https://ntfy.sh'}/${NTFY_TOPIC}`,
|
url: `${NTFY_URL || 'https://ntfy.sh'}/${NTFY_TOPIC}`,
|
||||||
@@ -1293,7 +1308,8 @@ function ntfyNotify(text, desp) {
|
|||||||
if (NTFY_TOKEN) {
|
if (NTFY_TOKEN) {
|
||||||
options.headers['Authorization'] = `Bearer ${NTFY_TOKEN}`;
|
options.headers['Authorization'] = `Bearer ${NTFY_TOKEN}`;
|
||||||
} else if (NTFY_USERNAME && NTFY_PASSWORD) {
|
} else if (NTFY_USERNAME && NTFY_PASSWORD) {
|
||||||
options.headers['Authorization'] = `Basic ${Buffer.from(`${NTFY_USERNAME}:${NTFY_PASSWORD}`).toString('base64')}`;
|
options.headers['Authorization'] =
|
||||||
|
`Basic ${Buffer.from(`${NTFY_USERNAME}:${NTFY_PASSWORD}`).toString('base64')}`;
|
||||||
}
|
}
|
||||||
if (NTFY_ACTIONS) {
|
if (NTFY_ACTIONS) {
|
||||||
options.headers['Actions'] = encodeRFC2047(NTFY_ACTIONS);
|
options.headers['Actions'] = encodeRFC2047(NTFY_ACTIONS);
|
||||||
|
|||||||
Reference in New Issue
Block a user