update 2026-07-28 01:38:11

This commit is contained in:
action committed 2026-07-28 01:38:11 +08:00
1 parent 20b786ab77
commit 25d570431d
6243 files changed
+2850542

No files matched your search

@@ -0,0 +1,11 @@
config wechatpush "config"
option enable '0'
option sleeptime '60'
option debuglevel '1'
option up_timeout '2'
option down_timeout '10'
option timeout_retry_count '2'
option thread_num '3'
option tg_api_server 'https://api.telegram.org'
option tg_chat_id ''
+38
View File
@@ -0,0 +1,38 @@
#!/bin/sh /etc/rc.common
START=99
STOP=90
USE_PROCD=1
dir="/tmp/wechatpush/"
start_service() {
procd_open_instance
enable_value=$(uci get wechatpush.config.enable 2>/dev/null || echo "0")
[ "$enable_value" -ne "0" ] && procd_set_param command /usr/share/wechatpush/wechatpush && echo "wechatpush is starting now ..."
procd_close_instance
}
reload_service() {
stop
sleep 1
start
}
stop_service() {
[ -f ${dir}child_pid ] && parent_pid=$(cat ${dir}child_pid)
[ -n "$parent_pid" ] && {
child_pids=$(pgrep -P $parent_pid)
echo "Terminating child processes of wechatpush..."
for child_pid in $child_pids; do
kill $child_pid
done
}
local pids=$(ps | grep "wechatpush" | grep -v grep | grep -v $$ | awk '{print $1}')
[ -n "$pids" ] && echo "$pids" | xargs kill 2>/dev/null
echo "Terminating wechatpush process..."
}
service_triggers() {
procd_add_reload_trigger wechatpush
}
+15
View File
@@ -0,0 +1,15 @@
#!/bin/sh
function get_config_wechatpush(){
while [[ "$*" != "" ]]; do
eval ${1}='`uci get wechatpush.config.$1`' 2>/dev/null
uci del wechatpush.config.$1 2>/dev/null
uci commit wechatpush
shift
done
}
get_config_wechatpush "chat_id"
[ -n "$chat_id" ] && uci set wechatpush.config.tg_chat_id="$chat_id"
rm -rf /tmp/luci-* >/dev/null 2>&1
+96
View File
@@ -0,0 +1,96 @@
#!/bin/sh
logfile="/tmp/wechatpush/wechatpush.log"
dir="/tmp/wechatpush" && mkdir -p "${dir}"
oui_base="${dir}/oui_base.txt"
oui_data=$(uci get wechatpush.config.oui_data 2>/dev/null)
oui_url="https://standards-oui.ieee.org/oui/oui.txt"
lang=$(uci get luci.main.lang 2>/dev/null)
if [ -z "$lang" ] || [[ "$lang" == "auto" ]]; then
lang=$(echo "${LANG:-${LANGUAGE:-${LC_ALL:-${LC_MESSAGES:-zh_cn}}}}" | awk -F'[ .@]' '{print tolower($1)}' | sed 's/-/_/' 2>/dev/null)
fi
translate() {
# 处理特殊字符
local lua_script=$(cat <<LUA
require "luci.i18n".setlanguage("$lang")
print(require "luci.i18n".translate([==[$1]==]))
LUA
)
lua -e "$lua_script"
}
# 获取文件最后修改时间和行数
file_date() {
local file_dir="$1"
local filerow=$(grep -c "" "${file_dir}" 2>/dev/null || echo "0")
local datetime=$(date -r "${file_dir}" +%s 2>/dev/null || echo "0")
expr $(date +%s) - ${datetime}
}
# 下载
download_file() {
url=$1
output_file=$2
retries=2
retval=1
# 尝试使用 curl 下载
i=0
while [ $i -lt $retries ]; do
curl -fsSL --connect-timeout 15 --max-time 30 -o "${output_file}" "${url}" >/dev/null 2>&1
retval=$?
if [ $retval -eq 0 ]; then
return 0
fi
i=$((i + 1))
sleep 1 # 等待1秒后重试
done
# 如果 curl 失败,尝试使用 wget 下载
i=0
while [ $i -lt $retries ]; do
wget --no-check-certificate -T 15 -O "${output_file}" "${url}" >/dev/null 2>&1
retval=$?
if [ $retval -eq 0 ]; then
return 0
fi
i=$((i + 1))
sleep 1 # 等待1秒后重试
done
return $retval
}
# 更新 MAC 信息文件
down_oui() {
if [ -n "${oui_data}" ] && [ "${oui_data}" -ne "3" ]; then
echo "$(date "+%Y-%m-%d %H:%M:%S") [INFO] $(translate "Starting background update of MAC information file")" >>"${logfile}"
download_file "${oui_url}" "${dir}/oui.txt"
local RETVAL=$?
[ ${RETVAL} -ne 0 ] && echo "$(date "+%Y-%m-%d %H:%M:%S") [ERROR] $(translate "Failed to download MAC information file, return code: ${RETVAL}")" >>"${logfile}" && return 1
echo "$(date "+%Y-%m-%d %H:%M:%S") [INFO] $(translate "MAC information file downloaded successfully, processing...")" >>"${logfile}"
if [ "${oui_data}" -eq "1" ]; then
grep -i -E ".*(base 16).*(apple|aruba|asus|autelan|belkin|bhu|buffalo|cctf|cisco|comba|datang|dell|dlink|dowell|ericsson|fast|feixun|fiberhome|fujitsu|grentech|h3c|hisense|hiwifi|honghai|honghao|hp|htc|huawei|intel|jinli|jse|lenovo|lg|liteon|malata|meizu|mercury|meru|moto|netcore|netgear|nokia|omron|oneplus|oppo|philips|router_unkown|samsung|shanzhai|sony|start_net|sunyuanda|tcl|tenda|texas|tianyu|tp-link|ubq|undefine|VMware|utstarcom|volans|xerox|xiaomi|zdc|zhongxing|smartisan).*" "${dir}/oui.txt" | sed -E 's/( Electronic| Technology| Intelligence| TECHNOLOGIES| Device| Systems| TELECOMMUNICATIONS| Instruments| Electronics| Corporation| Telecommunication| Communications| Electrical| Technology| Corporate| Intelligent| Interactive| MOBILE| Solutions| Mobility| Meraki| ELECTRO| VISUAL| Limited| International| Information| LLC|Co$|Co\.|Ltd\.$|Inc\.|B\.V\.$|AB$|,).*$/ /I; s/[[:space:]]*$//; s/ +$//' >"${oui_base}"
elif [ "${oui_data}" -eq "2" ]; then
grep -i "(base 16)" "${dir}/oui.txt" | sed -E 's/( Electronic| Technology| Intelligence| TECHNOLOGIES| Device| Systems| TELECOMMUNICATIONS| Instruments| Electronics| Corporation| Telecommunication| Communications| Electrical| Technology| Corporate| Intelligent| Interactive| MOBILE| Solutions| Mobility| Meraki| ELECTRO| VISUAL| Limited| International| Information| LLC|Co$|Co\.|Ltd\.$|Inc\.|B\.V\.$|AB$|,).*$/ /I; s/[[:space:]]*$//; s/ +$//' >"${oui_base}"
fi
rm -f "${dir}/oui.txt" >/dev/null 2>&1
echo "$(date "+%Y-%m-%d %H:%M:%S") [INFO] $(translate "MAC information file processing completed")" >>"${logfile}"
fi
}
if [ "$1" == "clear_log" ]; then
# 清空日志
>"${logfile}"
elif [ "$1" == "down_oui" ]; then
# 更新 MAC 信息列表
[ $(file_date "$oui_base") -lt 604800 ] && echo "$(date "+%Y-%m-%d %H:%M:%S") [INFO] $(translate "MAC information file does not need updating")" >>"${logfile}" && exit 2
down_oui >/dev/null 2>&1 &
elif [ "$1" == "child" ]; then
shift
command_name=$1
shift
"$command_name" "$@"
fi
@@ -0,0 +1,50 @@
{
"admin/services/wechatpush": {
"title": "WeChat push",
"order": 30,
"action": {
"type": "view",
"path": "wechatpush/status"
},
"depends": {
"acl": [ "luci-app-wechatpush" ],
"uci": { "wechatpush": true }
}
},
"admin/services/wechatpush/config": {
"title": "Basic Settings",
"order": 10,
"action": {
"type": "view",
"path": "wechatpush/config"
}
},
"admin/services/wechatpush/advanced": {
"title": "Advance Setting",
"order": 20,
"action": {
"type": "view",
"path": "wechatpush/advanced"
}
},
"admin/services/wechatpush/client": {
"title": "Online Devices",
"order": 30,
"action": {
"type": "view",
"path": "wechatpush/client"
}
},
"admin/services/wechatpush/log": {
"title": "Log",
"order": 40,
"action": {
"type": "view",
"path": "wechatpush/log"
}
}
}
@@ -0,0 +1,26 @@
{
"luci-app-wechatpush": {
"description": "Grant UCI access for luci-app-wechatpush",
"read": {
"file": {
"/etc/init.d/wechatpush": [ "exec" ],
"/proc/net/arp": [ "read" ],
"/usr/share/wechatpush/wechatpush": [ "exec" ],
"/tmp/wechatpush/*": [ "read" ],
"/usr/share/wechatpush/api/*": [ "read" ],
"/usr/libexec/wechatpush-call": [ "exec" ]
},
"ubus": {
"service": [ "list" ]
},
"uci": [ "wechatpush" ]
},
"write": {
"file": {
"/usr/share/wechatpush/api/*": [ "write" ],
"/tmp/wechatpush/*": [ "write" ]
},
"uci": [ "wechatpush" ]
}
}
}
@@ -0,0 +1,3 @@
# Examples :
#XX:XX:XX:XX:XX:XX My Phone
#192.168.1.2 My PC
@@ -0,0 +1,42 @@
{
"_//": "-------------------------------------------------------------------------------",
"_readme": "这是 自定义 api 文件,这里以 telegram 为例",
"_readme": "特殊符号请使用斜杠转义,变量使用 ${var} 表示",
"_//": "-------------------------------------------------------------------------------",
"_api": "【DIY 推送】",
"_url": "api 地址",
"_data": "生成的 json 文件路径,一般不需要改,如 api 不支持 json,请参考 serverchan 推送接口",
"_content_type": "post 内容类型,这里为 json",
"_//": "-------------------------------------------------------------------------------",
"_str_title_start": "标题粗体字开始符号",
"_str_title_end": "标题粗体字结束符号",
"_str_linefeed": "换行符号",
"_str_splitline": "换行+分隔符",
"_str_space": "空格",
"_str_tab": "TAB(用在行首,生成文字区块)",
"_//": "-------------------------------------------------------------------------------",
"_type":
{
"_readme": "下文中,text 为 telegram 推送需要的键值名称,参见 telegram 官方文档,后面的内容为生成标题所需要的字符串和变量,${1} 为标题内容变量,${nowtime} 为推送时间,${2} 为推送内容变量",
"_readme": "下文中,chat_id 为 telegram 推送需要的键值名称,参见 telegram 官方文档,${tg_chat_id} 为从脚本配置中读取名为 tg_chat_id 的变量,其实就是你填写的机器人的 chat_id ",
"_readme": "type 对象因为需要转义变量,前后必须使用 斜杠+双引号 转义",
"_readme": "参照上文说明,填写下文相关参数"
},
"_//": "-------------------------------------------------------------------------------",
"url": "${tg_api_server}/bot${tg_token}/sendMessage",
"data": "@${tempjsonpath}",
"content_type": "Content-Type: application/json",
"str_title_start": "<b>",
"str_title_end": "</b>",
"str_linefeed": "\\n",
"str_splitline": "\\n----\\n",
"str_space": " ",
"str_tab": " ",
"type":
{
"text":"\"${str_title_start}${1}${str_title_end}${str_splitline}${nowtime}${2}\"",
"chat_id":"\"${tg_chat_id}\"",
"parse_mode":"\"HTML\""
}
}
@@ -0,0 +1,3 @@
https://ip.rss.ink/v1/qqwry?ip=${ip} | jq -r '.data.area'
ip.plus/${ip} | sed -n 's/.*来自: //p'
http://ip-api.com/json/${ip}?lang=zh-CN | jq -r '"\(.country) \(.regionName) \(.city)"'
Whitespace-only changes.
@@ -0,0 +1,8 @@
ddns.oray.com/checkip
www.net.cn/static/customercare/yourip.asp
ip.3322.net
ip.threep.top
ip.atomo.cn
ip.ddnspod.com
4.ipw.cn
ipv4.ip.mir6.com
@@ -0,0 +1,6 @@
speed.neu6.edu.cn/getIP.php
6.ipw.cn
ip.atomo.cn
ip.ddnspod.com
v6.ip.zxinc.org/getip
ipv6.ip.mir6.com
Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

