commit
c8dc8d3c13
@ -9,6 +9,7 @@
|
||||
- [x] [钉钉群机器人 DingTalk](https://open.dingtalk.com/document/robots/custom-robot-access)
|
||||
- [x] [飞书群机器人 Feishu](https://open.feishu.cn/document/ukTMukTMukTM/ucTM5YjL3ETO24yNxkjN)
|
||||
- [x] [企业微信群机器人 WeCom](https://developer.work.weixin.qq.com/document/path/91770)
|
||||
- [x] [next-smtp-proxy](https://github.com/0wQ/next-smtp-proxy)
|
||||
- [x] 基站定位
|
||||
- [x] 定时查询流量
|
||||
- [x] 开机通知
|
||||
|
@ -1,5 +1,5 @@
|
||||
return {
|
||||
-- 通知类型 telegram, pushdeer, bark, dingtalk, feishu, wecom
|
||||
-- 通知类型 telegram, pushdeer, bark, dingtalk, feishu, wecom, next-smtp-proxy
|
||||
NOTIFY_TYPE = "pushdeer",
|
||||
--
|
||||
-- telegram 通知配置, https://github.com/0wQ/telegram-notify
|
||||
@ -24,6 +24,16 @@ return {
|
||||
-- wecom 通知配置, https://developer.work.weixin.qq.com/document/path/91770
|
||||
WECOM_WEBHOOK = "",
|
||||
--
|
||||
-- next-smtp-proxy 通知配置, https://github.com/0wQ/next-smtp-proxy
|
||||
NEXT_SMTP_PROXY_API = "",
|
||||
NEXT_SMTP_PROXY_USER = "",
|
||||
NEXT_SMTP_PROXY_PASSWORD = "",
|
||||
NEXT_SMTP_PROXY_HOST = "smtp-mail.outlook.com",
|
||||
NEXT_SMTP_PROXY_PORT = 587,
|
||||
NEXT_SMTP_PROXY_FORM_NAME = "Air780E",
|
||||
NEXT_SMTP_PROXY_TO_EMAIL = "",
|
||||
NEXT_SMTP_PROXY_SUBJECT = "来自 Air780E 的通知",
|
||||
--
|
||||
-- 定时查询流量间隔, 单位毫秒, 设置为 0 关闭
|
||||
QUERY_TRAFFIC_INTERVAL = 1000 * 60 * 60 * 6,
|
||||
--
|
||||
|
@ -147,6 +147,51 @@ local function notifyToWeCom(msg)
|
||||
return http.request("POST", config.WECOM_WEBHOOK, header, json_data).wait()
|
||||
end
|
||||
|
||||
-- 发送到 next-smtp-proxy
|
||||
local function notifyToNextSmtpProxy(msg)
|
||||
if config.NEXT_SMTP_PROXY_API == nil or config.NEXT_SMTP_PROXY_API == "" then
|
||||
log.error("util_notify.notifyToNextSmtpProxy", "未配置 `config.NEXT_SMTP_PROXY_API`")
|
||||
return
|
||||
end
|
||||
if config.NEXT_SMTP_PROXY_USER == nil or config.NEXT_SMTP_PROXY_USER == "" then
|
||||
log.error("util_notify.notifyToNextSmtpProxy", "未配置 `config.NEXT_SMTP_PROXY_USER`")
|
||||
return
|
||||
end
|
||||
if config.NEXT_SMTP_PROXY_PASSWORD == nil or config.NEXT_SMTP_PROXY_PASSWORD == "" then
|
||||
log.error("util_notify.notifyToNextSmtpProxy", "未配置 `config.NEXT_SMTP_PROXY_PASSWORD`")
|
||||
return
|
||||
end
|
||||
if config.NEXT_SMTP_PROXY_HOST == nil or config.NEXT_SMTP_PROXY_HOST == "" then
|
||||
log.error("util_notify.notifyToNextSmtpProxy", "未配置 `config.NEXT_SMTP_PROXY_HOST`")
|
||||
return
|
||||
end
|
||||
if config.NEXT_SMTP_PROXY_PORT == nil or config.NEXT_SMTP_PROXY_PORT == "" then
|
||||
log.error("util_notify.notifyToNextSmtpProxy", "未配置 `config.NEXT_SMTP_PROXY_PORT`")
|
||||
return
|
||||
end
|
||||
if config.NEXT_SMTP_PROXY_TO_EMAIL == nil or config.NEXT_SMTP_PROXY_TO_EMAIL == "" then
|
||||
log.error("util_notify.notifyToNextSmtpProxy", "未配置 `config.NEXT_SMTP_PROXY_TO_EMAIL`")
|
||||
return
|
||||
end
|
||||
|
||||
local header = {
|
||||
["Content-Type"] = "application/x-www-form-urlencoded"
|
||||
}
|
||||
local body = {
|
||||
user = config.NEXT_SMTP_PROXY_USER,
|
||||
password = config.NEXT_SMTP_PROXY_PASSWORD,
|
||||
host = config.NEXT_SMTP_PROXY_HOST,
|
||||
port = config.NEXT_SMTP_PROXY_PORT,
|
||||
form_name = config.NEXT_SMTP_PROXY_FORM_NAME,
|
||||
to_email = config.NEXT_SMTP_PROXY_TO_EMAIL,
|
||||
subject = config.NEXT_SMTP_PROXY_SUBJECT,
|
||||
text = msg
|
||||
}
|
||||
|
||||
log.info("util_notify.notifyToNextSmtpProxy", "POST", config.NEXT_SMTP_PROXY_API, urlencodeTab(body))
|
||||
return http.request("POST", config.NEXT_SMTP_PROXY_API, header, urlencodeTab(body)).wait()
|
||||
end
|
||||
|
||||
function util_notify.send(msg)
|
||||
log.info("util_notify.send", "发送通知", config.NOTIFY_TYPE)
|
||||
|
||||
@ -199,6 +244,8 @@ function util_notify.send(msg)
|
||||
notify = notifyToFeishu
|
||||
elseif config.NOTIFY_TYPE == "wecom" then
|
||||
notify = notifyToWeCom
|
||||
elseif config.NOTIFY_TYPE == "next-smtp-proxy" then
|
||||
notify = notifyToNextSmtpProxy
|
||||
else
|
||||
log.error("util_notify.send", "发送通知失败", "未配置 `config.NOTIFY_TYPE`")
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user