update 2023-11-02 23:36:08

This commit is contained in:
github-actions[bot] 2023-11-02 23:36:08 +08:00
parent eaf6496190
commit a4815a698c
13 changed files with 169 additions and 52 deletions

View File

@ -9,9 +9,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/firewall4.git
PKG_SOURCE_DATE:=2023-03-23
PKG_SOURCE_VERSION:=04a06bd70b9808b14444cae81a2faba4708ee231
PKG_MIRROR_HASH:=37c34facb733c50d0fdbfa238765a23e667e4daaae9728aaccbaba87a2a07bb9
PKG_SOURCE_DATE:=2023-09-01
PKG_SOURCE_VERSION:=598d9fbb5179667aa0c525040eaa41bc7f2dc015
PKG_MIRROR_HASH:=038b5b5611425e3c0fcc3ef4a0aea37296733300766d787909a689d16d4f39b4
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
PKG_LICENSE:=ISC

View File

@ -16,7 +16,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-amlogic
PKG_VERSION:=3.1.208
PKG_VERSION:=3.1.209
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0 License

View File

@ -46,6 +46,14 @@ case $MYDEVICE_NAME in
fi
SOC="beikeyun"
;;
"ZCuble1 Max")
if [ -n "${CURRENT_FDTFILE}" ]; then
MYDTB_FDTFILE="${CURRENT_FDTFILE}"
else
MYDTB_FDTFILE="rk3399-zcube1-max.dtb"
fi
SOC="zcube1 max"
;;
"Radxa CM3 RPI CM4 IO")
if [ -n "${CURRENT_FDTFILE}" ]; then
MYDTB_FDTFILE="${CURRENT_FDTFILE}"
@ -86,7 +94,15 @@ case $MYDEVICE_NAME in
fi
SOC="photonicat"
;;
"Watermelon Pi")
"NLnet Watermelon Pi V3")
if [ -n "${CURRENT_FDTFILE}" ]; then
MYDTB_FDTFILE="${CURRENT_FDTFILE}"
else
MYDTB_FDTFILE="rk3568-watermelon-pi-v3.dtb"
fi
SOC="watermelon-pi-v3"
;;
"NLnet Watermelon Pi")
if [ -n "${CURRENT_FDTFILE}" ]; then
MYDTB_FDTFILE="${CURRENT_FDTFILE}"
else

View File