@@ -0,0 +1,21 @@
{
"_api": "这是 msmtp api 文件",
"_api": "【msmtp】",
"url": "msmtp --host=${smtp_host} --port=${smtp_port} ${smtp_tls:+--tls=$smtp_tls} ${smtp_starttls:+--tls-starttls=$smtp_starttls} ${smtp_user:+--auth=on --user=$smtp_user} ${smtp_passwordeval:+--passwordeval=\\\"$smtp_passwordeval\\\"} ${smtp_from:+--from=$smtp_from} ${smtp_from_full_name:+-F\\\"$smtp_from_full_name\\\"} ${recipient_email}",
"data": "${tempjsonpath}",
"content_type": "",
"command": "'\"To: \\(.to)\\nSubject: \\(.subject)\\nContent-Type: text/html\\n\\n\\(.body)\"'",
"str_title_start": "<br><h3 style=\\\"margin: 0em 0em;\\\">",
"str_title_end": "</h3>",
"str_linefeed": "<br>",
"str_splitline": "<br><br><hr>",
"str_space": " ",
"str_tab": " ",
"type":
{
"to":"\"${recipient_email}\"",
"subject":"\"${1}\"",
"body":"\"${nowtime}${2}\""
}
}
@@ -0,0 +1,21 @@
{
"_api": "这是 pushplus api 文件",
"_api": "【pushplus】",
"url": "http://www.pushplus.plus/send",
"data": "@${tempjsonpath}",
"content_type": "Content-Type: application/json",
"str_title_start": "##### ",
"str_title_end": "",
"str_linefeed": "\\n",
"str_splitline": "\\n----\\n",
"str_space": " ",
"str_tab": " ",
"type":
{
"title": "\"${1}\"",
"content": "\"${2}\"",
"token": "\"${pushplus_token}\"",
"template":"\"markdown\""
}
}
@@ -0,0 +1,23 @@
{
"_api": "这是企业微信 markdown 模板信息 api 文件",
"_api": "【企业微信】",
"url": "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$(curl -s \"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=${corpid}&corpsecret=${corpsecret}\"|jq '.access_token' | sed 's/\"//g')",
"data": "@${tempjsonpath}",
"content_type": "Content-Type: application/json",
"str_title_start": "#### ",
"str_title_end": "",
"str_linefeed": "\\n",
"str_splitline": "\\n\\n",
"str_space": " ",
"str_tab": "> ",
"type":
{
"touser": "\"${userid}\"",
"msgtype": "\"markdown\"",
"agentid": "\"${agentid}\"",
"markdown": {
"content": "\"${1}${str_linefeed}${nowtime}${2}\""
}
}
}
@@ -0,0 +1,33 @@
{
"_api": "这是企业微信图文信息 api 文件",
"_api": "【企业微信】",
"url": "\"https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$(curl -s \"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=${corpid}&corpsecret=${corpsecret}\"|jq '.access_token'|sed 's/\"//g')\"",
"data": "@${tempjsonpath}",
"content_type": "Content-Type: application/json",
"str_title_start": "<b>",
"str_title_end": "</b>",
"str_linefeed": "<br>",
"str_splitline": "<hr>",
"str_space": " ",
"str_tab": "",
"type":
{
"touser": "\"${userid}\"",
"msgtype": "\"mpnews\"",
"agentid": "\"${agentid}\"",
"mpnews":{
"articles":[
{
"title": "\"${1} ${nowtime}\"",
"thumb_media_id": "\"`curl \"https://qyapi.weixin.qq.com/cgi-bin/media/upload?access_token=$(curl -s \"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=${corpid}&corpsecret=${corpsecret}\"|jq '.access_token'|sed 's/\"//g')&type=image\" -F \"file=@${mediapath}\"|jq '.media_id'|sed 's/\"//g'`\"",
"author": "\"\"",
"content_source_url": "\"\"",
"content": "\"${2}\"",
"digest": "\"\""
}
]
},
"safe":0
}
}
@@ -0,0 +1,17 @@
{
"_api": "这是 serverchan api 文件",
"_api": "【serverchan】",
"url": "\"https://sctapi.ftqq.com/${sckey}.send\"",
"data": "\"text=${1}&desp=${nowtime}${str_linefeed}${2}\"",
"content_type": "Content-Type:application/x-www-form-urlencoded",
"str_title_start": "#### ",
"str_title_end": "",
"str_linefeed": "%0D%0A%0D%0A",
"str_splitline": "%0D%0A%0D%0A----%0D%0A%0D%0A",
"str_space": " ",
"str_tab": " ",
"type":
{
}
}
@@ -0,0 +1,20 @@
{
"_api": "这是 serverchan3 api 文件",
"_api": "【serverchan3】",
"url": "\"https://${sc3uid}.push.ft07.com/send/${sc3key}.send\"",
"data": "@${tempjsonpath}",
"content_type": "Content-Type: application/json",
"str_title_start": "##### ",
"str_title_end": "",
"str_linefeed": " \\n",
"str_splitline": "\\n----\\n",
"str_space": " ",
"str_tab": " ",
"type":
{
"title": "\"${1}\"",
"desp": "\"${nowtime}${str_linefeed}${2}\"",
"tags": "\"${sc3tags}\""
}
}
@@ -0,0 +1,21 @@
{
"_api": "这是 telegram api 文件",
"_api": "【telegram】",
"url": "${tg_api_server}/bot${tg_token}/sendMessage",
"data": "@${tempjsonpath}",
"content_type": "Content-Type: application/json",
"str_title_start": "<b>",
"str_title_end": "</b>",
"str_linefeed": "\\n",
"str_splitline": "\\n----\\n",
"str_space": " ",
"str_tab": "\\t",
"type":
{
"text":"\"${str_title_start}${1}${str_title_end}${str_splitline}${nowtime}${2}\"",
"chat_id":"\"${tg_chat_id}\"",
"message_thread_id":"\"${tg_thread_id}\"",
"parse_mode":"\"HTML\""
}
}
@@ -0,0 +1,23 @@
{
"_api": "这是 wxpusher api 文件",
"_api": "【wxpusher】",
"url": "http://wxpusher.zjiecode.com/api/send/message",
"data": "@${tempjsonpath}",
"content_type": "Content-Type: application/json",
"str_title_start": "#### ",
"str_title_end": "",
"str_linefeed": "\\n",
"str_splitline": "\\n----\\n",
"str_space": " ",
"str_tab": " ",
"type":
{
"summary":"\"${1}\"",
"content":"\"${2}\"",
"appToken":"\"${wxpusher_apptoken}\"",
"topicIds":"[\"${wxpusher_topicIds}\"]",
"uids":"[\"${wxpusher_uids}\"]",
"contentType":3
}
}
File diff suppressed because it is too large. Load diff