luci-app-clash: bump to 1.5.3
This commit is contained in:
parent
46e173928e
commit
2505cf346c
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-clash
|
||||
PKG_VERSION:=1.5.2
|
||||
PKG_VERSION:=1.5.3
|
||||
PKG_MAINTAINER:=frainzy1477
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ define Package/luci-app-clash
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=LuCI app for clash
|
||||
DEPENDS:=+luci +luci-base +wget +iptables +coreutils-base64 +coreutils +coreutils-nohup +bash +ipset +libustream-openssl +libopenssl +openssl-util
|
||||
DEPENDS:=+luci +luci-base +wget +iptables +coreutils-base64 +coreutils +coreutils-nohup +bash +ipset +libustream-openssl +libopenssl +openssl-util +curl +jsonfilter +ca-certificates
|
||||
PKGARCH:=all
|
||||
MAINTAINER:=frainzy1477
|
||||
endef
|
||||
@ -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/null
|
||||
mv /usr/share/clash/config/custom/config.yaml /usr/share/clashbackup/config.bak3 2>/dev/nul
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@ -83,6 +83,7 @@ if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
mv /usr/share/clashbackup/config.bak2 /usr/share/clash/config/upload/config.yaml 2>/dev/null
|
||||
mv /usr/share/clashbackup/config.bak3 /usr/share/clash/config/custom/config.yaml 2>/dev/null
|
||||
/etc/init.d/clash disable 2>/dev/null
|
||||
uci set clash.config.p_mode="Rule" && uci commit clash 2>/dev/null
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
@ -82,6 +82,10 @@ o:value("1", translate("enabled"))
|
||||
o:value("0", translate("disabled"))
|
||||
o.description = translate("Enable to read policy group")
|
||||
|
||||
o = s:option(ListValue, "loadprovider", translate("Load Provider"))
|
||||
o:value("1", translate("enabled"))
|
||||
o:value("0", translate("disabled"))
|
||||
o.description = translate("Enable to read Proxy Provider")
|
||||
|
||||
local t = {
|
||||
{Load_Config, Creat_Config, Apply, Delete_Severs, Delete_Groups}
|
||||
|
||||
@ -90,7 +90,7 @@ o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
m.uci:commit("clash")
|
||||
if luci.sys.call("pidof clash >/dev/null") == 0 then
|
||||
SYS.call("/etc/init.d/clash restart >/dev/null 2>&1 &")
|
||||
SYS.call("/etc/init.d/clash restart >/dev/null 2>&1 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash"))
|
||||
else
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash" , "settings", "dns"))
|
||||
|
||||
@ -612,7 +612,7 @@ msgid "Edit Proxy Provider"
|
||||
msgstr "编辑代理集配置"
|
||||
|
||||
msgid "Provider Type"
|
||||
msgstr "代理集类型
|
||||
msgstr "代理集类型"
|
||||
|
||||
msgid "Provider Type"
|
||||
msgstr "代理集的类型"
|
||||
@ -809,6 +809,9 @@ msgstr "强制使用同名"
|
||||
msgid "Enable to overwrite config file"
|
||||
msgstr "启用覆盖配置文件"
|
||||
|
||||
msgid "Give a name for your config"
|
||||
msgstr "为配置命名"
|
||||
|
||||
msgid "Config Type"
|
||||
msgstr "Clash配置类型"
|
||||
|
||||
@ -955,3 +958,9 @@ msgstr "选择代理模式"
|
||||
|
||||
msgid "NB: Upload only Dreamacro clash tun core - (https://github.com/Dreamacro/clash/releases/tag/TUN)"
|
||||
msgstr "注意:只上传clash tun内核-(https://github.com/Dreamacro/clash/releases/tag/TUN)"
|
||||
|
||||
msgid "Load Provider"
|
||||
msgstr "读取代理集"
|
||||
|
||||
msgid "Enable to read Proxy Provider"
|
||||
msgstr "启用读取代理集"
|
||||
|
||||
@ -220,7 +220,7 @@ rules(){
|
||||
iptables -t nat -A clash -d 224.0.0.0/4 -j RETURN
|
||||
iptables -t nat -A clash -d 240.0.0.0/4 -j RETURN
|
||||
iptables -t nat -A clash -d "${lan_ip}" -j RETURN
|
||||
if [ ! -z "$wan" ]; then
|
||||
if [ ! -z "${wan}" ]; then
|
||||
iptables -t nat -A clash -d "${wan}" -j RETURN
|
||||
fi
|
||||
iptables -t nat -A clash -p tcp -j REDIRECT --to-ports "${redir_port}"
|
||||
@ -263,7 +263,7 @@ rules(){
|
||||
ipset add localnetwork 240.0.0.0/4
|
||||
ipset add localnetwork 172.16.0.0/12
|
||||
ipset add localnetwork "${lan_ip}"
|
||||
if [ ! -z "$wan" ]; then
|
||||
if [ ! -z "${wan}" ]; then
|
||||
ipset add localnetwork "${wan}"
|
||||
fi
|
||||
if [ "${core}" -eq 3 ];then
|
||||
@ -421,7 +421,7 @@ if [ -f $CONFIG_YAML ] && [ "$(ls -l $CONFIG_YAML|awk '{print int($5/1024)}')"
|
||||
|
||||
game_rules >/dev/null 2>&1
|
||||
|
||||
if [ "${core}" -eq 1 ];then
|
||||
if [ "${core}" -eq 1 ];then
|
||||
nohup $CLASH -d "$CLASH_CONFIG" > /usr/share/clash/clash.txt 2>&1 &
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
@ -447,7 +447,8 @@ if [ -f $CONFIG_YAML ] && [ "$(ls -l $CONFIG_YAML|awk '{print int($5/1024)}')"
|
||||
echo "Clash 计划任务,启动进程守护程序..." >$REAL_LOG
|
||||
fi
|
||||
elif [ "${core}" -eq 2 ];then
|
||||
nohup $CLASHR -d "$CLASH_CONFIG" > /usr/share/clash/clash.txt 2>&1 &
|
||||
nohup $CLASHR -d "$CLASH_CONFIG" > /usr/share/clash/clash.txt 2>&1 &
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Clashr Core Started Successfully " >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
@ -455,7 +456,9 @@ if [ -f $CONFIG_YAML ] && [ "$(ls -l $CONFIG_YAML|awk '{print int($5/1024)}')"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
sh /usr/share/clash/restore.sh >/dev/null 2>&1
|
||||
|
||||
sleep 1
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
@ -636,6 +639,8 @@ stop(){
|
||||
|
||||
remove_mark >/dev/null 2>&1
|
||||
|
||||
sh /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
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
|
||||
17
package/jsda/luci-app-clash/root/usr/share/clash/backup.sh
Executable file
17
package/jsda/luci-app-clash/root/usr/share/clash/backup.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
CURL_GROUP_CACHE="/usr/share/clashbackup/clash_gorup.json"
|
||||
CURL_NOW_CACHE="/usr/share/clashbackup/clash_now.json"
|
||||
CURL_CACHE="/usr/share/clashbackup/clash_curl.json"
|
||||
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)
|
||||
|
||||
curl -w %{http_code}"\n" -H "Authorization: Bearer ${SECRET}" -H "Content-Type:application/json" -X GET http://"$LAN_IP":"$PORT"/proxies > "$CURL_CACHE" 2>/dev/null
|
||||
if [ "$(sed -n '$p' "$CURL_CACHE")" -eq "200" ]; then
|
||||
cat "$CURL_CACHE" |jsonfilter -e '@["proxies"][@.type="Selector"]["name"]' > "$CURL_GROUP_CACHE" 2>/dev/null
|
||||
cat "$CURL_CACHE" |jsonfilter -e '@["proxies"][@.type="Selector"]["now"]' > "$CURL_NOW_CACHE" 2>/dev/null
|
||||
awk 'NR==FNR{a[i]=$0;i++}NR>FNR{print a[j]"#*#"$0;j++}' "$CURL_GROUP_CACHE" "$CURL_NOW_CACHE" > "$HISTORY_PATH" 2>/dev/null
|
||||
fi
|
||||
rm -rf /usr/share/clashbackup/clash_*.json 2>/dev/null
|
||||
@ -46,7 +46,7 @@ else
|
||||
fi
|
||||
sleep 1
|
||||
|
||||
wget --no-check-certificate --user-agent="Clash/OpenWRT" $subscribe_url -O 2>&1 >1 $CONFIG_YAML
|
||||
wget -c4 --no-check-certificate --user-agent="Clash/OpenWRT" $subscribe_url -O 2>&1 >1 $CONFIG_YAML
|
||||
if [ "$?" -eq "0" ]; then
|
||||
echo "${config_name}.yaml#$subscribe_url#$subtype" >>/usr/share/clashbackup/confit_list.conf
|
||||
|
||||
@ -63,4 +63,4 @@ else
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
echo "开始下载【$RULE_FILE_NAME】规则..." >$REAL_LOG
|
||||
fi
|
||||
|
||||
wget -c4 --no-check-certificate --timeout=30 https://raw.githubusercontent.com/FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -O 2>&1 >1 "$TMP_RULE_DIR"
|
||||
wget --no-check-certificate -c4 https://raw.githubusercontent.com/FQrabbit/SSTap-Rule/master/rules/"$DOWNLOAD_PATH" -O 2>&1 >1 "$TMP_RULE_DIR"
|
||||
|
||||
if [ "$?" -eq "0" ] && [ "$(ls -l $TMP_RULE_DIR |awk '{print $5}')" -ne 0 ]; then
|
||||
|
||||
@ -75,4 +75,4 @@
|
||||
rm -rf $TMP_RULE_DIR >/dev/null 2>&1
|
||||
sleep 2
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -1,32 +1,35 @@
|
||||
|
||||
experimental:
|
||||
ignore-resolve-fail: true
|
||||
|
||||
#authentication:
|
||||
# - "user1:pass1"
|
||||
# hosts:
|
||||
# '*.clash.dev': 127.0.0.1
|
||||
# 'alpha.clash.dev': '::1'
|
||||
|
||||
#hosts:
|
||||
# '*.clash.dev': 127.0.0.1
|
||||
# 'alpha.clash.dev': '::1'
|
||||
|
||||
dns:
|
||||
enable: true
|
||||
listen: 0.0.0.0:5300
|
||||
enhanced-mode: fake-ip
|
||||
fake-ip-range: 198.18.0.1/16
|
||||
#fake-ip-filter:
|
||||
# - '*.lan'
|
||||
# - localhost.ptlogin2.qq.com
|
||||
#fake-ip-filter:
|
||||
# - '*.lan'
|
||||
# - localhost.ptlogin2.qq.com
|
||||
nameserver:
|
||||
- 114.114.114.114
|
||||
- udp://114.114.114.114
|
||||
- tls://118.89.110.78:853
|
||||
- tls://47.96.179.163:853
|
||||
- udp://8.8.8.8:53
|
||||
- udp://8.8.4.4:53
|
||||
- tcp://1.1.1.1
|
||||
fallback:
|
||||
fallback:
|
||||
- tls://118.89.110.78:853
|
||||
- tls://47.96.179.163:853
|
||||
- tcp://1.1.1.1
|
||||
- tcp://8.8.8.8
|
||||
fallback-filter:
|
||||
fallback-filter:
|
||||
geoip: true
|
||||
ipcidr:
|
||||
- 240.0.0.0/4
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
lang=$(uci get luci.main.lang 2>/dev/null)
|
||||
loadgroups=$(uci get clash.config.loadgroups 2>/dev/null)
|
||||
loadservers=$(uci get clash.config.loadservers 2>/dev/null)
|
||||
|
||||
loadprovider=$(uci get clash.config.loadprovider 2>/dev/null)
|
||||
|
||||
run_load(){
|
||||
|
||||
@ -250,7 +250,7 @@ fi
|
||||
|
||||
#awk '/^ {0,}Proxy:/,/^ {0,}Proxy Group:/{print}' $load 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\t/ /g' 2>/dev/null >/tmp/yaml_proxy.yaml 2>&1
|
||||
|
||||
if [ $loadservers -eq 1 ];then
|
||||
|
||||
|
||||
|
||||
proxy_len=$(sed -n '/^ \{0,\}Proxy:/=' $load 2>/dev/null)
|
||||
@ -310,6 +310,8 @@ cfg_gett()
|
||||
{
|
||||
echo "$(grep "$1" $single_server 2>/dev/null |awk -v tag=$1 'BEGIN{FS=tag} {print $2}' 2>/dev/null |sed 's/,.*//' 2>/dev/null |sed 's/^ \{0,\}//g' 2>/dev/null |sed 's/ \{0,\}$//g' 2>/dev/null |sed 's/ \{0,\}\}\{0,\}$//g' 2>/dev/null)"
|
||||
}
|
||||
|
||||
if [ $loadservers -eq 1 ];then
|
||||
#######READ SERVERS START
|
||||
if [ -f /tmp/yaml_proxy.yaml ];then
|
||||
while [[ "$( grep -c "config servers" $CFG_FILE )" -ne 0 ]]
|
||||
@ -497,7 +499,10 @@ elif [ $lang == "zh_cn" ];then
|
||||
fi
|
||||
fi
|
||||
#######READ SERVERS END
|
||||
fi
|
||||
|
||||
|
||||
if [ "${loadprovider}" -eq 1 ];then
|
||||
#######READ PROVIDER START
|
||||
|
||||
if [ -f /tmp/yaml_provider.yaml ];then
|
||||
@ -645,6 +650,8 @@ done
|
||||
#######READ PROVIDER END
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
rm -rf /tmp/Proxy_Group /tmp/servers.yaml /tmp/yaml_proxy.yaml /tmp/group_*.yaml /tmp/yaml_group.yaml /tmp/match_servers.list /tmp/yaml_provider.yaml /tmp/provider.yaml /tmp/provider_gen.yaml /tmp/provider_che.yaml /tmp/match_provider.list 2>/dev/null
|
||||
|
||||
/usr/share/clash/proxy.sh >/dev/null 2>&1
|
||||
|
||||
@ -1 +1 @@
|
||||
1.5.2
|
||||
1.5.3
|
||||
|
||||
@ -636,3 +636,4 @@ fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
19
package/jsda/luci-app-clash/root/usr/share/clash/restore.sh
Executable file
19
package/jsda/luci-app-clash/root/usr/share/clash/restore.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/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
|
||||
|
||||
|
||||
@ -6,17 +6,34 @@ tun:
|
||||
device-url: dev://utun
|
||||
dns-listen: 0.0.0.0:53
|
||||
|
||||
#authentication:
|
||||
# - "user1:pass1"
|
||||
|
||||
#hosts:
|
||||
# '*.clash.dev': 127.0.0.1
|
||||
# 'alpha.clash.dev': '::1'
|
||||
|
||||
dns:
|
||||
enable: true
|
||||
listen: 0.0.0.0:5300
|
||||
enhanced-mode: fake-ip
|
||||
fake-ip-range: 198.18.0.1/16
|
||||
nameserver:
|
||||
- 114.114.114.114
|
||||
- udp://114.114.114.114
|
||||
- tls://118.89.110.78:853
|
||||
- tls://47.96.179.163:853
|
||||
- udp://8.8.8.8:53
|
||||
- udp://8.8.4.4:53
|
||||
- tcp://1.1.1.1
|
||||
fallback:
|
||||
- tls://118.89.110.78:853
|
||||
- tls://47.96.179.163:853
|
||||
- tcp://1.1.1.1
|
||||
- tcp://8.8.8.8
|
||||
fallback-filter:
|
||||
geoip: true
|
||||
ipcidr:
|
||||
- 240.0.0.0/4
|
||||
|
||||
|
||||
|
||||
|
||||
@ -208,3 +208,4 @@ else
|
||||
fi
|
||||
#===========================================================================================================================
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user