@ -180,6 +180,12 @@ return view.extend({
o.depends('jsonpath', '/usr/share/wechatpush/api/qywx_mpnews.json');
o.description = _('Supports JPG and PNG formats within 2MB <br> Optimal size: 900383 or 2.35:1');
o = s.taboption('basic', form.Value, 'proxy_ip', _('Trusted IP address'));
o.rmempty = false;
o.depends('jsonpath', '/usr/share/wechatpush/api/qywx_mpnews.json');
o.depends('jsonpath', '/usr/share/wechatpush/api/qywx_markdown.json');
o.description = _('If the application was created after June 20, 2022, you need to set the trusted IP. This option should be used in conjunction with a proxy server.');
o = s.taboption('basic', form.Value, 'wxpusher_apptoken', _('appToken'));
o.description = _('Get Instructions') + ' <a href="https://wxpusher.zjiecode.com/docs/#/?id=%e5%bf%ab%e9%80%9f%e6%8e%a5%e5%85%a5" target="_blank">' + _('Click here') + '</a>';
o.rmempty = false;
@ -225,7 +231,9 @@ return view.extend({
};
o.description = _('Please refer to the comments and other interface files for modifications. Limited resources, no longer supporting more interfaces, please debug on your own.<br />You can use a similar website to check the JSON file format: https://www.google.com/search?q=JSON+Parser+Online<br />Please use the 「Save」 button in the text box.');
o.depends('jsonpath', '/usr/share/wechatpush/api/diy.json');
o = s.taboption('basic', form.Value, 'proxy_address', _('Proxy Address'));
o.description = _('When you want to use a proxy to push information, you can use this option.<br/>This may be helpful for scenarios like trusted IPs for WeChat Work.Using special characters may cause sending failure.<br/>Example:<br/>http://username:password@127.0.0.1:1080<br/>socks5://username:password@127.0.0.1:1080');
o = s.taboption('basic', form.Button, '_test', _('Send Test'), _('You may need to save the configuration before sending.'));
o.inputstyle = 'add';
@ -448,6 +456,7 @@ return view.extend({
}
return 'Please enter a numeric value only';
};
o.description = _('In general, when the load value is lower than the number of logical cores, you typically don\'t need to pay much attention to it');
o = s.taboption('content', form.Value, 'temperature_threshold', _('Temperature alert threshold'));
o.rmempty = false;
@ -679,6 +688,18 @@ return view.extend({
o.datatype = 'list(neg(macaddr))';
o.depends('mac_filtering_mode_2', 'mac_offline');
o = s.taboption('disturb', form.Value, 'cpu_threshold_duration', _('When CPU temperature or load exceeds the threshold continuously for (s) seconds.'));
o.rmempty = false;
o.placeholder = '300';
o.datatype = 'and(uinteger)';
o.description = _('If set to 0, it\'s a single check without considering duration.');
o = s.taboption('disturb', form.Value, 'cpu_notification_delay', _('CPU alarm quiet time (seconds)'));
o.rmempty = false;
o.placeholder = '3600';
o.datatype = 'and(uinteger)';
o.description = _('No repeat notifications within the set time after the initial push notification.');
o = s.taboption('disturb', cbiRichListValue, 'login_disturb', _('Do Not Disturb for Login Reminders'));
o.value('', _('Close'),
_(' '));

View File

@ -150,6 +150,14 @@ msgstr "图片缩略图文件路径"
msgid "Supports JPG and PNG formats within 2MB <br> Optimal size: 900383 or 2.35:1"
msgstr "只支持 2MB 以内 JPG、PNG 格式<br>最佳尺寸900383 或 2.35:1"
#: applications/luci-app-wechatpush/htdocs/luci-static/resources/view/wechatpush/config.js:183
msgid "Trusted IP address"
msgstr "可信 IP 地址"
#: applications/luci-app-wechatpush/htdocs/luci-static/resources/view/wechatpush/config.js:187
msgid "If the application was created after June 20, 2022, you need to set the trusted IP. This option should be used in conjunction with a proxy server."
msgstr "如果是 2022 年 6 月 20 日之后新创建的应用,需设置可信 IP该选项需配合代理服务器使用"
#: applications/luci-app-wechatpush/htdocs/luci-static/resources/view/wechatpush/config.js:192
msgid "topicIds(Mass sending)"
msgstr "topicIds(群发)"
@ -174,6 +182,14 @@ msgstr "<br />如需通过群组/频道推送,请创建一个非中文的群
msgid "Please refer to the comments and other interface files for modifications. Limited resources, no longer supporting more interfaces, please debug on your own.<br />You can use a similar website to check the JSON file format: https://www.google.com/search?q=JSON+Parser+Online<br />Please use the 「Save」 button in the text box."
msgstr "请参照注释和其他接口文件修改,精力有限,不再支持更多接口,自行调试<br />请参考类似网站检查 JSON 文件格式https://www.baidu.com/s?wd=json在线解析<br />文本框请使用「保存」按钮"
#: applications/luci-app-wechatpush/htdocs/luci-static/resources/view/wechatpush/config.js:229
msgid "Proxy Address"
msgstr "代理地址"
#: applications/luci-app-wechatpush/htdocs/luci-static/resources/view/wechatpush/config.js:230
msgid "When you want to use a proxy to push information, you can use this option.<br/>This may be helpful for scenarios like trusted IPs for WeChat Work.Using special characters may cause sending failure.<br/>Example:<br/>http://username:password@127.0.0.1:1080<br/>socks5://username:password@127.0.0.1:1080"
msgstr "当你想要使用代理推送信息时,可以使用这个选项<br/>可能有助于企业微信可信 IP 等情况,默认为空,使用特殊符号可能会造成发送失败<br/>例子:<br/>http://username:password@127.0.0.1:1080<br/>socks5://username:password@127.0.0.1:1080"
#: applications/luci-app-wechatpush/htdocs/luci-static/resources/view/wechatpush/config.js:230
msgid "Send Test"
msgstr "发送测试"
@ -203,6 +219,10 @@ msgstr "发送失败"
msgid "Unknown error: %s."
msgstr "未知错误:%s"
#: applications/luci-app-wechatpush/htdocs/luci-static/resources/view/wechatpush/config.js:248
msgid "Device Name"
msgstr "设备名称"
#: applications/luci-app-wechatpush/htdocs/luci-static/resources/view/wechatpush/config.js:249
msgid "The device name will be displayed in the push message title to identify the source device of the message."
msgstr "在推送信息标题中会标识本设备名称,用于区分推送信息的来源设备"
@ -380,6 +400,10 @@ msgstr "设备报警只会在连续五分钟超过设定值时才会推送,一
msgid "Load alert threshold"
msgstr "负载报警阈值"
#: applications/luci-app-wechatpush/htdocs/luci-static/resources/view/wechatpush/config.js:451
msgid "In general, when the load value is lower than the number of logical cores, you typically don\'t need to pay much attention to it"
msgstr "通常情况下,负载值低于逻辑核心数量时,你不需要关注它"
#: applications/luci-app-wechatpush/htdocs/luci-static/resources/view/wechatpush/config.js:433
msgid "Please enter a numeric value only"
msgstr "请输入纯数字"
@ -684,6 +708,22 @@ msgstr "设备在线免打扰列表"
msgid "Do Not Disturb device offline list"
msgstr "设备离线免打扰列表"
#: applications/luci-app-wechatpush/htdocs/luci-static/resources/view/wechatpush/config.js:682
msgid "When CPU temperature or load exceeds the threshold continuously for (s) seconds."
msgstr "当 CPU 温度或负载超过阈值持续超过(秒)"
#: applications/luci-app-wechatpush/htdocs/luci-static/resources/view/wechatpush/config.js:686
msgid "If set to 0, it\'s a single check without considering duration."
msgstr "如果设置为 0则为单次检测不考虑持续时间"
#: applications/luci-app-wechatpush/htdocs/luci-static/resources/view/wechatpush/config.js:688
msgid "CPU alarm quiet time (seconds)"
msgstr "CPU 报警免打扰时间(秒)"
#: applications/luci-app-wechatpush/htdocs/luci-static/resources/view/wechatpush/config.js:692
msgid "No repeat notifications within the set time after the initial push notification."
msgstr "首次推送通知后,在设定时间内不再重复提醒"
#: applications/luci-app-wechatpush/htdocs/luci-static/resources/view/wechatpush/config.js:667
msgid "Do Not Disturb for Login Reminders"
msgstr "登录提醒免打扰"

View File

@ -168,6 +168,9 @@ serverchan_to_wechatpush_get \
"unattended_enable" "zerotier_helper" "unattended_only_on_disturb_time" "unattended_device_aliases" "network_disconnect_event" "unattended_autoreboot_mode" "autoreboot_system_uptime" "autoreboot_network_uptime" \
"gateway_info_enable" "gateway_host_url" "gateway_info_url" "gateway_logout_url" "gateway_username_id" "gateway_password_id" "gateway_username" "gateway_password" "gateway_sleeptime"
uci set wechatpush.config.cpu_threshold_duration='300'
uci set wechatpush.config.cpu_notification_delay='3600'
uci commit wechatpush
rm -rf "$serverchan_config" 2>/dev/null
dir="/tmp/wechatpush/" && mkdir -p ${dir}

View File

@ -1,2 +1,3 @@
curl -s cip.cc/${ip} | sed -n 's/地址[[:space:]]*:[[:space:]]*\(.*\)/\1/p'
curl -s https://ip.rss.ink/v1/qqwry?ip=${ip} | jq -r '.data.area'
cip.cc/${ip} | sed -n 's/地址[[:space:]]*:[[:space:]]*\(.*\)/\1/p'
https://ip.rss.ink/v1/qqwry?ip=${ip} | jq -r '.data.area'
ip.plus/${ip} | sed -n 's/.*来自: //p'

View File

@ -31,14 +31,14 @@ wait_and_cat() {
# 初始化设置信息
function read_config(){
get_config \
"enable" "lite_enable" "device_name" "sleeptime" "oui_data" "reset_regularly" "debuglevel" \
"enable" "lite_enable" "device_name" "proxy_address" "sleeptime" "oui_data" "reset_regularly" "debuglevel" \
"jsonpath" "sckey" "corpid" "userid" "agentid" "corpsecret" "mediapath" "wxpusher_apptoken" "wxpusher_uids" "wxpusher_topicIds" "pushplus_token" "tg_token" "chat_id" \
"get_ipv4_mode" "ipv4_interface" "get_ipv6_mode" "ipv6_interface" "auto_update_ip_list" \
"device_notification" "cpu_notification" "cpu_load_threshold" "temperature_threshold" \
"client_usage" "client_usage_max" "client_usage_disturb" "client_usage_whitelist" \
"login_notification" "login_max_num" "login_web_black" "login_ip_black_timeout" "login_ip_white_list" "port_knocking_enable" "login_ip_white_timeout" "login_port_white" "login_port_forward_list" \
"crontab_regular_time" "crontab_interval_time" \
"do_not_disturb_mode" "do_not_disturb_starttime" "do_not_disturb_endtime" "up_down_push_whitelist" "up_down_push_blacklist" "up_down_push_interface" "mac_online_list" "mac_offline_list" "login_disturb" "login_notification_delay" "login_log_enable" \
"do_not_disturb_mode" "do_not_disturb_starttime" "do_not_disturb_endtime" "up_down_push_whitelist" "up_down_push_blacklist" "up_down_push_interface" "mac_online_list" "mac_offline_list" "cpu_threshold_duration" "cpu_notification_delay" "login_disturb" "login_notification_delay" "login_log_enable" \
"up_timeout" "down_timeout" "timeout_retry_count" "only_timeout_push" "passive_mode" "thread_num" "soc_code" "server_host" "server_port" \
"unattended_enable" "zerotier_helper" "unattended_only_on_disturb_time" "unattended_device_aliases" "network_disconnect_event" "unattended_autoreboot_mode" "autoreboot_system_uptime" "autoreboot_network_uptime" \
"device_info_helper" "gateway_host_url" "gateway_info_url" "gateway_logout_url" "gateway_username_id" "gateway_password_id" "gateway_username" "gateway_password" "scan_ip_range" "device_info_helper_sleeptime"
@ -80,6 +80,7 @@ function read_config(){
[ -z "$login_ip_white_timeout" ] && login_ip_white_timeout="600"
[ "$iw_version" ] && wlan_interface=`iw dev 2>/dev/null|grep Interface|awk '{print $2}'` >/dev/null 2>&1
[ -z "$server_port" ] && server_port="22"
cpu_notification_delay=$((${cpu_notification_delay} - ${cpu_threshold_duration}))
output_dir="${dir}json_output"
mkdir -p "$output_dir"
if ( echo "$lite_enable"|grep -q "content" ); then
@ -144,18 +145,24 @@ function diy_send(){
local content_type=`jq -r '.content_type' ${3}`
! jq "$type" ${3} > ${tempjsonpath} && echo "`date "+%Y-%m-%d %H:%M:%S"` 【】type:{ } 字段转义变量后格式错误,请检查 type:{ } 字段内是否有特殊符号未转义或语法错误" >> ${logfile} && return 1
[ $4 ] && echo '{"url":"'${diyurl}'","content_type":"'${content_type}'","type":'`jq "$type" ${3}`'}' > ${dir}debug_send_json
[ $4 ] && echo -e "${send_title}" "${send_content}" > ${dir}debug_send_content
[ $4 ] && cat ${tempjsonpath} > ${dir}debug_send_data
[ $4 ] && ! jq -r '.' ${dir}debug_send_json && echo "`date "+%Y-%m-%d %H:%M:%S"` 【!!!】转义变量后格式错误,请检查 ${dir}debug_send_json 字段内是否有特殊符号未转义或语法错误" >> ${logfile}
[ $4 ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【debug】json 文件已保存至:${dir}debug_send_json" >> ${logfile}
[ $4 ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【debug】推送内容预览文件保存至${dir}debug_send_content" >> ${logfile}
[ $4 ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【debug】如果收不到信息请检查 ${dir}debug_send_data 文件,或使用下列命令手动测试返回值 (可能需要关闭日志自动刷新方便选中)" >> ${logfile}
[ $4 ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【debug】"'curl -X POST -H "'$content_type'" -d "@'${dir}debug_send_data'" "'${diyurl}'" ' >> ${logfile}
curl --connect-timeout 30 -m 60 -X POST -H "$content_type" -d "$data" "${diyurl}"
[ -n "$proxy_address" ] && local proxy_cmd="-x $proxy_address"
curl $proxy_cmd --connect-timeout 30 -m 60 --retry 1 -X POST -H "$content_type" -d "$data" "${diyurl}"
local RETVAL=$?
[ $RETVAL -ne "0" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【!!!】网络错误或 URL 错误推送失败curl 返回值为 ${RETVAL}" >> ${logfile} && return 1 || return 0
if [ -n "$4" ] || [ $RETVAL -ne 0 ]; then
echo "`date "+%Y-%m-%d %H:%M:%S"` 【!!!】网络错误或 URL 错误推送失败curl 返回值为 ${RETVAL},请参考如下调试信息进行排查" >> ${logfile}
echo '{"url":"'${diyurl}'","content_type":"'${content_type}'","type":'`jq "$type" ${3}`'}' > ${dir}debug_send_json
echo -e "${send_title}" "${send_content}" > ${dir}debug_send_content
cat ${tempjsonpath} > ${dir}debug_send_data
! jq -r '.' ${dir}debug_send_json && echo "`date "+%Y-%m-%d %H:%M:%S"` 【!!!】转义变量后格式错误,请检查 ${dir}debug_send_json 字段内是否有特殊符号未转义或语法错误" >> ${logfile}
echo "`date "+%Y-%m-%d %H:%M:%S"` 【debug】json 文件已保存至:${dir}debug_send_json" >> ${logfile}
echo "`date "+%Y-%m-%d %H:%M:%S"` 【debug】推送内容预览文件保存至${dir}debug_send_content" >> ${logfile}
echo "`date "+%Y-%m-%d %H:%M:%S"` 【debug】如果收不到信息请检查 ${dir}debug_send_data 文件,或使用下列命令手动测试返回值 (可能需要关闭日志自动刷新方便选中)" >> ${logfile}
echo "`date "+%Y-%m-%d %H:%M:%S"` 【debug】"'curl -X POST -H "'$content_type'" -d "@'${dir}debug_send_data'" "'${diyurl}'" ' >> ${logfile}
[ -n "$4" ] && [ $RETVAL -eq 0 ] && return 0
return 1
else
return 0
fi
}
# 清理临时文件
@ -193,8 +200,8 @@ function getip(){
function get_hostipv4()
{
local ipv4_URL=`echo "$ipv4_urllist"| sed -n "${1}p"|sed -e 's/\r//g'`
[ ! -z "$ipv4_interface" ] && local tmp_hostIP=$(eval "curl -k -s -4 --interface ${ipv4_interface} -m 5 ${ipv4_URL}") || local tmp_hostIP=$(eval "curl -k -s -4 -m 5 ${ipv4_URL}")
[ -z "$tmp_hostIP" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【info】IP 获取失败,当前使用的 API 为 $ipv4_URL,接口为:${ipv4_interface}" >> ${logfile}
[ ! -z "$ipv4_interface" ] && local tmp_hostIP=$(eval "curl --connect-timeout 2 -m 2 -k -s -4 --interface ${ipv4_interface} -m 5 ${ipv4_URL}") || local tmp_hostIP=$(eval "curl --connect-timeout 2 -m 2 -k -s -4 -m 5 ${ipv4_URL}")
[ -z "$tmp_hostIP" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【info】IP 获取失败,当前使用的 API 为 $ipv4_URL & ${ipv4_interface}" >> ${logfile}
local tmp_hostIP=`echo $tmp_hostIP|grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'|head -n1`
echo "{\"IP\":\"${tmp_hostIP}\", \"URL\":\"${ipv4_URL}\"}"
}
@ -218,8 +225,8 @@ function getip(){
function get_hostipv6()
{
local ipv6_URL=`echo "$ipv6_urllist"| sed -n "${1}p"|sed -e 's/\r//g'`
[ ! -z "$ipv6_interface" ] && local tmp_hostIPv6=$(eval "curl -k -s -6 --interface ${ipv6_interface} -m 5 ${ipv6_URL}") || local tmp_hostIPv6=$(eval "curl -k -s -6 -m 5 ${ipv6_URL}")
[ -z "$tmp_hostIPv6" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【info】IP 获取失败,当前使用的 API 为 $ipv6_URL,接口为:${ipv6_interface}" >> ${logfile}
[ ! -z "$ipv6_interface" ] && local tmp_hostIPv6=$(eval "curl --connect-timeout 2 -m 2 -k -s -6 --interface ${ipv6_interface} -m 5 ${ipv6_URL}") || local tmp_hostIPv6=$(eval "curl --connect-timeout 2 -m 2 -k -s -6 -m 5 ${ipv6_URL}")
[ -z "$tmp_hostIPv6" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【info】IP 获取失败,当前使用的 API 为 $ipv6_URL & ${ipv6_interface}" >> ${logfile}
local tmp_hostIPv6=`echo $tmp_hostIPv6|grep -oE "([\da-fA-F0-9]{1,4}(:{1,2})){1,15}[\da-fA-F0-9]{1,4}"|head -n1`
echo "{\"IP\":\"${tmp_hostIPv6}\", \"URL\":\"${ipv6_URL}\"}"
}
@ -833,9 +840,12 @@ function rand_geturl(){
# 检测 ip 状况
function ip_changes(){
[ "$get_ipv4_mode" -eq "1" ] && local IPv4=`getip wanipv4` && local IPv4_URL="网络接口"
local IPv4_URL="网络接口"
local IPv6_URL="网络接口"
[ "$get_ipv4_mode" -eq "1" ] && getip wanipv4 > "$output_dir/IPv4" &
[ "$get_ipv6_mode" -eq "1" ] && getip wanipv6 > "$output_dir/IPv6" &
wait_and_cat
[ "$get_ipv4_mode" -eq "2" ] && local IPv4=`getip hostipv4` && local IPv4_URL=`echo ${IPv4}|jq -r '.URL'` && local IPv4=`echo ${IPv4}|jq -r '.IP'`
[ "$get_ipv6_mode" -eq "1" ] && local IPv6=`getip wanipv6` && local IPv6_URL="网络接口"
[ "$get_ipv6_mode" -eq "2" ] && local IPv6=`getip hostipv6` && local IPv6_URL=`echo ${IPv6}|jq -r '.URL'` && local IPv6=`echo ${IPv6}|jq -r '.IP'`
if [ "$1" ] && [ $1 == "getip" ]; then
@ -1057,12 +1067,12 @@ function cpu_load(){
temp_last_overload_time=`date +%s`
fi
if [ ! -z "$cpu_temp" ] && [ "$((`date +%s`-$temp_last_overload_time))" -ge "300" ] && [ -z "$temperaturecd_time" ]; then
if [ ! -z "$cpu_temp" ] && [ "$((`date +%s`-$temp_last_overload_time))" -ge "$cpu_threshold_duration" ] && [ -z "$temperaturecd_time" ]; then
title="CPU 温度过高!"
temperaturecd_time=`date +%s`
echo "`date "+%Y-%m-%d %H:%M:%S"` ${disturb_text} CPU 温 度过高: ${cpu_temp}" >> ${logfile}
content="${content}${str_splitline}${str_title_start} CPU 温度过高${str_title_end}${str_linefeed}${str_tab}CPU 温度已连续五分钟超过预设${str_linefeed}${str_tab}接下来一小 时不再提示${str_linefeed}${str_tab}当前温度:${cpu_temp}℃"
elif [ ! -z "$temperaturecd_time" ] && [ "$((`date +%s`-$temperaturecd_time))" -ge "3300" ] ;then
elif [ ! -z "$temperaturecd_time" ] && [ "$((`date +%s`-$temperaturecd_time))" -ge "$cpu_notification_delay" ] ;then
unset temperaturecd_time
fi
fi
@ -1078,7 +1088,7 @@ function cpu_load(){
cpu_last_overload_time=`date +%s`
fi
if [ ! -z "$cpu_fuzai" ] && [ "$((`date +%s`-$cpu_last_overload_time))" -ge "300" ] && [ -z "$cpucd_time" ]; then
if [ ! -z "$cpu_fuzai" ] && [ "$((`date +%s`-$cpu_last_overload_time))" -ge "$cpu_threshold_duration" ] && [ -z "$cpucd_time" ]; then
unset getlogtop
if [ ! -z "$title" ] && ( echo "$title"|grep -q "过高" ); then
title="设备报警!"
@ -1089,7 +1099,7 @@ function cpu_load(){
echo "`date "+%Y-%m-%d %H:%M:%S"` ${disturb_text} CPU 负 载过高: ${cpu_fuzai}" >> ${logfile}
content="${content}${str_splitline}${str_title_start} CPU 负载过高${str_title_end}${str_linefeed}${str_tab}CPU 负载已连续五分钟超过预设${str_linefeed}${str_tab}接下来一小 时不再提示${str_linefeed}${str_tab}当前负载:${cpu_fuzai}"
cputop
elif [ ! -z "$cpucd_time" ] && [ "$((`date +%s`-$cpucd_time))" -ge "3300" ] ;then
elif [ ! -z "$cpucd_time" ] && [ "$((`date +%s`-$cpucd_time))" -ge "$cpu_notification_delay" ] ;then
unset cpucd_time
fi
fi
@ -1218,18 +1228,24 @@ function get_disk() {
done
}
# 查询 IP 归属地
function get_ip_attribution(){
ip="$1"
[ -f ${dir}ipAddress ] && ( cat ${dir}ipAddress|grep -q -w -i "$ip" ) && echo "本地局域网" && return
ip_attribution_urls=$(cat /usr/share/wechatpush/api/ip_attribution.list)
while IFS= read -r ip_attribution_command; do
local login_ip_attribution=$(eval "$ip_attribution_command" 2>/dev/null)
[ "$login_ip_attribution" == "null" ] && unset login_ip_attribution
[ -n "$login_ip_attribution" ] && break
done <<< "$ip_attribution_urls"
echo "$login_ip_attribution"
local url_number=`echo "$ip_attribution_urls"|wc -l`
local rand_number=`rand 1 $url_number`
function get_attribution()
{
local ip_attribution_url=`echo "$ip_attribution_urls"| sed -n "${1}p"|sed -e 's/\r//g'`
local login_ip_attribution=$(eval curl --connect-timeout 2 -m 2 -k -s "$ip_attribution_url" 2>/dev/null)
#logfile=logfile="${dir}wechatpush.log"
#[ -z "$login_ip_attribution" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【info】归属地获取超时当前使用的 API 为 $ip_attribution_url" >> ${logfile}
echo "$login_ip_attribution"
}
local ip_attribution=`get_attribution ${rand_number}`
[ -z "$ip_attribution" ] && local rand_number=`expr $rand_number + 1` && [ $rand_number -gt $url_number ] && local rand_number=1;[ -z "$ip_attribution" ] && local ip_attribution=`get_attribution ${rand_number}`
echo "$ip_attribution"
}
# 登录提醒通知
@ -1541,8 +1557,8 @@ function send(){
disturb;local send_disturb=$?
get_config "send_title" "send_notification"
cpuload=`getcpu`
service_status=$(ubus call service list '{"name": "wechatpush"}' | grep -o '"running": true')
[ -z "$1" ] && cpuload=`getcpu`
[ -z "$1" ] && service_status=$(ubus call service list '{"name": "wechatpush"}' | grep -o '"running": true')
[ -z "$1" ] && ( echo "$send_notification"|grep -q "client_list" ) && > ${dir}send_enable.lock && [ -z "$service_status" ] && first &
if [ -z "$1" ] && ( echo "$send_notification"|grep -q "router_status" ); then
cat /proc/loadavg|awk '{print $1" "$2" "$3}' > "$output_dir/systemload" &
@ -1568,11 +1584,11 @@ function send(){
#[ -z "$1" ] && ( echo "$send_notification"|grep -q "disk_info" ) && get_disk &
[ -z "$1" ] && get_disk &
[ -z "$send_title" ] && send_title="路由状态:"
[ -z "$1" ] && send_title="路由状态:"
[ ! -z "$1" ] && send_title="发送测试:" && send_content="${str_splitline}${str_title_start}内容1${str_title_end}${str_linefeed}${str_tab}设备1${str_linefeed}${str_tab}设备2${str_splitline}${str_title_start}内容2${str_title_end}${str_linefeed}${str_tab}设备3${str_linefeed}${str_tab}设备4"
wait_and_cat
if [ -n "$systeminfo_enable" ]; then
if [ -z "$1" ] && [ -n "$systeminfo_enable" ]; then
[[ $Qwai -eq 200 || $Qwai -eq 301 || $Qwai -eq 302 ]] && Qwai_status="已连通!" || Qwai_status="已断开!"
send_content="${send_content}${str_splitline}${str_title_start} 系统运行状态${str_title_end}"
send_content="${send_content}${str_linefeed}${str_tab}平均负载:${systemload}"
@ -1592,7 +1608,7 @@ function send(){
send_content="${send_content}${get_disk}"
fi
if [ -n "$waninfo_enable" ]; then
if [ -z "$1" ] && [ -n "$waninfo_enable" ]; then
send_content="${send_content}${str_splitline}${str_title_start} WAN 口信息${str_title_end}"
if [ "$send_wanIP" == "$send_hostIP" ]; then
send_content="${send_content}${str_linefeed}${str_tab}IPv4: ${send_wanIP}"
@ -1653,6 +1669,8 @@ if [ "$1" ] ;then
get_config "get_ipv4_mode" "ipv4_interface" "get_ipv6_mode" "ipv6_interface"
ipv4_urllist=`cat /usr/share/wechatpush/api/ipv4.list` 2>/dev/null
ipv6_urllist=`cat /usr/share/wechatpush/api/ipv6.list` 2>/dev/null
dir="/tmp/wechatpush/" && mkdir -p ${dir}
output_dir="${dir}json_output" && mkdir -p "$output_dir"
ip_changes getip && exit $?
}
read_config

View File

@ -41,6 +41,8 @@ Then find `luci-app-xray` under `Extra Packages`.
* 2023-10-26 fix: allow empty selection for extra inbound outbound balancer
* 2023-10-30 fix: blocked as nxdomain for IPv6
* 2023-10-31 chore: bump version to 3.1.1
* 2023-11-01 feat: custom configuration hook
* 2023-11-02 feat: specify DNS to resolve outbound server name
## Changelog since 3.0.0

View File

@ -27,16 +27,21 @@ function split_ipv4_host_port(val, port_default) {
function upstream_domain_names(proxy, config) {
let domain_names_set = {};
let domain_extra_options = {};
for (let b in ["tcp_balancer_v4", "tcp_balancer_v6", "udp_balancer_v4", "udp_balancer_v6"]) {
for (let i in balancer(proxy, b, b)) {
const server = config[substr(i, -9)];
if (server) {
domain_names_set[server["server"]] = true;
if (!server["domain_resolve_dns"]) {
domain_names_set[server["server"]] = true;
} else {
domain_extra_options[server["server"]] = server["domain_resolve_dns"];
}
}
}
}
// todo: add dialer proxy references here
return keys(domain_names_set);
return [keys(domain_names_set), domain_extra_options];
}
function domain_rules(proxy, k) {
@ -111,13 +116,20 @@ export function dns_server_outbound() {
export function dns_conf(proxy, config, manual_tproxy, fakedns) {
const fast_dns_object = split_ipv4_host_port(proxy["fast_dns"] || fallback_fast_dns, 53);
const default_dns_object = split_ipv4_host_port(proxy["default_dns"] || fallback_default_dns, 53);
const upstream_domain_options = upstream_domain_names(proxy, config);
let servers = [
default_dns_object,
...fake_dns_domains(fakedns),
...map(keys(upstream_domain_options[1]), function (k) {
const i = split_ipv4_host_port(upstream_domain_options[1][k]);
i["domains"] = [k];
i["skipFallback"] = true;
return i;
}),
{
address: fast_dns_object["address"],
port: fast_dns_object["port"],
domains: [...upstream_domain_names(proxy, config), ...fast_domain_rules(proxy)],
domains: [...upstream_domain_options[0], ...fast_domain_rules(proxy)],
skipFallback: true,
},
];

View File

@ -315,13 +315,17 @@ return view.extend({
o.datatype = 'host';
o.rmempty = false;
o = ss.taboption('general', form.ListValue, 'domain_strategy', _('Domain Strategy'));
o = ss.taboption('general', form.ListValue, 'domain_strategy', _('Domain Strategy'), _("Whether to use IPv4 or IPv6 address if Server Hostname is a domain."));
o.value("UseIP");
o.value("UseIPv4");
o.value("UseIPv6");
o.default = "UseIP";
o.modalonly = true;
o = ss.taboption('general', form.Value, 'domain_resolve_dns', _('Resolve Domain via DNS'), _("Specify a DNS to resolve server hostname. Only works for main balancers (those on General Settings tab)."));
o.datatype = 'hostport';
o.modalonly = true;
o = ss.taboption('general', form.Value, 'server_port', _('Server Port'));
o.datatype = 'port';
o.rmempty = false;
@ -879,7 +883,7 @@ return view.extend({
s.tab('custom_options', _('Custom Options'));
o = s.taboption('custom_options', form.TextValue, 'custom_config', _('Custom Configurations'), _('Check <code>/var/etc/xray/config.json</code> for tags of generated inbounds and outbounds. See <a href="https://xtls.github.io/config/features/multiple.html">here</a> for help'));
o.monospace = true;
o.rows = 10;
o.rows = 20;
o.validate = validate_object;
return m.render();

View File

@ -260,10 +260,10 @@ return view.extend({
ttl_hop_limit_match.datatype = 'uinteger';
s.tab('custom_options', _('Custom Options'));
let custom_configuration_hook = s.taboption('custom_options', form.TextValue, 'custom_configuration_hook', _('Custom Configuration Hook'), _('Have full control over the configuration file here. Read <a href="https://ucode.mein.io/">ucode Documentation</a> for the language used.'));
let custom_configuration_hook = s.taboption('custom_options', form.TextValue, 'custom_configuration_hook', _('Custom Configuration Hook'), _('Read <a href="https://ucode.mein.io/">ucode Documentation</a> for the language used. Code filled here may need to change after upgrading luci-app-xray.'));
custom_configuration_hook.placeholder = "return function(config) {\n return config;\n};";
custom_configuration_hook.monospace = true;
custom_configuration_hook.rows = 10;
custom_configuration_hook.rows = 20;
return m.render();
}

View File

@ -6,12 +6,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=sing-box
PKG_VERSION:=1.7.0-alpha.1
PKG_VERSION:=1.7.0-alpha.3
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/SagerNet/sing-box/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=8f424afcbf9102f136798c3f8606de84f0732b5f51e32a93fa0ab98acbda43ee
PKG_HASH:=17155f8e212934f1274666a14f677e9e831278f1b5796648b5b5663f3f4188b8
PKG_LICENSE:=GPL-3.0-or-later
PKG_LICENSE_FILES:=LICENSE