luci-app-clash: bump to 1.6.3
This commit is contained in:
parent
ae80f36774
commit
273eaaa235
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-clash
|
||||
PKG_VERSION:=1.6.1
|
||||
PKG_VERSION:=1.6.3
|
||||
PKG_MAINTAINER:=frainzy1477
|
||||
|
||||
|
||||
@ -13,7 +13,6 @@ define Package/luci-app-clash
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=LuCI app for clash
|
||||
DEPENDS:=+luci-base +wget +iptables +coreutils-base64 +coreutils +coreutils-nohup +bash +ipset +libustream-openssl +libopenssl +openssl-util +curl +jsonfilter +ca-certificates +iptables-mod-tproxy
|
||||
|
||||
PKGARCH:=all
|
||||
MAINTAINER:=frainzy1477
|
||||
endef
|
||||
@ -142,10 +141,10 @@ define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/clash.txt $(1)/usr/share/clash/
|
||||
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/index.html $(1)/usr/share/clash/dashboard/
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/main.f42e08fe49cdc3329278.css $(1)/usr/share/clash/dashboard/
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/main.9ba3dbeae71a3cb9926b.css $(1)/usr/share/clash/dashboard/
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/img/33343e6117c37aaef8886179007ba6b5.png $(1)/usr/share/clash/dashboard/img/
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/js/1.bundle.f42e08fe49cdc3329278.min.js $(1)/usr/share/clash/dashboard/js/
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/js/bundle.f42e08fe49cdc3329278.min.js $(1)/usr/share/clash/dashboard/js/
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/js/1.bundle.9ba3dbeae71a3cb9926b.min.js $(1)/usr/share/clash/dashboard/js/
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/js/bundle.9ba3dbeae71a3cb9926b.min.js $(1)/usr/share/clash/dashboard/js/
|
||||
$(INSTALL_BIN) ./root/usr/share/clash/yacd/* $(1)/usr/share/clash/yacd/
|
||||
|
||||
$(INSTALL_DATA) ./luasrc/clash.lua $(1)/usr/lib/lua/luci/
|
||||
|
||||
@ -21,6 +21,11 @@ y:value("0", translate("disabled"))
|
||||
y:value("1", translate("enabled"))
|
||||
y.description = translate("Set custom DNS forwarder in DHCP and DNS Settings and forward all dns traffic to clash")
|
||||
|
||||
y = s:option(ListValue, "dnscache", translate("DNS Cache"))
|
||||
y:value("0", translate("disabled"))
|
||||
y:value("1", translate("enabled"))
|
||||
y.description = translate("Set to enable or disable dns cache")
|
||||
|
||||
y = s:option(ListValue, "enable_udp", translate("Enable UDP"))
|
||||
y:value("0", translate("disabled"))
|
||||
y:value("1", translate("enabled"))
|
||||
|
||||
@ -67,7 +67,17 @@ end
|
||||
o:depends("subcri", 'v2ssr2clash')
|
||||
|
||||
|
||||
function IsYamlFile(e)
|
||||
e=e or""
|
||||
local e=string.lower(string.sub(e,-5,-1))
|
||||
return e == ".yaml"
|
||||
end
|
||||
|
||||
function IsYmlFile(e)
|
||||
e=e or""
|
||||
local e=string.lower(string.sub(e,-4,-1))
|
||||
return e == ".yml"
|
||||
end
|
||||
|
||||
|
||||
ko = Map(clash)
|
||||
@ -103,7 +113,9 @@ http.setfilehandler(
|
||||
if eof and fd then
|
||||
fd:close()
|
||||
fd = nil
|
||||
um.value = translate("File saved to") .. ' "/usr/share/clash/config/upload/"'
|
||||
local yml=string.lower(string.sub(meta.file,0,-5))
|
||||
local c=fs.rename(dir .. meta.file,"/usr/share/clash/config/upload/".. yml .. ".yaml")
|
||||
um.value = translate("File saved to") .. ' "/usr/share/clash/config/upload/'..yml..'.yaml"'
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@ -59,6 +59,64 @@ o.write = function()
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
w = Map("clash")
|
||||
s = w:section(TypedSection, "clash" , translate("New Config(Rename fields)"))
|
||||
s.anonymous = true
|
||||
|
||||
|
||||
o = s:option(ListValue, "new_conff", translate("New Config(Rename fields)"))
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.description = translate("https://github.com/Dreamacro/clash/commit/88d8f937938d7aba774b1af638df6910b1a1a14d")
|
||||
|
||||
o=s:option(Button,"nwewcf")
|
||||
o.inputtitle = translate("Save & Apply")
|
||||
o.title = translate("Save & Apply")
|
||||
o.inputstyle = "reload"
|
||||
o.write = function()
|
||||
w.uci:commit("clash")
|
||||
end
|
||||
|
||||
o = s:option(Button, "Load")
|
||||
o.inputtitle = translate("Load Groups")
|
||||
o.title = translate("Load Groups")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
w.uci:commit("clash")
|
||||
luci.sys.call("bash /usr/share/clash/load_groups.sh >/dev/null 2>&1 &")
|
||||
luci.sys.call("sleep 4")
|
||||
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "clash", "settings", "other"))
|
||||
end
|
||||
|
||||
|
||||
r = w:section(TypedSection, "conf_groups", translate("Policy Groups"))
|
||||
r.anonymous = true
|
||||
r.addremove = false
|
||||
r.sortable = false
|
||||
r.template = "cbi/tblsection"
|
||||
function r.create(...)
|
||||
local sid = TypedSection.create(...)
|
||||
if sid then
|
||||
luci.http.redirect(r.extedit % sid)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
o = r:option(DummyValue, "type", translate("Group Type"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
|
||||
o = r:option(DummyValue, "name", translate("Group Name"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
|
||||
|
||||
y = Map("clash")
|
||||
x = y:section(TypedSection, "addtype", translate("Custom Rules"))
|
||||
x.anonymous = true
|
||||
@ -92,37 +150,5 @@ end
|
||||
|
||||
|
||||
|
||||
local t = {
|
||||
{Load,Apply}
|
||||
}
|
||||
|
||||
k = Form("apply")
|
||||
k.reset = false
|
||||
k.submit = false
|
||||
s = k:section(Table, t)
|
||||
|
||||
|
||||
o = s:option(Button, "Load")
|
||||
o.inputtitle = translate("Load Groups")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
m.uci:commit("clash")
|
||||
luci.sys.call("bash /usr/share/clash/load_groups.sh >/dev/null 2>&1 &")
|
||||
luci.sys.call("sleep 3")
|
||||
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "clash", "settings", "other"))
|
||||
end
|
||||
|
||||
o = s:option(Button, "Apply")
|
||||
o.inputtitle = translate("Save & Apply")
|
||||
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 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "clash"))
|
||||
else
|
||||
HTTP.redirect(luci.dispatcher.build_url("admin", "services", "clash", "settings", "other"))
|
||||
end
|
||||
end
|
||||
|
||||
return kk, m,y,k
|
||||
return kk, m,w,y
|
||||
|
||||
@ -1033,3 +1033,9 @@ msgstr "启用UDP"
|
||||
|
||||
msgid "Enable udp traffic ,make sure your server support udp"
|
||||
msgstr "启用udp流量,服务器必须支持udp"
|
||||
|
||||
msgid "DNS Cache"
|
||||
msgstr "DNS缓存"
|
||||
|
||||
msgid "Set to enable or disable dns cache"
|
||||
msgstr "设置为启用或禁用dns缓存"
|
||||
@ -31,7 +31,7 @@ config clash 'config'
|
||||
option enable_udp '0'
|
||||
option new_conf '0'
|
||||
option ping_enable '1'
|
||||
|
||||
option dnscache '0'
|
||||
|
||||
config groups
|
||||
option old_name '❌AdBlock'
|
||||
|
||||
@ -33,7 +33,7 @@ revert_dns() {
|
||||
add_cron(){
|
||||
config_type=$(uci get clash.config.config_type 2>/dev/null)
|
||||
#===========================================================================================================================
|
||||
[ -z "$(grep -w "/usr/share/clash/clash-watchdog.sh" $CRON_FILE)" ] && echo "*/2 * * * * /usr/share/clash/clash-watchdog.sh" >> $CRON_FILE
|
||||
[ -z "$(grep -w "/usr/share/clash/clash-watchdog.sh" $CRON_FILE)" ] && echo "*/3 * * * * /usr/share/clash/clash-watchdog.sh" >> $CRON_FILE
|
||||
[ -z "$(grep -w "/usr/share/clash/kill_watchdog.sh" $CRON_FILE)" ] && echo "*/1 * * * * /usr/share/clash/kill_watchdog.sh" >> $CRON_FILE
|
||||
clear=$(uci get clash.config.auto_clear_log 2>/dev/null)
|
||||
if [ "${clear}" -eq 1 ]; then
|
||||
@ -84,7 +84,6 @@ if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "正在检查配置文件。。。" >$REAL_LOG
|
||||
fi
|
||||
sleep 1
|
||||
|
||||
if [ -f $CONFIG_YAML_PATH ] && [ "$(ls -l $CONFIG_YAML_PATH|awk '{print int($5)}')" -ne 0 ];then
|
||||
|
||||
@ -139,16 +138,16 @@ ip_rules() {
|
||||
|
||||
|
||||
yml_dns_change(){
|
||||
#===========================================================================================================================
|
||||
dns_port=$(grep "^ \{0,\}listen:" $CONFIG_YAML |awk -F ':' '{print $3}' 2>/dev/null)
|
||||
#===========================================================================================================================
|
||||
dns_port=$(grep "^ \{0,\}listen:" /etc/clash/config.yaml |awk -F ':' '{print $3}' 2>/dev/null)
|
||||
dnsforwader=$(uci get clash.config.dnsforwader 2>/dev/null)
|
||||
dnscache=$(egrep '^ {0,}enhanced-mode' /etc/clash/config.yaml |grep enhanced-mode: |awk -F ': ' '{print $2}')
|
||||
dnscache=$(uci get clash.config.dnscache 2>/dev/null)
|
||||
if [ "${dns_port}" -eq 53 ]; then
|
||||
sed -i 's/0.0.0.0:53/0.0.0.0:5300/g' $CONFIG_YAML
|
||||
fi
|
||||
|
||||
if [ "${dnsforwader}" -ne 0 ]; then
|
||||
if [ "${dns_port}" -eq 53 ]; then
|
||||
if [ "$dnsforwader" -eq 1 ]; then
|
||||
if [ "$dns_port" -eq 53 ]; then
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Setting dns forwarder" >$REAL_LOG
|
||||
@ -163,7 +162,8 @@ yml_dns_change(){
|
||||
uci add_list dhcp.@dnsmasq[0].server=127.0.0.1#5300 >/dev/null 2>&1
|
||||
uci delete dhcp.@dnsmasq[0].resolvfile
|
||||
uci set dhcp.@dnsmasq[0].noresolv=1
|
||||
if [ "${dnscache}" == "fake-ip" ];then
|
||||
uci commit dhcp
|
||||
if [ "$dnscache" -eq 0 ];then
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Disabling dns cache" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
@ -181,26 +181,26 @@ yml_dns_change(){
|
||||
uci add_list dhcp.@dnsmasq[0].server=127.0.0.1#$dns_port >/dev/null 2>&1
|
||||
uci delete dhcp.@dnsmasq[0].resolvfile
|
||||
uci set dhcp.@dnsmasq[0].noresolv=1
|
||||
|
||||
if [ "${dnscache}" == "fake-ip" ];then
|
||||
uci commit dhcp
|
||||
if [ "$dnscache" -eq 0 ];then
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Disabling dns cache" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "禁用dns缓存" >$REAL_LOG
|
||||
fi
|
||||
sleep 1
|
||||
|
||||
uci set dhcp.@dnsmasq[0].cachesize=0
|
||||
uci commit dhcp
|
||||
fi
|
||||
fi
|
||||
elif [ "${dnsforwader}" -eq 0 ]; then
|
||||
if [ "${dnscache}" == "fake-ip" ];then
|
||||
elif [ "$dnsforwader" -eq 0 ]; then
|
||||
if [ "$dnscache" -eq 0 ];then
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Disabling dns cache" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "禁用dns缓存" >$REAL_LOG
|
||||
fi
|
||||
sleep 1
|
||||
|
||||
uci set dhcp.@dnsmasq[0].cachesize=0
|
||||
uci commit dhcp
|
||||
fi
|
||||
@ -249,7 +249,7 @@ rules(){
|
||||
done
|
||||
fi
|
||||
|
||||
iptables -t nat -A clash -p tcp -j REDIRECT --to-ports "${redir_port}"
|
||||
iptables -t nat -A clash -p tcp -j REDIRECT --to-ports "${redir_port}"
|
||||
iptables -t nat -A PREROUTING -p tcp -j clash
|
||||
|
||||
|
||||
@ -275,13 +275,10 @@ rules(){
|
||||
fi
|
||||
|
||||
iptables -t mangle -A clash -p udp -j TPROXY --on-port "${redir_port}" --tproxy-mark 1
|
||||
#iptables -t mangle -A clash -p udp --dport 53 -j TPROXY --on-port "${redir_port}" --tproxy-mark 0x01/0x01
|
||||
iptables -t mangle -A PREROUTING -p udp -j clash
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
fake_ip_range=$(egrep '^ {0,}fake-ip-range' /etc/clash/config.yaml |grep fake-ip-range: |awk -F ': ' '{print $2}')
|
||||
|
||||
if [ ! -z "${fake_ip_range}" ];then
|
||||
@ -400,8 +397,7 @@ if [ "${enable}" -eq 1 ]; then
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "启动客户端..." >$REAL_LOG
|
||||
fi
|
||||
sleep 2
|
||||
|
||||
sleep 1
|
||||
select_config >/dev/null 2>&1
|
||||
|
||||
if [ "${core}" -eq 1 ] && [ ! -f /etc/clash/clash ]; then
|
||||
@ -412,7 +408,7 @@ if [ "${core}" -eq 1 ] && [ ! -f /etc/clash/clash ]; then
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - 找不到/etc/clash/clash,请从更新页下载clash内核" >> /usr/share/clash/clash.txt
|
||||
echo "找不到/etc/clash/clash,请从更新页下载clash内核" >> $REAL_LOG
|
||||
fi
|
||||
sleep 2
|
||||
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
elif [ "${core}" -eq 2 ] && [ ! -f /usr/bin/clash ]; then
|
||||
@ -423,7 +419,7 @@ elif [ "${core}" -eq 2 ] && [ ! -f /usr/bin/clash ]; then
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - 找不到/usr/bin/clash,请从更新页下载clashr内核" >> /usr/share/clash/clash.txt
|
||||
echo "找不到/usr/bin/clash,请从更新页下载clashr内核" >> $REAL_LOG
|
||||
fi
|
||||
sleep 2
|
||||
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
elif [ "${core}" -eq 3 ] && [ ! -f /etc/clash/clashtun/clash ]; then
|
||||
@ -434,13 +430,15 @@ elif [ "${core}" -eq 3 ] && [ ! -f /etc/clash/clashtun/clash ]; then
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - 找不到/etc/clash/clashtun/clash, clash Tun内核" >> /usr/share/clash/clash.txt
|
||||
echo "找不到/usr/bin/clash, clash Tun内核" >> $REAL_LOG
|
||||
fi
|
||||
sleep 2
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
else
|
||||
if [ -f $CONFIG_YAML ] && [ "$(ls -l $CONFIG_YAML|awk '{print int($5/1024)}')" -ne 0 ] ; then
|
||||
new_conf=$(uci get clash.config.new_conf 2>/dev/null)
|
||||
|
||||
yml_change >/dev/null 2>&1
|
||||
|
||||
if [ "$new_conf" -eq 1 ];then
|
||||
check >/dev/null 2>&1
|
||||
fi
|
||||
@ -453,7 +451,7 @@ if [ -f $CONFIG_YAML ] && [ "$(ls -l $CONFIG_YAML|awk '{print int($5/1024)}')"
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "Clash内核不支持你的配置,改用Clashr内核" >$REAL_LOG
|
||||
fi
|
||||
sleep 5
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
fi
|
||||
@ -465,7 +463,6 @@ if [ -f $CONFIG_YAML ] && [ "$(ls -l $CONFIG_YAML|awk '{print int($5/1024)}')"
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "设置自定义lan dns服务器" >$REAL_LOG
|
||||
fi
|
||||
sleep 1
|
||||
uci set network.lan.dns="${landns}" && uci commit network && /etc/init.d/network reload >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
@ -476,7 +473,7 @@ if [ -f $CONFIG_YAML ] && [ "$(ls -l $CONFIG_YAML|awk '{print int($5/1024)}')"
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "找不到Country.mmdb" >$REAL_LOG
|
||||
fi
|
||||
sleep 5
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
fi
|
||||
@ -487,20 +484,16 @@ if [ -f $CONFIG_YAML ] && [ "$(ls -l $CONFIG_YAML|awk '{print int($5/1024)}')"
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "找不到config.yaml" >$REAL_LOG
|
||||
fi
|
||||
sleep 5
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
fi
|
||||
|
||||
yml_dns_change >/dev/null 2>&1
|
||||
|
||||
sleep 2
|
||||
|
||||
game_rules >/dev/null 2>&1
|
||||
|
||||
sleep 1
|
||||
|
||||
ip_rules >/dev/null 2>&1
|
||||
ip_rules >/dev/null 2>&1
|
||||
|
||||
if [ "${core}" -eq 1 ];then
|
||||
nohup $CLASH -d "$CLASH_CONFIG" > /usr/share/clash/clash.txt 2>&1 &
|
||||
@ -537,21 +530,7 @@ if [ -f $CONFIG_YAML ] && [ "$(ls -l $CONFIG_YAML|awk '{print int($5/1024)}')"
|
||||
fi
|
||||
|
||||
fi
|
||||
ln -s /usr/share/clash/yacd /www/luci-static/yacd 2>/dev/null
|
||||
sleep 2
|
||||
restore >/dev/null 2>&1
|
||||
|
||||
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
|
||||
|
||||
fi
|
||||
|
||||
|
||||
sleep 1
|
||||
ln -s /usr/share/clash/yacd /www/luci-static/yacd 2>/dev/null
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Setting up clash iptables rules" >$REAL_LOG
|
||||
@ -559,17 +538,15 @@ 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
|
||||
rules >/dev/null 2>&1
|
||||
|
||||
custom_list >/dev/null 2>&1
|
||||
sleep 1
|
||||
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Restarting Dnsmasq " >$REAL_LOG
|
||||
@ -578,33 +555,40 @@ if [ -f $CONFIG_YAML ] && [ "$(ls -l $CONFIG_YAML|awk '{print int($5/1024)}')"
|
||||
fi
|
||||
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
sleep 1
|
||||
|
||||
restore >/dev/null 2>&1
|
||||
|
||||
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
|
||||
|
||||
fi
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Clash Started Successfully " >$REAL_LOG
|
||||
sleep 2
|
||||
sleep 1
|
||||
echo "Clash is Running " >$REAL_LOG
|
||||
sleep 2
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "Clash 启动成功,请等待服务器上线!" >$REAL_LOG
|
||||
sleep 2
|
||||
sleep 1
|
||||
echo "Clash运行中" >$REAL_LOG
|
||||
sleep 2
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
fi
|
||||
|
||||
#nohup /usr/share/clash/clash-watchdog.sh >/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
|
||||
echo " problem with config file " >$REAL_LOG
|
||||
sleep 5
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - 你的config.yaml有问题还是为了空 0kb " >> /usr/share/clash/clash.txt
|
||||
echo " 你的config.yaml有问题还是为了空 0kb " >$REAL_LOG
|
||||
sleep 5
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
fi
|
||||
fi
|
||||
@ -613,12 +597,12 @@ else
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Enable Client and Start Client Again" >$REAL_LOG
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - Enable Client and Start Client Again" >>/usr/share/clash/clash.txt
|
||||
sleep 3
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "启用客户端并重新启动客户端" >$REAL_LOG
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - 启用客户端并重新启动客户端" >>/usr/share/clash/clash.txt
|
||||
sleep 3
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
fi
|
||||
fi
|
||||
@ -697,7 +681,7 @@ stop(){
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo "正在停止客户端..." >$REAL_LOG
|
||||
fi
|
||||
sleep 2
|
||||
sleep 1
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Removing clash iptables rules" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
@ -710,16 +694,12 @@ stop(){
|
||||
iptables -t nat -F clash >/dev/null 2>&1 && iptables -t nat -X clash >/dev/null 2>&1
|
||||
iptables -t mangle -F clash >/dev/null 2>&1 && iptables -t mangle -D PREROUTING -p udp -j clash >/dev/null 2>&1 && iptables -t mangle -X clash >/dev/null 2>&1
|
||||
done
|
||||
|
||||
sleep 1
|
||||
|
||||
ip rule del fwmark 1 table 100 >/dev/null 2>&1
|
||||
ip route del local default dev lo table 100 >/dev/null 2>&1
|
||||
|
||||
iptables -t nat -D PREROUTING -p tcp --dport 53 -j ACCEPT >/dev/null 2>&1
|
||||
|
||||
sleep 1
|
||||
|
||||
ip6tables -t mangle -F clash >/dev/null 2>&1
|
||||
ip6tables -t mangle -D PREROUTING -p udp -j clash >/dev/null 2>&1
|
||||
ip6tables -t mangle -X clash >/dev/null 2>&1
|
||||
@ -764,7 +744,6 @@ stop(){
|
||||
|
||||
kill -9 `pidof clash|sed "s/$//g"` 2>/dev/null
|
||||
rm -rf /www/luci-static/yacd 2>/dev/null
|
||||
sleep 1
|
||||
|
||||
if [ ! -z "${delandns}" ];then
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
@ -791,7 +770,6 @@ stop(){
|
||||
fi
|
||||
|
||||
revert_dns >/dev/null 2>&1
|
||||
sleep 1
|
||||
|
||||
echo "" >/usr/share/clash/clash.txt >/dev/null 2>&1
|
||||
|
||||
@ -800,15 +778,14 @@ stop(){
|
||||
if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - CLIENT IS DISABLED " >> /usr/share/clash/clash.txt
|
||||
echo "Client is Disabled " >$REAL_LOG
|
||||
sleep 2
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
elif [ "${lang}" == "zh_cn" ];then
|
||||
echo " $(date "+%Y-%m-%d %H:%M:%S") - 客户端被禁用 " >> /usr/share/clash/clash.txt
|
||||
echo "客户端被禁用 " >$REAL_LOG
|
||||
sleep 2
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if pidof clash >/dev/null; then
|
||||
kill $(pidof clash) >/dev/null 2>&1 || kill -9 $(ps | grep clash | grep -v grep | awk '{print $1}') >/dev/null 2>&1
|
||||
|
||||
@ -4,9 +4,9 @@
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="icon" type="image/x-icon" href="https://cdn.jsdelivr.net/gh/Dreamacro/clash/docs/logo.png" />
|
||||
<title>Clash Dashboard</title>
|
||||
<link href="main.f42e08fe49cdc3329278.css" rel="stylesheet"></head>
|
||||
<title>Clash</title>
|
||||
<link href="main.9ba3dbeae71a3cb9926b.css" rel="stylesheet"></head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="text/javascript" src="js/1.bundle.f42e08fe49cdc3329278.min.js"></script><script type="text/javascript" src="js/bundle.f42e08fe49cdc3329278.min.js"></script></body>
|
||||
<script type="text/javascript" src="js/1.bundle.9ba3dbeae71a3cb9926b.min.js"></script><script type="text/javascript" src="js/bundle.9ba3dbeae71a3cb9926b.min.js"></script></body>
|
||||
</html>
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -36,8 +36,6 @@ rm -rf /tmp/Proxy_Group /tmp/servers.yaml /tmp/yaml_proxy.yaml /tmp/group_*.yaml
|
||||
echo "Start updating policy group config" >$REAL_LOG
|
||||
fi
|
||||
|
||||
sleep 3
|
||||
|
||||
if [ "${new_conf}" -eq 1 ];then
|
||||
sed -i 's/Proxy Group:/proxy-groups:/g' "$load"
|
||||
sed -i 's/proxy-provider:/proxy-providers:/g' "$load"
|
||||
|
||||
@ -4,12 +4,12 @@
|
||||
lang=$(uci get luci.main.lang 2>/dev/null)
|
||||
load="/etc/clash/config.yaml"
|
||||
CONFIG_YAML_PATH=$(uci get clash.config.use_config 2>/dev/null)
|
||||
new_conf=$(uci get clash.config.new_conff 2>/dev/null)
|
||||
|
||||
if [ -f $CONFIG_YAML_PATH ] && [ "$(ls -l $CONFIG_YAML_PATH|awk '{print int($5)}')" -ne 0 ];then
|
||||
cp $CONFIG_YAML_PATH $load 2>/dev/null
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f $load ] || [ "$(ls -l $load|awk '{print int($5)}')" -eq 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
@ -27,7 +27,13 @@ rm -rf /tmp/Proxy_Group /tmp/group_*.yaml /tmp/yaml_group.yaml 2>/dev/null
|
||||
fi
|
||||
|
||||
sleep 3
|
||||
|
||||
if [ "${new_conf}" -eq 1 ];then
|
||||
sed -i 's/Proxy Group:/proxy-groups:/g' "$load"
|
||||
sed -i 's/proxy-provider:/proxy-providers:/g' "$load"
|
||||
sed -i 's/Proxy:/proxies:/g' "$load"
|
||||
sed -i 's/Rule:/rules:/g' "$load"
|
||||
else
|
||||
|
||||
[ ! -z "$(grep "^ \{0,\}'Proxy':" "$load")" ] || [ ! -z "$(grep '^ \{0,\}"Proxy":' "$load")" ] && {
|
||||
sed -i "/^ \{0,\}\'Proxy\':/c\Proxy:" "$load"
|
||||
sed -i '/^ \{0,\}\"Proxy\":/c\Proxy:' "$load"
|
||||
@ -52,7 +58,9 @@ rm -rf /tmp/Proxy_Group /tmp/group_*.yaml /tmp/yaml_group.yaml 2>/dev/null
|
||||
sed -i "/^ \{0,\}\'dns\':/c\dns:" "$load"
|
||||
sed -i '/^ \{0,\}\"dns\":/c\dns:' "$load"
|
||||
}
|
||||
fi
|
||||
|
||||
if [ "${new_conf}" -eq 0 ];then
|
||||
group_len=$(sed -n '/^ \{0,\}Proxy Group:/=' "$load" 2>/dev/null)
|
||||
provider_len=$(sed -n '/^ \{0,\}proxy-provider:/=' "$load" 2>/dev/null)
|
||||
if [ "$provider_len" -ge "$group_len" ]; then
|
||||
@ -61,7 +69,17 @@ rm -rf /tmp/Proxy_Group /tmp/group_*.yaml /tmp/yaml_group.yaml 2>/dev/null
|
||||
else
|
||||
awk '/Proxy:/,/Rule:/{print}' "$load" 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed 's/\t/ /g' 2>/dev/null |grep name: |awk -F 'name:' '{print $2}' |sed 's/,.*//' |sed 's/^ \{0,\}//' 2>/dev/null |sed 's/ \{0,\}$//' 2>/dev/null |sed 's/ \{0,\}\}\{0,\}$//g' 2>/dev/null >/tmp/Proxy_Group 2>&1
|
||||
fi
|
||||
|
||||
elif [ "${new_conf}" -eq 1 ];then
|
||||
group_len=$(sed -n '/^ \{0,\}proxy-groups:/=' "$load" 2>/dev/null)
|
||||
provider_len=$(sed -n '/^ \{0,\}proxy-providers:/=' "$load" 2>/dev/null)
|
||||
if [ "$provider_len" -ge "$group_len" ]; then
|
||||
awk '/proxies:/,/proxy-providers:/{print}' "$load" 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed 's/\t/ /g' 2>/dev/null |grep name: |awk -F 'name:' '{print $2}' |sed 's/,.*//' |sed 's/^ \{0,\}//' 2>/dev/null |sed 's/ \{0,\}$//' 2>/dev/null |sed 's/ \{0,\}\}\{0,\}$//g' 2>/dev/null >/tmp/Proxy_Group 2>&1
|
||||
sed -i "s/proxy-providers://g" /tmp/Proxy_Group 2>&1
|
||||
else
|
||||
awk '/proxies:/,/rules:/{print}' "$load" 2>/dev/null |sed "s/\'//g" 2>/dev/null |sed 's/\"//g' 2>/dev/null |sed 's/\t/ /g' 2>/dev/null |grep name: |awk -F 'name:' '{print $2}' |sed 's/,.*//' |sed 's/^ \{0,\}//' 2>/dev/null |sed 's/ \{0,\}$//' 2>/dev/null |sed 's/ \{0,\}\}\{0,\}$//g' 2>/dev/null >/tmp/Proxy_Group 2>&1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if [ "$?" -eq "0" ]; then
|
||||
echo 'DIRECT' >>/tmp/Proxy_Group
|
||||
@ -75,7 +93,7 @@ rm -rf /tmp/Proxy_Group /tmp/group_*.yaml /tmp/yaml_group.yaml 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ "${new_conf}" -eq 0 ];then
|
||||
group_len=$(sed -n '/^ \{0,\}Proxy Group:/=' "$load" 2>/dev/null)
|
||||
provider_len=$(sed -n '/^ \{0,\}proxy-provider:/=' "$load" 2>/dev/null)
|
||||
if [ "$provider_len" -ge "$group_len" ]; then
|
||||
@ -84,7 +102,17 @@ if [ "$provider_len" -ge "$group_len" ]; then
|
||||
else
|
||||
awk '/Proxy Group:/,/Rule:/{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_group.yaml 2>&1
|
||||
fi
|
||||
elif [ "${new_conf}" -eq 1 ];then
|
||||
group_len=$(sed -n '/^ \{0,\}proxy-groups:/=' "$load" 2>/dev/null)
|
||||
provider_len=$(sed -n '/^ \{0,\}proxy-providers:/=' "$load" 2>/dev/null)
|
||||
if [ "$provider_len" -ge "$group_len" ]; then
|
||||
awk '/proxy-groups:/,/proxy-providers:/{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_group.yaml 2>&1
|
||||
sed -i "s/proxy-providers://g" /tmp/yaml_group.yaml 2>&1
|
||||
else
|
||||
awk '/proxy-groups:/,/rules:/{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_group.yaml 2>&1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
#######READ GROUPS START
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
1.6.1
|
||||
1.6.3
|
||||
|
||||
@ -54,8 +54,6 @@ if [ "${create}" -eq 1 ];then
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "开始创建自定义配置..." >$REAL_LOG
|
||||
fi
|
||||
sleep 1
|
||||
|
||||
|
||||
CONFIG_YAML_RULE="/usr/share/clash/custom_rule.yaml"
|
||||
SERVER_FILE="/tmp/servers.yaml"
|
||||
@ -82,7 +80,6 @@ PROVIDER_FILE="/tmp/yaml_provider.yaml"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
sleep 2
|
||||
|
||||
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ if [ $type == "clash" ] && [ ! -z $url ];then
|
||||
echo "更新配置完成" >$REAL_LOG
|
||||
|
||||
fi
|
||||
sleep 5
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ if [ $type == "clash" ] && [ ! -z $url ];then
|
||||
echo "更新配置完成" >$REAL_LOG
|
||||
|
||||
fi
|
||||
sleep 5
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ if [ ! -z $check_name ];then
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "已存在同名配置,请重命名名配置重新下载" >$REAL_LOG
|
||||
fi
|
||||
sleep 5
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
exit 0
|
||||
|
||||
@ -433,14 +433,14 @@ do
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "下载配置完成" >$REAL_LOG
|
||||
fi
|
||||
sleep 2
|
||||
sleep 1
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Strating to Create Custom Config.. " >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "开始创建自定义配置..." >$REAL_LOG
|
||||
fi
|
||||
sleep 2
|
||||
sleep 1
|
||||
|
||||
if [ $curl_code -eq 0 ];then
|
||||
ssr_url=($(echo $subscribe_data | base64 -d | sed 's/\r//g'))
|
||||
@ -608,16 +608,15 @@ DNS_FILE="/usr/share/clash/dns.yaml"
|
||||
if [ $servcount -eq 0 ] || [ $gcount -eq 0 ];then
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "No servers or group. Aborting Operation .." >$REAL_LOG
|
||||
sleep 2
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "找不到代理或策略组。中止操作..." >$REAL_LOG
|
||||
sleep 2
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
sleep 2
|
||||
servers_set()
|
||||
{
|
||||
local section="$1"
|
||||
@ -917,18 +916,15 @@ rm -rf $TEMP_FILE $GROUP_FILE $Proxy_Group $CONFIG_FILE
|
||||
|
||||
if [ $lang == "en" ] || [ $lang == "auto" ];then
|
||||
echo "Completed Creating Custom Config.. " >$REAL_LOG
|
||||
sleep 2
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "创建自定义配置完成..." >$REAL_LOG
|
||||
sleep 2
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
fi
|
||||
|
||||
|
||||
|
||||
mv /usr/share/clash/v2ssr/config.bak /etc/config/clash 2>/dev/null
|
||||
sleep 1
|
||||
|
||||
if [ $config_type == "sub" ];then
|
||||
if pidof clash >/dev/null; then
|
||||
|
||||
@ -69,7 +69,7 @@ if [ "$core" -eq 1 ] || [ "$core" -eq 2 ];then
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "设置端口,DNS和密码..." >$REAL_LOG
|
||||
fi
|
||||
sleep 2
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
if [ ! -z "$(grep "^Proxy:" "$CONFIG_YAML")" ]; then
|
||||
sed -i "/Proxy:/i\#clash-openwrt" $CONFIG_YAML 2>/dev/null
|
||||
@ -126,7 +126,7 @@ if [ "${core}" -eq 3 ] || [ "${core}" -eq 4 ];then
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "设置端口,DNS和密码..." >$REAL_LOG
|
||||
fi
|
||||
sleep 2
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
|
||||
if [ ! -z "$(grep "^Proxy:" "$CONFIG_YAML")" ]; then
|
||||
@ -180,7 +180,7 @@ else
|
||||
elif [ $lang == "zh_cn" ];then
|
||||
echo "设置端口,DNS和密码..." >$REAL_LOG
|
||||
fi
|
||||
sleep 2
|
||||
sleep 1
|
||||
echo "Clash for OpenWRT" >$REAL_LOG
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user