luci-app-clash: bump to v1.5.5a

This commit is contained in:
CN_SZTL 2020-02-10 14:22:45 +08:00
parent 67a8195300
commit fecc16d43e
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
8 changed files with 59 additions and 65 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-clash
PKG_VERSION:=1.5.3
PKG_VERSION:=1.5.5
PKG_MAINTAINER:=frainzy1477
@ -67,7 +67,7 @@ if [ -z "$${IPKG_INSTROOT}" ]; then
rm -rf /usr/share/clash/web 2>/dev/null
mv /usr/share/clash/config/sub/config.yaml /usr/share/clashbackup/config.bak1 2>/dev/null
mv /usr/share/clash/config/upload/config.yaml /usr/share/clashbackup/config.bak2 2>/dev/null
mv /usr/share/clash/config/custom/config.yaml /usr/share/clashbackup/config.bak3 2>/dev/nul
mv /usr/share/clash/config/custom/config.yaml /usr/share/clashbackup/config.bak3 2>/dev/null
fi
exit 0

View File

@ -61,7 +61,7 @@ o.inputtitle = translate("Download Config")
o.inputstyle = "reload"
o.write = function()
kr.uci:commit("clash")
SYS.call("sh /usr/share/clash/clash.sh >>/tmp/clash.txt 2>&1 &")
SYS.call("sh /usr/share/clash/clash.sh >>/usr/share/clash/clash.txt 2>&1 &")
SYS.call("sleep 1")
HTTP.redirect(DISP.build_url("admin", "services", "clash"))
end
@ -82,7 +82,7 @@ o.write = function()
kr.uci:commit("clash")
SYS.call("cp /etc/config/clash /usr/share/clash/v2ssr/config.bak 2>/dev/null")
SYS.call("sleep 1")
luci.sys.call("bash /usr/share/clash/v2ssr.sh >>/tmp/clash.txt 2>&1 &")
luci.sys.call("bash /usr/share/clash/v2ssr.sh >>/usr/share/clash/clash.txt 2>&1 &")
HTTP.redirect(DISP.build_url("admin", "services", "clash"))
end
o:depends("subcri", 'v2ssr2clash')
@ -138,4 +138,4 @@ if luci.http.formvalue("upload") then
end
return kr,kk,ko
return kr,kk,ko

View File

@ -22,7 +22,7 @@ o.inputtitle = translate("Download logs")
o.inputstyle = "apply"
o.write = function ()
local sPath, sFile, fd, block
sPath = "/tmp/clash.txt"
sPath = "/usr/share/clash/clash.txt"
sFile = NXFS.basename(sPath)
if fs.isdirectory(sPath) then
fd = io.popen('txt -C "%s" -cz .' % {sPath}, "r")

View File

