From c30ad0fb8755fa10d7cbb1bf0a1d0fea4739b8b3 Mon Sep 17 00:00:00 2001 From: kenzok8 Date: Mon, 12 Jan 2026 00:30:14 +0800 Subject: [PATCH] update 2026-01-12 00:30:14 --- luci-app-natter2/Makefile | 4 +- luci-app-natter2/root/etc/init.d/natter2 | 71 +++----- .../cbi/passwall/client/node_subscribe.lua | 2 +- .../luasrc/view/passwall/haproxy/js.htm | 36 ++++- .../view/passwall/node_list/node_list.htm | 1 - .../view/passwall/node_subscribe/js.htm | 153 ++++++++++++++++++ .../view/passwall/rule/rule_version.htm | 27 +++- v2ray-geodata/Makefile | 4 +- 8 files changed, 240 insertions(+), 58 deletions(-) diff --git a/luci-app-natter2/Makefile b/luci-app-natter2/Makefile index c09e6c293..afa8d919c 100755 --- a/luci-app-natter2/Makefile +++ b/luci-app-natter2/Makefile @@ -4,11 +4,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-natter2 PKG_VERSION:=1.0 -PKG_RELEASE:=4 +PKG_RELEASE:=5 LUCI_TITLE:=LuCI Support for Natter v2.2.1 LUCI_PKGARCH:=all -LUCI_DEPENDS:=+natter2 +coreutils-nohup +LUCI_DEPENDS:=+natter2 include $(TOPDIR)/feeds/luci/luci.mk diff --git a/luci-app-natter2/root/etc/init.d/natter2 b/luci-app-natter2/root/etc/init.d/natter2 index bba978b2e..3660e401a 100755 --- a/luci-app-natter2/root/etc/init.d/natter2 +++ b/luci-app-natter2/root/etc/init.d/natter2 @@ -1,5 +1,6 @@ #!/bin/sh /etc/rc.common +USE_PROCD=1 START=98 script_path="/usr/share/natter2/natter.py" @@ -11,20 +12,19 @@ start_service() { enable_forwarding forwarding_method target_address target_port \ enable_forwarding_retry enable_quit delay log_level enable_notify \ notify_path enable_upnp_service" - for i in $basic_list - do + + for i in $basic_list; do local eval $i="$(uci_get_by_type base 0 $i)" done ; unset i - if [ "$enable" == 1 ] - then + + if [ "$enable" == 1 ]; then mkdir -p ${tmp_path} mkdir -p /var/etc/natter2 - for u in $(seq 0 $(($(uci show natter2 2> /dev/null | egrep '@instances\[[0-9]\]+=instances' | wc -l) - 1))) + + for u in $(seq 0 $(($(uci show natter2 2> /dev/null | grep -E '@instances\[[0-9]\]+=instances' | wc -l) - 1))) do - for i in $instance_list - do + for i in $instance_list; do local eval $i="$(uci_get_by_type instances $u $i)" - # echo "$i : $(uci_get_by_type instances $u $i)" done ; unset i [ "$enable_instance" != 1 ] && continue @@ -32,27 +32,22 @@ start_service() { [ "$protocol" == udp ] && script_command="$script_command -u" - if [ "$enable_stun_server" == 1 ] - then - for i in $stun_server - do + if [ "$enable_stun_server" == 1 ]; then + for i in $stun_server; do script_command="$script_command -s $i" done ; unset i fi [ "$enable_keepalive_server" == 1 ] && script_command="$script_command -h $keepalive_server" [ "$interval" ] && script_command="$script_command -k $interval" - [ "$enable_upnp_service" == 1 ] && script_command="$script_command -U" - if [ "$enable_bonding" == 1 ] - then + if [ "$enable_bonding" == 1 ]; then [ "$bonding_interface" ] && script_command="$script_command -i $bonding_interface" [ "$bonding_port" ] && script_command="$script_command -b $bonding_port" fi - if [ "$enable_forwarding" == 1 ] - then + if [ "$enable_forwarding" == 1 ]; then [ "$forwarding_method" ] && script_command="$script_command -m $forwarding_method" [ "$target_address" ] && script_command="$script_command -t $target_address" [ "$target_port" ] && script_command="$script_command -p $target_port" @@ -60,35 +55,30 @@ start_service() { fi [ "$enable_quit" == 1 ] && script_command="$script_command -q" - [ "$log_level" == "verbose" ] && script_command="$script_command -v" - if [ "$enable_notify" == 1 ] - then + if [ "$enable_notify" == 1 ]; then echo "$notify_path" > /var/etc/natter2/${id}-notify var_file=/var/etc/natter2/${id}-${u}-1 else var_file=/var/etc/natter2/${id}-${u}-0 fi - log_file=${tmp_path}/natter2-${id}.log - cp -a /usr/share/luci-app-natter2/notify-base.sh $var_file chmod +x $var_file - # echo "log_file: $log_file" - # echo "var_file: $var_file" + procd_open_instance "natter2_${id}" + procd_set_param command $(command -v python) "$script_path" $script_command -e $var_file - sleep $delay - for i in $(ps -efww | grep "$script_path" | grep -v grep | grep -v $$ | grep "$id" | awk '{print $1}') - do - kill -9 "$i" 2> /dev/null - done + procd_set_param stdout 1 + procd_set_param stderr 1 - nohup $(command -v python) "$script_path" $script_command -e $var_file > "$log_file" 2>&1 & + [ -n "$delay" ] && procd_set_param delay "$delay" + procd_set_param respawn - for i in $instance_list - do + procd_close_instance + + for i in $instance_list; do unset $(echo $i) done ; unset i unset script_command @@ -99,24 +89,13 @@ start_service() { } stop_service() { - echo "Stopping Natter2 ..." - for i in $(ps -ww | grep "$script_path" | grep -v grep | grep -v $$ | awk '{print $1}') - do - kill -15 "$i" 2> /dev/null - done - rm -r "$tmp_path" 2> /dev/null - for u in $(seq 0 $(($(uci show natter2 2> /dev/null | egrep '@instances\[[0-9]\]+=instances' | wc -l) - 1))) + rm -rf "/var/etc/natter2" 2> /dev/null + for u in $(seq 0 $(($(uci show natter2 2> /dev/null | grep -E '@instances\[[0-9]\]+=instances' | wc -l) - 1))) do uci set natter2.@instances[$u].tmp_public_port="" uci commit natter2 done rm -f /tmp/natter2_nat_type - -} - -restart() { - stop_service - start_service } service_triggers() { @@ -126,4 +105,4 @@ service_triggers() { uci_get_by_type() { local ret=$(uci get natter2.@$1[$2].$3 2>/dev/null) echo ${ret:=$4} -} +} \ No newline at end of file diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua index 92145d399..a96791e9c 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua @@ -243,6 +243,6 @@ o.cfgvalue = function(self, section) section, translate("Manual subscription")) end -s:append(Template(appname .. "/node_subscribe/js")) +m:append(Template(appname .. "/node_subscribe/js")) return m diff --git a/luci-app-passwall/luasrc/view/passwall/haproxy/js.htm b/luci-app-passwall/luasrc/view/passwall/haproxy/js.htm index 5493b813f..dec99b04e 100644 --- a/luci-app-passwall/luasrc/view/passwall/haproxy/js.htm +++ b/luci-app-passwall/luasrc/view/passwall/haproxy/js.htm @@ -4,12 +4,10 @@ local api = require "luci.passwall.api" + diff --git a/luci-app-passwall/luasrc/view/passwall/rule/rule_version.htm b/luci-app-passwall/luasrc/view/passwall/rule/rule_version.htm index 7bea821d2..d2b8ee529 100644 --- a/luci-app-passwall/luasrc/view/passwall/rule/rule_version.htm +++ b/luci-app-passwall/luasrc/view/passwall/rule/rule_version.htm @@ -4,12 +4,10 @@ local api = require "luci.passwall.api"