1
0
mirror of https://github.com/kenzok8/small-package synced 2025-09-20 19:11:30 +08:00

update-03.08

This commit is contained in:
github-actions[bot]
2022-03-08 15:37:46 +08:00
parent 47636d2ed2
commit f924d0bc26
5 changed files with 35 additions and 29 deletions

View File

@ -1,6 +1,5 @@
local fs=require "nixio.fs"
luci.sys.exec("sed -e '1!G;h;$!d' /var/log/bypass.log >/var/log/bypass_r.log")
f=SimpleForm("logview")
f.reset=false
f.submit=false
@ -8,8 +7,14 @@ t=f:field(TextValue,"conf")
t.rmempty=true
t.rows=20
function t.cfgvalue()
return fs.readfile("/var/log/bypass_r.log") or ""
if nixio.fs.access("/var/log/bypass.log") then
local logs = luci.util.execi("cat /var/log/bypass.log")
local s = ""
for line in logs do
s = line .. "\n" .. s
end
return s
end
end
t.readonly="readonly"
t.readonly = "readonly"
return f

View File

@ -253,7 +253,7 @@ rules(){
check_net
cat $LOG 2>/dev/null | sed -n '$p' | grep -q 'Download IP/GFW files...' || (log "Check IP/GFW files...")
mkdir -p /var/run $VAR
if [[ ! -f $PID && "$update" != "updated" ]] || [ "$update" == "update" ] ;then
if [[ ! -f $PID && "$update" != "updated" ]];then
log "Download IP/GFW files..."
firstdown 2;exit 0;
fi
@ -846,7 +846,7 @@ add_cron(){
if [ $(uci_get_by_type server_subscribe auto_update 0) = 1 ];then
if ! grep -wq "$(uci_get_by_type server_subscribe auto_update_time 6) \* \* \* .*$BIN_DIR" $CRON_FILE;then
eval $CRON
echo "0 $(uci_get_by_type server_subscribe auto_update_time 6) * * * $BIN_DIR/update restart" >>$CRON_FILE
echo "0 $(uci_get_by_type server_subscribe auto_update_time 6) * * * $BIN_DIR/update" >>$CRON_FILE
echo "5 $(uci_get_by_type server_subscribe auto_update_time 6) * * * $BIN_DIR/subscribe" >>$CRON_FILE
A=1
fi
@ -1027,7 +1027,7 @@ stop(){
if [[ -f /etc/init.d/AdGuardHome && "$(uci -q get AdGuardHome.AdGuardHome.redirect)" == "exchange" ]]; then
/etc/init.d/AdGuardHome stop >/dev/null 2>&1 &
fi
rm -rf $SDNS $PID $LOC
rm -rf $SDNS $PID $LOC $LOG
/etc/init.d/dnsmasq restart >/dev/null 2>&1
elif [ -s $DNS_T ];then
cat > $DNS_T <<-EOF

View File

@ -1,5 +1,7 @@
#!/bin/sh
[ "$1" = --First ] && A=Y || A=N
# 防止重复启动
[ -f /var/lock/bypass.lock -a $A = N ] && exit 1
LOCK=/var/lock/bypass-update.lock
[ -f $LOCK ] && exit 1
touch $LOCK
@ -16,45 +18,50 @@ mkdir -p $T_FILE 2>/dev/null
if [ "$C" = router ];then
if [ ! -f $T_FILE/china.txt ];then
while ! B=$(curl -kLfsm 3 https://cdn.jsdelivr.net/gh/kiddin9/china_ip_list@main/china_ip_list.txt || curl -kLfsm 3 https://op.supes.top/all_cn.txt);do
sleep 2
sleep 1
done
else
B=$(curl -kLfsm 3 https://cdn.jsdelivr.net/gh/kiddin9/china_ip_list@main/china_ip_list.txt || curl -kLfsm 3 https://op.supes.top/all_cn.txt)
fi
[ -n "$B" ] && echo "$B" > /tmp/china.txt
[ -n "$B" ] && {
echo "$B" > /tmp/china.txt
if ! cmp -s /tmp/china.txt $T_FILE/china.txt;then
log "Update China IP List!"
cp -f /tmp/china.txt $T_FILE/china.txt
[ $A = N ] && ipset list china_v4 >/dev/null 2>&1 && $DIR/chinaipset
else
log "China IPv4 List is up to date!"
fi
#ipset list china_v4 >/dev/null 2>&1 && $DIR/chinaipset
}
if [ ! -f $T_FILE/china_v6.txt ];then
while ! D=$(curl -kLfsm 3 https://ispip.clang.cn/all_cn_ipv6.txt || curl -kLfsm 3 https://op.supes.top/all_cn_ipv6.txt);do
sleep 2
while ! D=$(curl -kLfsm 2 https://ispip.clang.cn/all_cn_ipv6.txt || curl -kLfsm 2 https://op.supes.top/all_cn_ipv6.txt);do
sleep 1
done
else
D=$(curl -kLfsm 3 https://ispip.clang.cn/all_cn_ipv6.txt || curl -kLfsm 3 https://op.supes.top/all_cn_ipv6.txt)
elif [ $A = N ];then
D=$(curl -kLfsm 2 https://ispip.clang.cn/all_cn_ipv6.txt || curl -kLfsm 2 https://op.supes.top/all_cn_ipv6.txt)
fi
[ -n "$D" ] && echo "$D" > /tmp/china_v6.txt
[ -n "$D" ] && {
echo "$D" > /tmp/china_v6.txt
if ! cmp -s /tmp/china_v6.txt $T_FILE/china_v6.txt;then
log "Update China IPv6 List!"
cp -f /tmp/china_v6.txt $T_FILE/china_v6.txt
[ $A = N ] && ipset list china_v6 >/dev/null 2>&1 && $DIR/chinaipset v6
else
log "China IPv6 List is up to date!"
fi
#ipset list china_v6 >/dev/null 2>&1 && $DIR/chinaipset v6
}
fi
if [ "$C" = gfw -o "$(uci -q get bypass.@global[0].gfw_mode)" = 1 ];then
if [ ! -f $T_FILE/gfw.txt ];then
while ! (curl -kLfsm 5 -o /tmp/gfw.b64 https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt || curl -kLfsm 3 -o /tmp/gfw.b64 https://op.supes.top/gfwlist.txt);do
sleep 2
if [ ! -f $T_FILE/gfw.list ];then
while ! (curl -kLfsm 3 -o /tmp/gfw.b64 https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt || curl -kLfsm 3 -o /tmp/gfw.b64 https://op.supes.top/gfwlist.txt);do
sleep 1
done
elif [ "$C" = gfw ];then
curl -kLfsm 5 -o /tmp/gfw.b64 https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt || curl -kLfsm 3 -o /tmp/gfw.b64 https://op.supes.top/gfwlist.txt
curl -kLfsm 3 -o /tmp/gfw.b64 https://cdn.jsdelivr.net/gh/gfwlist/gfwlist/gfwlist.txt || curl -kLfsm 3 -o /tmp/gfw.b64 https://op.supes.top/gfwlist.txt
fi
if [ -f /tmp/gfw.b64 ];then
$DIR/by-gfw
if ! cmp -s /tmp/gfwnew.txt $T_FILE/gfw.list;then
cp -f /tmp/gfwnew.txt $T_FILE/gfw.list
@ -62,8 +69,9 @@ if [ "$C" = gfw -o "$(uci -q get bypass.@global[0].gfw_mode)" = 1 ];then
else
log "GFW List is up to date!"
fi
fi
fi
rm -f $LOCK /tmp/china*.txt /tmp/gfwnew.txt
[ "$1" == "restart" ] && /etc/init.d/bypass restart update || /etc/init.d/bypass start updated
[ $A = Y ] && /etc/init.d/bypass start updated &

View File

@ -62,6 +62,7 @@ start_service()
procd_open_instance "$NAME"
procd_set_param command node "/usr/share/$NAME/core/app.js"
append_param "-a" "0.0.0.0"
local http_port https_port hijack_ways
config_get http_port "config" "http_port" "5200"
@ -70,19 +71,13 @@ start_service()
[ "${hijack_ways}" = "use_hosts" ] && { http_port="80"; https_port="443"; }
append_param "-p" "${http_port}":"${https_port}"
local lan_addr
lan_addr="$(uci get network.lan.ipaddr)"
if is_enabled "config" "pub_access"; then
append_param "-a" "0.0.0.0"
iptables -I "INPUT" -p "tcp" --dport "${http_port}" -j "ACCEPT"
iptables -I "INPUT" -p "tcp" --dport "${https_port}" -j "ACCEPT"
echo "${http_port}:${https_port}" > "/tmp/$NAME.ports"
mkdir -p "/var/etc/"
echo "/etc/init.d/$NAME restart" > "/var/etc/$NAME.include"
else
append_param "-a" "${lan_addr}"
fi
local music_source

View File

@ -1,2 +0,0 @@
#!/bin/sh
/etc/init.d/shadowsocks-libev reload