luci-app-openclash: bump to v0.15.0-21-g5829c3d
This commit is contained in:
parent
d2faf3c2f2
commit
6a2755e171
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-openclash
|
||||
PKG_VERSION:=0.33.3
|
||||
PKG_VERSION:=0.33.6
|
||||
PKG_RELEASE:=beta
|
||||
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
|
||||
|
||||
@ -14,7 +14,7 @@ define Package/$(PKG_NAME)
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=LuCI support for clash
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+luci +luci-base +iptables +coreutils +coreutils-nohup +bash +wget
|
||||
DEPENDS:=+luci +luci-base +iptables +dnsmasq-full +coreutils +coreutils-nohup +bash +wget
|
||||
MAINTAINER:=vernesong
|
||||
endef
|
||||
|
||||
@ -39,7 +39,6 @@ endef
|
||||
define Package/$(PKG_NAME)/preinst
|
||||
#!/bin/sh
|
||||
if [ -f "/etc/config/openclash" ]; then
|
||||
uci set openclash.config.enable=0 && uci commit openclash
|
||||
cp "/etc/config/openclash" "/tmp/openclash.bak" 2>/dev/null
|
||||
cp "/etc/config/openclash_custom_rules.list" "/tmp/openclash_custom_rules.list.bak" 2>/dev/null
|
||||
cp "/etc/config/openclash_custom_hosts.list" "/tmp/openclash_custom_hosts.list.bak" 2>/dev/null
|
||||
@ -48,10 +47,19 @@ endef
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
rm -rf /tmp/luci*
|
||||
uci delete ucitrack.@openclash[-1] >/dev/null 2>&1
|
||||
uci add ucitrack openclash >/dev/null 2>&1
|
||||
uci set ucitrack.@openclash[-1].init=openclash >/dev/null 2>&1
|
||||
uci commit ucitrack >/dev/null 2>&1
|
||||
uci delete firewall.openclash >/dev/null 2>&1
|
||||
uci set firewall.openclash=include >/dev/null 2>&1
|
||||
uci set firewall.openclash.type=script >/dev/null 2>&1
|
||||
uci set firewall.openclash.path=/var/etc/openclash.include >/dev/null 2>&1
|
||||
uci set firewall.openclash.reload=1 >/dev/null 2>&1
|
||||
uci commit firewall >/dev/null 2>&1
|
||||
if [ -f "/tmp/openclash.bak" ]; then
|
||||
mv "/tmp/openclash.bak" "/etc/config/openclash" 2>/dev/null
|
||||
mv "/tmp/openclash_custom_rules.list.bak" "/etc/config/openclash_custom_rules.list" 2>/dev/null
|
||||
#mv "/tmp/openclash_custom_rules.list.bak" "/etc/config/openclash_custom_rules.list" 2>/dev/null
|
||||
mv "/tmp/openclash_custom_hosts.list.bak" "/etc/config/openclash_custom_hosts.list" 2>/dev/null
|
||||
fi
|
||||
if [ -f "/tmp/config.yaml" ]; then
|
||||
@ -59,16 +67,14 @@ if [ -f "/tmp/config.yaml" ]; then
|
||||
elif [ -f "/tmp/config.yml" ]; then
|
||||
mv "/tmp/config.yml" "/etc/openclash/config.yaml" 2>/dev/null
|
||||
fi
|
||||
uci set openclash.config.enable=0 && uci commit openclash
|
||||
rm -rf /tmp/luci*
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/prerm
|
||||
#!/bin/sh
|
||||
update=$(uci get openclash.config.update 2>/dev/null)
|
||||
if [ "$update" != 1 ]; then
|
||||
if [ ! -f "/tmp/openclash_update.sh" ]; then
|
||||
rm -rf /etc/openclash/clash 2>/dev/null
|
||||
uci set openclash.config.enable=0 && uci commit openclash
|
||||
else
|
||||
uci set openclash.config.enable=1 && uci commit openclash
|
||||
fi
|
||||
cp "/etc/config/openclash" "/tmp/openclash.bak" 2>/dev/null
|
||||
cp "/etc/config/openclash_custom_rules.list" "/tmp/openclash_custom_rules.list.bak" 2>/dev/null
|
||||
@ -90,10 +96,11 @@ fi
|
||||
rm -rf /tmp/Proxy_Group 2>/dev/null
|
||||
rm -rf /tmp/openclash_last_version 2>/dev/null
|
||||
rm -rf /tmp/clash_last_version 2>/dev/null
|
||||
uci delete firewall.openclash
|
||||
uci commit firewall
|
||||
uci delete ucitrack.@openclash[-1]
|
||||
uci commit ucitrack
|
||||
uci delete firewall.openclash >/dev/null 2>&1
|
||||
uci commit firewall >/dev/null 2>&1
|
||||
uci delete ucitrack.@openclash[-1] >/dev/null 2>&1
|
||||
uci commit ucitrack >/dev/null 2>&1
|
||||
rm -rf /tmp/luci*
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
|
||||
@ -15,4 +15,4 @@ config openclash 'config'
|
||||
option other_rule_auto_update '0'
|
||||
option core_version '0'
|
||||
option en_mode 'redir-host'
|
||||
option update '0'
|
||||
option enable_redirect_dns '1'
|
||||
@ -7,7 +7,24 @@
|
||||
##- DST-PORT,80,DIRECT 匹配数据目标端口(直连)
|
||||
##- SRC-PORT,7777,DIRECT 匹配数据源端口(直连)
|
||||
|
||||
##排序在上的规则优先生效,如添加(去除#号):
|
||||
##- SRC-IP-CIDR,192.168.1.201/32,Rule
|
||||
##- SRC-IP-CIDR,192.168.1.0/24,DIRECT
|
||||
##此时IP为192.168.1.201的客户端流量走代理(策略),其余客户端不走代理
|
||||
##排序在上的规则优先生效,如添加(去除规则前的#号):
|
||||
##IP段:192.168.1.2-192.168.1.200 直连
|
||||
##- SRC-IP-CIDR,192.168.1.2/31,DIRECT
|
||||
##- SRC-IP-CIDR,192.168.1.4/30,DIRECT
|
||||
##- SRC-IP-CIDR,192.168.1.8/29,DIRECT
|
||||
##- SRC-IP-CIDR,192.168.1.16/28,DIRECT
|
||||
##- SRC-IP-CIDR,192.168.1.32/27,DIRECT
|
||||
##- SRC-IP-CIDR,192.168.1.64/26,DIRECT
|
||||
##- SRC-IP-CIDR,192.168.1.128/26,DIRECT
|
||||
##- SRC-IP-CIDR,192.168.1.192/29,DIRECT
|
||||
##- SRC-IP-CIDR,192.168.1.200/32,DIRECT
|
||||
|
||||
##IP段:192.168.1.202-192.168.1.255 直连
|
||||
##- SRC-IP-CIDR,192.168.1.202/31,DIRECT
|
||||
##- SRC-IP-CIDR,192.168.1.204/30,DIRECT
|
||||
##- SRC-IP-CIDR,192.168.1.208/28,DIRECT
|
||||
##- SRC-IP-CIDR,192.168.1.224/27,DIRECT
|
||||
|
||||
##此时IP为192.168.1.1和192.168.1.201的客户端流量走代理(策略),其余客户端不走代理
|
||||
##因为Fake-IP模式下,IP地址为192.168.1.1的路由器自身流量可走代理(策略),所以需要排除
|
||||
##在线IP段转CIDR地址:http://ip2cidr.com
|
||||
@ -42,6 +42,21 @@ del_cron()
|
||||
/etc/init.d/cron restart
|
||||
}
|
||||
|
||||
change_dns() {
|
||||
uci add_list dhcp.@dnsmasq[0].server=127.0.0.1#"$dns_port"
|
||||
uci delete dhcp.@dnsmasq[0].resolvfile
|
||||
uci set dhcp.@dnsmasq[0].noresolv=1
|
||||
uci commit dhcp
|
||||
}
|
||||
|
||||
revert_dns() {
|
||||
dns_port=$(uci get openclash.config.dns_port 2>/dev/null)
|
||||
uci del_list dhcp.@dnsmasq[0].server=127.0.0.1#"$dns_port" >/dev/null 2>&1
|
||||
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto
|
||||
uci set dhcp.@dnsmasq[0].noresolv=0
|
||||
uci commit dhcp
|
||||
}
|
||||
|
||||
yml_check()
|
||||
{
|
||||
#创建启动备份
|
||||
@ -117,6 +132,8 @@ yml_dns_check()
|
||||
else
|
||||
sed -i "/^dns:/a\ listen: 0.0.0.0:${dns_port}" "$CONFIG_FILE" 2>/dev/null
|
||||
fi
|
||||
|
||||
uci set openclash.config.dns_port="$dns_port" && uci commit openclash
|
||||
|
||||
}
|
||||
|
||||
@ -307,6 +324,8 @@ if [ "$enable" -eq 1 ] && [ -f "$CONFIG_FILE" ]; then
|
||||
ipv6_enable=$(uci get openclash.config.ipv6_enable 2>/dev/null)
|
||||
http_port=$(uci get openclash.config.http_port 2>/dev/null)
|
||||
socks_port=$(uci get openclash.config.socks_port 2>/dev/null)
|
||||
enable_redirect_dns=$(uci get openclash.config.enable_redirect_dns 2>/dev/null)
|
||||
lan_ip=$(uci get network.lan.ipaddr 2>/dev/null)
|
||||
echo "第二步: 配置文件检查..." >$START_LOG
|
||||
yml_check "$en_mode" "$enable_custom_dns" "$CONFIG_FILE" "$BACKUP_FILE" "$START_BACKUP"
|
||||
grep "^ \{0,\}Proxy:" $CONFIG_FILE >/dev/null 2>&1 && grep "^ \{0,\}Proxy Group:" $CONFIG_FILE >/dev/null 2>&1 && grep "^ \{0,\}Rule:" $CONFIG_FILE >/dev/null 2>&1
|
||||
@ -325,7 +344,7 @@ if [ "$enable" -eq 1 ] && [ -f "$CONFIG_FILE" ]; then
|
||||
yml_cut "$CHANGE_FILE" "$RULE_FILE" "$DNS_FILE" "$CONFIG_FILE" "$PROXY_FILE"
|
||||
yml_dns_custom "$enable_custom_dns" "$DNS_FILE"
|
||||
yml_hosts_custom "$CHANGE_FILE" "$HOSTS_FILE"
|
||||
sh /usr/share/openclash/yml_change.sh "$LOGTIME" "$en_mode" "$enable_custom_dns" "$da_password" "$cn_port" "$proxy_port" "$CHANGE_FILE" "$ipv6_enable" "$http_port" "$socks_port" &
|
||||
sh /usr/share/openclash/yml_change.sh "$LOGTIME" "$en_mode" "$enable_custom_dns" "$da_password" "$cn_port" "$proxy_port" "$CHANGE_FILE" "$ipv6_enable" "$http_port" "$socks_port" "$lan_ip" &
|
||||
sh /usr/share/openclash/yml_rules_change.sh "$LOGTIME" "$rule_source" "$enable_custom_clash_rules" "$RULE_FILE" &
|
||||
wait
|
||||
cat $CHANGE_FILE $DNS_FILE $PROXY_FILE $RULE_FILE > $CONFIG_FILE 2>/dev/null
|
||||
@ -344,20 +363,9 @@ if [ "$enable" -eq 1 ] && [ -f "$CONFIG_FILE" ]; then
|
||||
echo "第六步: 设置 OpenClash 防火墙规则..." >$START_LOG
|
||||
ln -s /usr/share/openclash/yacd /www/openclash 2>/dev/null
|
||||
|
||||
pre_line=`iptables -t nat -nL PREROUTING --line-number |grep dpt:53 2>/dev/null |awk '{print $1}' 2>/dev/null |head -1`
|
||||
|
||||
if [ -z "$pre_line" ] || [ "$pre_line" -lt 1 ]; then
|
||||
pre_line=`expr $(iptables -t nat -nL PREROUTING --line-number |grep zone_lan_prerouting 2>/dev/null |awk '{print $1}' 2>/dev/null |head -1) + 1 2>/dev/null`
|
||||
fi
|
||||
|
||||
if [ -z "$pre_line" ]; then
|
||||
pre_line=1
|
||||
fi
|
||||
|
||||
mkdir -p /var/etc
|
||||
cat > "/var/etc/openclash.include" <<-EOF
|
||||
iptables -t nat -N openclash
|
||||
iptables -t nat -N openclash_dns
|
||||
iptables -t nat -A openclash -d 0.0.0.0/8 -j RETURN
|
||||
iptables -t nat -A openclash -d 10.0.0.0/8 -j RETURN
|
||||
iptables -t nat -A openclash -d 127.0.0.0/8 -j RETURN
|
||||
@ -367,28 +375,31 @@ iptables -t nat -A openclash -d 192.168.0.0/16 -j RETURN
|
||||
iptables -t nat -A openclash -d 224.0.0.0/4 -j RETURN
|
||||
iptables -t nat -A openclash -d 240.0.0.0/4 -j RETURN
|
||||
iptables -t nat -A openclash -p tcp --dport 22 -j ACCEPT
|
||||
iptables -t nat -A openclash_dns -p udp -j REDIRECT --to-ports "$dns_port"
|
||||
iptables -t nat -A openclash_dns -p tcp -j REDIRECT --to-ports "$dns_port"
|
||||
iptables -t nat -A openclash -p tcp -j REDIRECT --to-ports "$proxy_port"
|
||||
iptables -t nat -I PREROUTING "$pre_line" -p tcp --dport 53 -j openclash_dns
|
||||
iptables -t nat -I PREROUTING "$pre_line" -p udp --dport 53 -j openclash_dns
|
||||
iptables -t nat -A PREROUTING -p tcp -j openclash
|
||||
iptables -t nat -A OUTPUT -p tcp -d 198.18.0.1/16 -j REDIRECT --to-ports "$proxy_port"
|
||||
EOF
|
||||
|
||||
if [ "$ipv6_enable" -eq 1 ]; then
|
||||
cat >> "/var/etc/openclash.include" <<-EOF
|
||||
ip6tables -t nat -N openclash
|
||||
ip6tables -t nat -N openclash_dns
|
||||
ip6tables -t nat -A openclash_dns -p udp -j REDIRECT --to-ports "$dns_port"
|
||||
ip6tables -t nat -A openclash_dns -p tcp -j REDIRECT --to-ports "$dns_port"
|
||||
ip6tables -t nat -A openclash -p tcp -j REDIRECT --to-ports "$proxy_port"
|
||||
ip6tables -t nat -I PREROUTING "$pre_line" -p tcp --dport 53 -j openclash_dns
|
||||
ip6tables -t nat -I PREROUTING "$pre_line" -p udp --dport 53 -j openclash_dns
|
||||
ip6tables -t nat -A PREROUTING -p tcp -j openclash
|
||||
EOF
|
||||
fi
|
||||
|
||||
/etc/init.d/firewall restart >/dev/null 2>&1
|
||||
|
||||
echo "第七步: 重启 Dnsmasq 程序..." >$START_LOG
|
||||
if [ "$(iptables -t nat -nL PREROUTING --line-number |grep dpt:53 |wc -l)" -gt 2 ]; then
|
||||
echo "发现53端口被劫持,请将OpenClash设置为劫持53端口程序的上游DNS服务器!" >$START_LOG
|
||||
echo "${LOGTIME} Warring: OpenClash May Can Not Take Over DNS, Please Use OpenClash for Upstream DNS Resolve Server" >> $LOG_FILE
|
||||
sleep 5
|
||||
fi
|
||||
ipset flush music 2>/dev/null
|
||||
[ "$enable_redirect_dns" != "0" ] && {
|
||||
change_dns
|
||||
}
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
if pidof clash >/dev/null; then
|
||||
echo "第八步: 添加 OpenClash 计划任务,启动进程守护程序..." >$START_LOG
|
||||
@ -407,9 +418,10 @@ fi
|
||||
cat /etc/openclash/configrules.bak >> "$CONFIG_FILE"
|
||||
rm -rf /etc/openclash/configrules.bak
|
||||
nohup $CLASH -d "$CLASH_CONFIG" >> $LOG_FILE 2>&1 &
|
||||
sleep 3
|
||||
if pidof clash >/dev/null; then
|
||||
add_cron
|
||||
echo "OpenClash 使用备份规则启动成功,请更新、检查第三方规则后重试!" >$START_LOG
|
||||
echo "OpenClash 使用备份规则启动成功,请更新、检查变动的规则后重试!" >$START_LOG
|
||||
echo "${LOGTIME} OpenClash Start Successful With Backup Rules Config, Please Check Or Update Other Rules And Retry" >> $LOG_FILE
|
||||
sleep 5
|
||||
echo "" >$START_LOG
|
||||
@ -466,19 +478,18 @@ stop()
|
||||
kill -9 "$(pidof clash|sed 's/$//g')" 2>/dev/null
|
||||
|
||||
echo "第四步: 重启 Dnsmasq 程序..." >$START_LOG
|
||||
revert_dns
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
|
||||
echo "第五步:删除 OpenClash 残留文件..." >$START_LOG
|
||||
rule_source=$(uci get openclash.config.rule_source 2>/dev/null)
|
||||
if [ "$rule_source" != 0 ]; then
|
||||
rm -rf /tmp/Proxy_Group >/dev/null 2>&1
|
||||
fi
|
||||
enable=$(uci get openclash.config.enable 2>/dev/null)
|
||||
if [ "$enable" -eq 0 ]; then
|
||||
ipset flush music 2>/dev/null
|
||||
rm -rf $LOG_FILE 2>/dev/null
|
||||
rm -rf /www/openclash 2>/dev/null
|
||||
rm -rf /tmp/openclash_last_version 2>/dev/null
|
||||
rm -rf /tmp/clash_last_version 2>/dev/null
|
||||
rm -rf /tmp/Proxy_Group 2>/dev/null
|
||||
echo "OpenClash 关闭成功!" >$START_LOG
|
||||
sleep 5
|
||||
rm -rf $START_LOG
|
||||
|
||||
@ -11,6 +11,12 @@ redir-port: 7892 # 此项将被接管
|
||||
|
||||
allow-lan: true # 此项将被接管为true
|
||||
|
||||
# Only applicable when setting allow-lan to true
|
||||
# "*": bind all IP addresses
|
||||
# 192.168.122.11: bind a single IPv4 address
|
||||
# "[aaaa::a8aa:ff:fe09:57d8]": bind a single IPv6 address
|
||||
bind-address: "*" # HTTP(S)\SOCKS5 监听地址,此项将被接管为all
|
||||
|
||||
# Rule / Global/ Direct (default is Rule)
|
||||
mode: Rule
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@openclash[-1]
|
||||
add ucitrack openclash
|
||||
set ucitrack.@openclash[-1].init=openclash
|
||||
commit ucitrack
|
||||
delete firewall.openclash
|
||||
set firewall.openclash=include
|
||||
set firewall.openclash.type=script
|
||||
set firewall.openclash.path=/var/etc/openclash.include
|
||||
set firewall.openclash.reload=1
|
||||
commit firewall
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
@ -7,7 +7,7 @@ function index()
|
||||
|
||||
|
||||
entry({"admin", "services", "openclash"},alias("admin", "services", "openclash", "client"), _("OpenClash"), 50).dependent = true
|
||||
entry({"admin", "services", "openclash", "client"},form("openclash/client"),_("Overview"), 20).leaf = true
|
||||
entry({"admin", "services", "openclash", "client"},form("openclash/client"),_("Overviews"), 20).leaf = true
|
||||
entry({"admin", "services", "openclash", "status"},call("action_status")).leaf=true
|
||||
entry({"admin", "services", "openclash", "state"},call("action_state")).leaf=true
|
||||
entry({"admin", "services", "openclash", "startlog"},call("action_start")).leaf=true
|
||||
@ -166,11 +166,11 @@ local function oplv()
|
||||
end
|
||||
|
||||
local function opup()
|
||||
return luci.sys.exec("uci set openclash.config.update=1 && uci commit openclash && rm -rf /tmp/openclash_last_version 2>/dev/null && sh /usr/share/openclash/openclash_version.sh && sh /usr/share/openclash/openclash_update.sh 2>/dev/null")
|
||||
return luci.sys.exec("rm -rf /tmp/*_last_version 2>/dev/null && sh /usr/share/openclash/openclash_version.sh && sh /usr/share/openclash/openclash_update.sh >/dev/null 2>&1 &")
|
||||
end
|
||||
|
||||
local function coreup()
|
||||
return luci.sys.exec("uci set openclash.config.enable=1 && uci commit openclash && rm -rf /tmp/clash_last_version 2>/dev/null && sh /usr/share/openclash/clash_version.sh && sh /usr/share/openclash/openclash_core.sh 2>/dev/null")
|
||||
return luci.sys.exec("uci set openclash.config.enable=1 && uci commit openclash && rm -rf /tmp/*_last_version 2>/dev/null && sh /usr/share/openclash/clash_version.sh && sh /usr/share/openclash/openclash_core.sh >/dev/null 2>&1 &")
|
||||
end
|
||||
|
||||
local function corever()
|
||||
|
||||
@ -12,7 +12,7 @@ s = m:section(TypedSection, "openclash")
|
||||
s.title = translate("Will Modify The Config File Or Subscribe According To The Settings On This Page")
|
||||
s.anonymous = true
|
||||
|
||||
s:tab("settings", translate("General Settings"))
|
||||
s:tab("settings", translate("General-Settings"))
|
||||
s:tab("rules", translate("Rules Setting"))
|
||||
s:tab("dashboard", translate("Dashboard Settings"))
|
||||
s:tab("config_update", translate("Config Update"))
|
||||
@ -44,6 +44,12 @@ o:value("redir-host", translate("redir-host"))
|
||||
o:value("fake-ip", translate("fake-ip"))
|
||||
o.default = "redir-host"
|
||||
|
||||
o = s:taboption("settings", ListValue, "enable_redirect_dns", translate("Redirect Local DNS Setting"))
|
||||
o.description = translate("Set Local DNS Redirect")
|
||||
o:value("0", translate("Disable"))
|
||||
o:value("1", translate("Enable"))
|
||||
o.default = 1
|
||||
|
||||
o = s:taboption("settings", ListValue, "enable_custom_dns", translate("Custom DNS Setting"))
|
||||
o.description = translate("Set OpenClash Upstream DNS Resolve Server")
|
||||
o:value("0", translate("Disable"))
|
||||
@ -361,7 +367,7 @@ s.anonymous = true
|
||||
|
||||
custom_rules = s:option(Value, "custom_rules")
|
||||
custom_rules.template = "cbi/tvalue"
|
||||
custom_rules.description = translate("Custom Rules Here, For More Go Github:https://github.com/Dreamacro/clash/blob/master/README.md")
|
||||
custom_rules.description = translate("Custom Rules Here, For More Go Github:https://github.com/Dreamacro/clash/blob/master/README.md, IP To CIDR: http://ip2cidr.com")
|
||||
custom_rules.rows = 20
|
||||
custom_rules.wrap = "off"
|
||||
|
||||
|
||||
@ -26,11 +26,11 @@
|
||||
clash.innerHTML = status.clash ? '<b><font color=green><%:RUNNING%></font></b>' : '<b><font color=red><%:NOT RUNNING%></font></b>';
|
||||
if ( status.mode == "fake-ip\n" )
|
||||
{
|
||||
mode.innerHTML = status.clash ? "<b><font color=green><%: Fake-IP 模式%></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
|
||||
mode.innerHTML = status.clash ? "<b><font color=green><%: Fake-IP(增强)模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
|
||||
}
|
||||
else if ( status.mode == "redir-host\n" )
|
||||
{
|
||||
mode.innerHTML = status.clash ? "<b><font color=green><%: Redir-Host 模式%></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
|
||||
mode.innerHTML = status.clash ? "<b><font color=green><%: Redir-Host(兼容)模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
|
||||
}
|
||||
watchdog.innerHTML = status.watchdog ? '<b><font color=green><%:RUNNING%></font> </b>' : '<b><font color=red><%:NOT RUNNING%></font></b>';
|
||||
daip.innerHTML = status.daip ? "<b><font color=green>"+status.daip+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>";
|
||||
@ -45,11 +45,11 @@
|
||||
clash.innerHTML = status.clash ? '<b><font color=green><%:RUNNING%></font></b>' : '<b><font color=red><%:NOT RUNNING%></font></b>';
|
||||
if ( status.mode == "fake-ip\n" )
|
||||
{
|
||||
mode.innerHTML = status.clash ? "<b><font color=green><%: Fake-IP 模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
|
||||
mode.innerHTML = status.clash ? "<b><font color=green><%: Fake-IP(增强)模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
|
||||
}
|
||||
else if ( status.mode == "redir-host\n" )
|
||||
{
|
||||
mode.innerHTML = status.clash ? "<b><font color=green><%: Redir-Host 模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
|
||||
mode.innerHTML = status.clash ? "<b><font color=green><%: Redir-Host(兼容)模式 %></font></b>" : '<b><font color=red><%:NOT RUNNING%></font></b>';
|
||||
}
|
||||
watchdog.innerHTML = status.watchdog ? '<b><font color=green><%:RUNNING%></font> </b>' : '<b><font color=red><%:NOT RUNNING%></font></b>';
|
||||
daip.innerHTML = status.daip ? "<b><font color=green>"+status.daip+"</font></b>" : "<b><font color=red>"+"<%:Not Set%>"+"</font></b>";
|
||||
|
||||
@ -128,28 +128,23 @@
|
||||
|
||||
function core_update(btn)
|
||||
{
|
||||
btn.disabled = true;
|
||||
btn.value = '<%:运行中...%>';
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "coreupdate")%>', status.coreup, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "coreupdate")%>', null, function(x, status) {
|
||||
btn.value = '<%:检查并更新%>';
|
||||
btn.disabled = false;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function op_update(btn)
|
||||
{
|
||||
btn.disabled = true;
|
||||
btn.value = '<%:运行中...%>';
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "opupdate")%>', status.opup, function(x, status) {
|
||||
if ( x && x.status == 200 ) {
|
||||
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash", "opupdate")%>', null, function(x, status) {
|
||||
btn.value = '<%:检查并更新%>';
|
||||
btn.disabled = false;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function ma_core_update(btn)
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
<meta charset="UTF-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title>Clash</title>
|
||||
<link href="main.09f6f4281ae3598cbadf.css" rel="stylesheet"></head>
|
||||
<link href="main.f56f0d5c26a32a6cdbb2.css" rel="stylesheet"></head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="text/javascript" src="js/1.bundle.09f6f4281ae3598cbadf.min.js"></script><script type="text/javascript" src="js/bundle.09f6f4281ae3598cbadf.min.js"></script></body>
|
||||
<script type="text/javascript" src="js/1.bundle.f56f0d5c26a32a6cdbb2.min.js"></script><script type="text/javascript" src="js/bundle.f56f0d5c26a32a6cdbb2.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
@ -18,50 +18,42 @@ if [ "$(sed -n 1p /etc/openclash/openclash_version 2>/dev/null)" != "$(sed -n 1p
|
||||
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
START_LOG="/tmp/openclash_start.log"
|
||||
LOG_FILE="/tmp/openclash.log"
|
||||
echo "正在卸载旧版本,更新过程请不要刷新页面和进行其他操作... ..." >$START_LOG
|
||||
opkg remove luci-app-openclash\
|
||||
&& echo "正在安装新版本,更新过程请不要刷新页面和进行其他操作 ..." >$START_LOG\
|
||||
&& opkg install /tmp/openclash.ipk
|
||||
echo "正在卸载旧版本,更新过程请不要刷新页面和进行其他操作 ..." >$START_LOG
|
||||
opkg remove luci-app-openclash
|
||||
echo "正在安装新版本,更新过程请不要刷新页面和进行其他操作 ..." >$START_LOG
|
||||
opkg install /tmp/openclash.ipk
|
||||
if [ "$?" -eq "0" ]; then
|
||||
rm -rf /tmp/openclash.ipk >/dev/null 2>&1
|
||||
echo "OpenClash 更新成功!" >$START_LOG
|
||||
echo "${LOGTIME} OpenClash Update Successful" >>$LOG_FILE
|
||||
rm -rf /tmp/openclash.ipk >/dev/null 2>&1
|
||||
uci set openclash.config.update=0
|
||||
uci commit openclash
|
||||
sleep 10
|
||||
echo "" >$START_LOG
|
||||
else
|
||||
echo "OpenClash 更新失败,文件保存在/tmp/openclash.ipk,请尝试手动更新!" >$START_LOG
|
||||
echo "${LOGTIME} OpenClash Update Fail" >>$LOG_FILE
|
||||
uci set openclash.config.update=0
|
||||
uci commit openclash
|
||||
sleep 10
|
||||
echo "" >$START_LOG
|
||||
fi
|
||||
EOF
|
||||
chmod 4755 /tmp/openclash_update.sh
|
||||
nohup /tmp/openclash_update.sh &
|
||||
wait
|
||||
rm -rf /tmp/openclash_update.sh
|
||||
else
|
||||
echo "OpenClash-$LAST_VER 下载失败,请检查网络或稍后再试!" >$START_LOG
|
||||
rm -rf /tmp/openclash.ipk >/dev/null 2>&1
|
||||
echo "${LOGTIME} OpenClash Update Error" >>$LOG_FILE
|
||||
uci set openclash.config.update=0
|
||||
uci commit openclash
|
||||
sleep 10
|
||||
echo "" >$START_LOG
|
||||
fi
|
||||
elif [ ! -f "$LAST_OPVER" ]; then
|
||||
echo "获取版本信息失败,请稍后再试..." >$START_LOG
|
||||
echo "${LOGTIME} OpenClash Version Check Error, Please Try Again After A few seconds" >>$LOG_FILE
|
||||
uci set openclash.config.update=0
|
||||
uci commit openclash
|
||||
sleep 5
|
||||
echo "" >$START_LOG
|
||||
else
|
||||
echo "OpenClash 没有更新,停止继续操作!" >$START_LOG
|
||||
echo "${LOGTIME} OpenClash Version No Change, Do Nothing" >>$LOG_FILE
|
||||
uci set openclash.config.update=0
|
||||
uci commit openclash
|
||||
sleep 5
|
||||
echo "" >$START_LOG
|
||||
fi
|
||||
@ -20,5 +20,13 @@ fi
|
||||
if [ "$LOGSIZE" -gt 90 ]; then
|
||||
echo "[$LOGTIME] Watchdog: Size Limit, Clean Up All Log Records." > /tmp/openclash.log
|
||||
fi
|
||||
|
||||
## 端口转发重启
|
||||
zone_line=`iptables -t nat -nL PREROUTING --line-number |grep "zone" 2>/dev/null |awk '{print $1}' 2>/dev/null |awk 'END {print}'`
|
||||
op_line=`iptables -t nat -nL PREROUTING --line-number |grep "openclash" 2>/dev/null |awk '{print $1}' 2>/dev/null |awk 'END {print}'`
|
||||
if [ "$zone_line" -gt "$op_line" ]; then
|
||||
/etc/init.d/firewall restart >/dev/null 2>&1
|
||||
echo "[$LOGTIME] Watchdog: Restart Firewall For Enable Redirect." > /tmp/openclash.log
|
||||
fi
|
||||
sleep 60
|
||||
done 2>/dev/null
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -z "$(grep '^ enhanced-mode: $2' "$7")" ]; then
|
||||
if [ ! -z "$(grep "^ enhanced-mode:" "$7")" ]; then
|
||||
sed -i "/^ enhanced-mode:/c\ enhanced-mode: ${2}" "$7"
|
||||
if [ ! -z "$(grep "^ \{0,\}enhanced-mode:" "$7")" ]; then
|
||||
sed -i "/^ \{0,\}enhanced-mode:/c\ enhanced-mode: ${2}" "$7"
|
||||
else
|
||||
sed -i "/^dns:/a\ enhanced-mode: ${2}" "$7"
|
||||
fi
|
||||
@ -15,49 +15,49 @@
|
||||
sed -i "/enhanced-mode:/a\ fake-ip-range: 198.18.0.1/16" "$7"
|
||||
fi
|
||||
else
|
||||
sed -i '/^ \{0,\}fake-ip-range:/d' "$7" 2>/dev/null
|
||||
sed -i '/^ \{0,\}fake-ip-range:/d' "$7" 2>/dev/null
|
||||
fi
|
||||
|
||||
sed -i '/##Custom DNS##/d' "$7" 2>/dev/null
|
||||
|
||||
|
||||
if [ -z "$(grep '^redir-port: $6' "$7")" ]; then
|
||||
if [ ! -z "$(grep "^redir-port:" "$7")" ]; then
|
||||
sed -i "/^redir-port:/c\redir-port: ${6}" "$7"
|
||||
if [ ! -z "$(grep "^ \{0,\}redir-port:" "$7")" ]; then
|
||||
sed -i "/^ \{0,\}redir-port:/c\redir-port: ${6}" "$7"
|
||||
else
|
||||
sed -i "3i\redir-port: ${6}" "$7"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$(grep '^port: $9' "$7")" ]; then
|
||||
if [ ! -z "$(grep "^port:" "$7")" ]; then
|
||||
sed -i "/^port:/c\port: ${9}" "$7"
|
||||
if [ ! -z "$(grep "^ \{0,\}port:" "$7")" ]; then
|
||||
sed -i "/^ \{0,\}port:/c\port: ${9}" "$7"
|
||||
else
|
||||
sed -i "3i\port: ${9}" "$7"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$(grep '^socks-port: $10' "$7")" ]; then
|
||||
if [ ! -z "$(grep "^socks-port:" "$7")" ]; then
|
||||
sed -i "/^socks-port:/c\socks-port: ${10}" "$7"
|
||||
if [ ! -z "$(grep "^ \{0,\}socks-port:" "$7")" ]; then
|
||||
sed -i "/^ \{0,\}socks-port:/c\socks-port: ${10}" "$7"
|
||||
else
|
||||
sed -i "3i\socks-port: ${10}" "$7"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$(grep '^external-controller: 0.0.0.0:$5' "$7")" ]; then
|
||||
if [ ! -z "$(grep "^external-controller:" "$7")" ]; then
|
||||
sed -i "/^external-controller:/c\external-controller: 0.0.0.0:${5}" "$7"
|
||||
if [ ! -z "$(grep "^ \{0,\}external-controller:" "$7")" ]; then
|
||||
sed -i "/^ \{0,\}external-controller:/c\external-controller: 0.0.0.0:${5}" "$7"
|
||||
else
|
||||
sed -i "3i\external-controller: 0.0.0.0:${5}" "$7"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$(grep '^secret: $4' "$7")" ]; then
|
||||
if [ ! -z "$(grep "^secret:" "$7")" ]; then
|
||||
sed -i "/^secret:/c\secret: '${4}'" "$7"
|
||||
if [ ! -z "$(grep "^ \{0,\}secret:" "$7")" ]; then
|
||||
sed -i "/^ \{0,\}secret:/c\secret: \"${4}\"" "$7"
|
||||
else
|
||||
sed -i "3i\secret: '${4}'" "$7"
|
||||
sed -i "3i\secret: \"${4}\"" "$7"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -70,16 +70,19 @@
|
||||
fi
|
||||
|
||||
if [ -z "$(grep "^allow-lan: true" "$7")" ]; then
|
||||
if [ ! -z "$(grep "^allow-lan:" "$7")" ]; then
|
||||
sed -i "/^allow-lan:/c\allow-lan: true" "$7"
|
||||
if [ ! -z "$(grep "^ \{0,\}allow-lan:" "$7")" ]; then
|
||||
sed -i "/^ \{0,\}allow-lan:/c\allow-lan: true" "$7"
|
||||
else
|
||||
sed -i "3i\allow-lan: true" "$7"
|
||||
fi
|
||||
fi
|
||||
|
||||
sed -i '/bind-address:/d' "$7" 2>/dev/null
|
||||
sed -i "/^allow-lan:/a\bind-address: \"*\"" "$7"
|
||||
|
||||
if [ -z "$(grep '^external-ui: "/usr/share/openclash/dashboard"' "$7")" ]; then
|
||||
if [ ! -z "$(grep "^external-ui:" "$7")" ]; then
|
||||
sed -i '/^external-ui:/c\external-ui: "/usr/share/openclash/dashboard"' "$7"
|
||||
if [ ! -z "$(grep "^ \{0,\}external-ui:" "$7")" ]; then
|
||||
sed -i '/^ \{0,\}external-ui:/c\external-ui: "/usr/share/openclash/dashboard"' "$7"
|
||||
else
|
||||
sed -i '3i\external-ui: "/usr/share/openclash/dashboard"' "$7"
|
||||
fi
|
||||
|
||||
@ -14,13 +14,13 @@ msgstr "将按照以下设置本地化配置文件和获取订阅"
|
||||
msgid "Technical Support"
|
||||
msgstr "技术支持"
|
||||
|
||||
msgid "Overview"
|
||||
msgid "Overviews"
|
||||
msgstr "运行状态"
|
||||
|
||||
msgid "Takeover Settings"
|
||||
msgstr "接管设置"
|
||||
|
||||
msgid "General Settings"
|
||||
msgid "General-Settings"
|
||||
msgstr "全局设置"
|
||||
|
||||
msgid "Config Update"
|
||||
@ -87,13 +87,19 @@ msgid "Select Mode"
|
||||
msgstr "OpenClash 运行模式"
|
||||
|
||||
msgid "redir-host"
|
||||
msgstr "Redir-Host 模式"
|
||||
msgstr "Redir-Host(兼容)模式"
|
||||
|
||||
msgid "fake-ip"
|
||||
msgstr "Fake-IP 模式"
|
||||
msgstr "Fake-IP(增强)模式"
|
||||
|
||||
msgid "Select Mode For OpenClash Work, Network Error Try Flush DNS Cache"
|
||||
msgstr "选择运行模式,如客户端的网络无法连接请尝试清除DNS缓存"
|
||||
msgstr "选择运行模式,在兼容模式下无法代理路由器自身流量,如客户端的网络无法连接请尝试清除DNS缓存"
|
||||
|
||||
msgid "Redirect Local DNS Setting"
|
||||
msgstr "本地DNS劫持"
|
||||
|
||||
msgid "Set Local DNS Redirect"
|
||||
msgstr "默认启用,将自动设置Dnsmasq的上游服务器,如和其他插件冲突可停用,但须将OpenClash作为冲突插件的唯一上游服务器"
|
||||
|
||||
msgid "Custom DNS Setting"
|
||||
msgstr "自定义上游DNS服务器"
|
||||
@ -319,8 +325,8 @@ msgstr "指定流量(策略)的代理方式,只支持选择(服务器组)
|
||||
msgid "Custom Clash Rules"
|
||||
msgstr "自定义规则(访问控制)"
|
||||
|
||||
msgid "Custom Rules Here, For More Go Github:https://github.com/Dreamacro/clash/blob/master/README.md"
|
||||
msgstr "设置自定义规则,详细信息请前往Github( https://github.com/Dreamacro/clash/blob/master/README.md )查询"
|
||||
msgid "Custom Rules Here, For More Go Github:https://github.com/Dreamacro/clash/blob/master/README.md, IP To CIDR: http://ip2cidr.com"
|
||||
msgstr "设置自定义规则,详细信息请前往Github( https://github.com/Dreamacro/clash/blob/master/README.md )查询,在线IP段转CIDR地址:http://ip2cidr.com"
|
||||
|
||||
msgid "Custom Hosts Here, For More Go Github:https://github.com/Dreamacro/clash/blob/master/README.md"
|
||||
msgstr "设置自定义Hosts,详细信息请前往Github( https://github.com/Dreamacro/clash/blob/master/README.md )查询"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user