@ -12,7 +12,6 @@ CRON_FILE="/etc/crontabs/root"
CONFIG_YAML="/etc/clash/config.yaml"
CONFIG_YAML_PATH=$(uci get clash.config.use_config 2>/dev/null)
CUSLIST="/tmp/dnsmasq.d/custom_list.conf"
CUSLITT="/tmp/dnsmasq.clash"
CUSLISTV="/var/dnsmasq.d/custom_list.conf"
@ -275,30 +274,20 @@ rules(){
ip route replace default dev utun table "$PROXY_ROUTE_TABLE"
fi
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE"
iptables -t mangle -N clash
iptables -t mangle -F clash
iptables -t mangle -A clash -m owner --uid-owner "$PROXY_BYPASS_USER" -j RETURN
iptables -t mangle -A clash -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK"
iptables -t mangle -A clash -m set --match-set localnetwork dst -j RETURN
iptables -t mangle -A clash -j MARK --set-mark "$PROXY_FWMARK"
iptables -t nat -N CLASH_DNS
iptables -t nat -F CLASH_DNS
iptables -t nat -A CLASH_DNS -m owner --uid-owner "$PROXY_BYPASS_USER" -j RETURN
iptables -t nat -A CLASH_DNS -p udp -j DNAT --to "127.0.0.1:$dns_port"
iptables -t mangle -I OUTPUT -j clash
iptables -t mangle -I PREROUTING -m set ! --match-set localnetwork dst -j MARK --set-mark "$PROXY_FWMARK"
iptables -t nat -I OUTPUT -p udp --dport 53 -j CLASH_DNS
iptables -t nat -I PREROUTING -p udp --dport 53 -j DNAT --to "127.0.0.1:$dns_port"
ip rule add fwmark "$PROXY_FWMARK" table "$PROXY_ROUTE_TABLE"
iptables -t mangle -N clash
iptables -t mangle -F clash
iptables -t mangle -A clash -d 198.18.0.0/16 -j MARK --set-mark "$PROXY_FWMARK"
iptables -t mangle -A clash -m set --match-set localnetwork dst -j RETURN
iptables -t mangle -I OUTPUT -j clash
iptables -t mangle -I PREROUTING -m set ! --match-set localnetwork dst -j MARK --set-mark "$PROXY_FWMARK"
if [ -f /usr/sbin/ip6tables ] && [ "${ipv6}" -eq 1 ]; then
ip6tables -t mangle -I PREROUTING -j MARK --set-mark "$PROXY_FWMARK"
fi
fi
#===========================================================================================================================
}
@ -308,6 +297,9 @@ custom_list() {
sh /usr/share/clash/list.sh >/dev/null 2>&1
}
watchdog() {
nohup /usr/share/clash/clash-watchdog.sh >/dev/null 2>&1
}
start(){
#===========================================================================================================================
lang=$(uci get luci.main.lang 2>/dev/null)
@ -456,8 +448,19 @@ if [ -f $CONFIG_YAML ] && [ "$(ls -l $CONFIG_YAML|awk '{print int($5/1024)}')"
fi
fi
sleep 2
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
echo "Setting Cron Job" >$REAL_LOG
add_cron
elif [ "${lang}" == "zh_cn" ];then
echo "设置Cron" >$REAL_LOG
add_cron
sh /usr/share/clash/restore.sh >/dev/null 2>&1
fi
sleep 1
@ -467,19 +470,18 @@ if [ -f $CONFIG_YAML ] && [ "$(ls -l $CONFIG_YAML|awk '{print int($5/1024)}')"
echo "设置 Clash iptables" >$REAL_LOG
fi
if [ "$(uci get firewall.@defaults[0].forward)" != "ACCEPT" ]; then
if [ "$(uci get firewall.@defaults[0].forward)" != "ACCEPT" ]; then
uci set firewall.@defaults[0].forward=ACCEPT >/dev/null 2>&1
uci commit firewall >/dev/null 2>&1
/etc/init.d/firewall restart >/dev/null 2>&1
fi
fi
sleep 2
sleep 2
rules >/dev/null 2>&1
custom_list >/dev/null 2>&1
sleep 1
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
echo "Restarting Dnsmasq " >$REAL_LOG
elif [ "${lang}" == "zh_cn" ];then
@ -488,29 +490,21 @@ if [ -f $CONFIG_YAML ] && [ "$(ls -l $CONFIG_YAML|awk '{print int($5/1024)}')"
/etc/init.d/dnsmasq restart >/dev/null 2>&1
sleep 1
if pidof clash >/dev/null; then
add_cron
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
echo "Setting Cron Job" >$REAL_LOG
sleep 1
echo "Clash Started Successfully " >$REAL_LOG
sleep 2
echo "Clash is Running " >$REAL_LOG
sleep 2
echo "Clash for OpenWRT" >$REAL_LOG
elif [ "${lang}" == "zh_cn" ];then
echo "设置Cron" >$REAL_LOG
sleep 1
echo "Clash 启动成功,请等待服务器上线!" >$REAL_LOG
sleep 2
echo "Clash运行中" >$REAL_LOG
sleep 2
echo "Clash for OpenWRT" >$REAL_LOG
fi
nohup /usr/share/clash/clash-watchdog.sh >/dev/null 2>&1
fi
watchdog >/dev/null 2>&1
else
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
echo " $(date "+%Y-%m-%d %H:%M:%S") - problem with config.yaml, config.yaml is either empty or not found " >> /usr/share/clash/clash.txt
@ -639,7 +633,7 @@ stop(){
remove_mark >/dev/null 2>&1
sh /usr/share/clash/backup.sh >/dev/null 2>&1
bash /usr/share/clash/backup.sh >/dev/null 2>&1
kill -9 $(ps | grep clash-watchdog.sh | grep -v grep | awk '{print $1}') >/dev/null 2>&1

View File

@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/bash /etc/rc.common
. /lib/functions.sh
CURL_GROUP_CACHE="/usr/share/clashbackup/clash_gorup.json"
CURL_NOW_CACHE="/usr/share/clashbackup/clash_now.json"

View File

@ -1,5 +1,5 @@
#!/bin/sh
sleeptime=300
logfile="/tmp/clash.log"
CLASH="/etc/clash/clash"
@ -17,6 +17,24 @@ clean_log(){
}
if [ -f /usr/share/clashbackup/history ];then
HISTORY_PATH="/usr/share/clashbackup/history"
SECRET=$(uci get clash.config.dash_pass 2>/dev/null)
LAN_IP=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
PORT=$(uci get clash.config.dash_port 2>/dev/null)
if [ ! -z "$(grep "#*#" "$HISTORY_PATH")" ]; then
cat $HISTORY_PATH |while read line
do
GORUP_NAME=$(echo $line |awk -F '#*#' '{print $1}')
NOW_NAME=$(echo $line |awk -F '#*#' '{print $3}')
curl -H "Authorization: Bearer ${SECRET}" -H "Content-Type:application/json" -X PUT -d '{"name":"'"$NOW_NAME"'"}' http://"$LAN_IP":"$PORT"/proxies/"$GORUP_NAME" >/dev/null 2>&1
done
fi
fi
while [ $enable -eq 1 ];
do
curtime=`date "+%H:%M:%S"`

View File

@ -1,19 +0,0 @@
#!/bin/sh
if [ -f /usr/share/clashbackup/history ];then
HISTORY_PATH="/usr/share/clashbackup/history"
SECRET=$(uci get clash.config.dash_pass 2>/dev/null)
LAN_IP=$(uci get network.lan.ipaddr 2>/dev/null |awk -F '/' '{print $1}' 2>/dev/null)
PORT=$(uci get clash.config.dash_port 2>/dev/null)
if [ ! -z "$(grep "#*#" "$HISTORY_PATH")" ]; then
cat $HISTORY_PATH |while read line
do
GORUP_NAME=$(echo $line |awk -F '#*#' '{print $1}')
NOW_NAME=$(echo $line |awk -F '#*#' '{print $3}')
curl -H "Authorization: Bearer ${SECRET}" -H "Content-Type:application/json" -X PUT -d '{"name":"'"$NOW_NAME"'"}' http://"$LAN_IP":"$PORT"/proxies/"$GORUP_NAME" >/dev/null 2>&1
done
fi
fi