luci-app-openclash: bump to v0.33.7-beta

This commit is contained in:
CN_SZTL 2019-08-11 17:31:02 +08:00
parent 4942f0bfbc
commit 4707abb576
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
9 changed files with 184 additions and 32 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.33.6
PKG_VERSION:=0.33.7
PKG_RELEASE:=beta
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
@ -42,6 +42,7 @@ if [ -f "/etc/config/openclash" ]; then
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
cp "/etc/config/openclash_custom_fake_black.conf" "/tmp/openclash_custom_fake_black.conf.bak" 2>/dev/null
fi
endef
@ -59,8 +60,9 @@ 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
mv "/tmp/openclash_custom_fake_black.conf.bak" "/etc/config/openclash_custom_fake_black.conf" 2>/dev/null
fi
if [ -f "/tmp/config.yaml" ]; then
mv "/tmp/config.yaml" "/etc/openclash/config.yaml" 2>/dev/null
@ -79,6 +81,7 @@ 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
cp "/etc/config/openclash_custom_hosts.list" "/tmp/openclash_custom_hosts.list.bak" 2>/dev/null
cp "/etc/config/openclash_custom_fake_black.conf" "/tmp/openclash_custom_fake_black.conf.bak" 2>/dev/null
endef
define Package/$(PKG_NAME)/postrm
@ -96,6 +99,7 @@ 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
rm -rf /etc/openclash/dnsmasq_fake_block.conf 2>/dev/null
uci delete firewall.openclash >/dev/null 2>&1
uci commit firewall >/dev/null 2>&1
uci delete ucitrack.@openclash[-1] >/dev/null 2>&1

View File

@ -15,4 +15,5 @@ config openclash 'config'
option other_rule_auto_update '0'
option core_version '0'
option en_mode 'redir-host'
option enable_redirect_dns '1'
option enable_redirect_dns '1'
option dns_advanced_setting '0'

View File

@ -0,0 +1,54 @@
#放行NTP服务
time.windows.com
time.nist.gov
time.apple.com
time.asia.apple.com
cn.ntp.org.cn
edu.ntp.org.cn
hk.ntp.org.cn
tw.ntp.org.cn
us.ntp.org.cn
sgp.ntp.org.cn
kr.ntp.org.cn
jp.ntp.org.cn
de.ntp.org.cn
ina.ntp.org.cn
0.openwrt.pool.ntp.org
1.openwrt.pool.ntp.org
2.openwrt.pool.ntp.org
3.openwrt.pool.ntp.org
ntp.aliyun.com
ntp1.aliyun.com
ntp2.aliyun.com
ntp3.aliyun.com
ntp4.aliyun.com
ntp5.aliyun.com
ntp6.aliyun.com
ntp7.aliyun.com
time1.aliyun.com
time2.aliyun.com
time3.aliyun.com
time4.aliyun.com
time5.aliyun.com
time6.aliyun.com
time7.aliyun.com
s1c.time.edu.cn
s2m.time.edu.cn
s1b.time.edu.cn
s1e.time.edu.cn
s2a.time.edu.cn
s2b.time.edu.cn
time1.apple.com
time2.apple.com
time3.apple.com
time4.apple.com
time5.apple.com
time6.apple.com
time7.apple.com
time1.google.com
time2.google.com
time3.google.com
time4.google.com
#放行网易云音乐
.music.163.com
interface.music.163.com

View File

@ -55,6 +55,19 @@ revert_dns() {
uci set dhcp.@dnsmasq[0].resolvfile=/tmp/resolv.conf.auto
uci set dhcp.@dnsmasq[0].noresolv=0
uci commit dhcp
rm -rf /tmp/dnsmasq.d/dnsmasq_openclash.conf >/dev/null 2>&1
}
fake_block() {
if [ "$1" = "fake-ip" ]; then
if [ ! -f /etc/openclash/dnsmasq_fake_block.conf ]; then
sh /usr/share/openclash/openclash_fake_block.sh
elif [ "$(awk -F '/' '{print $3}' /etc/openclash/dnsmasq_fake_block.conf |head -1)" != "$2" ] && [ ! -z "$2" ]; then
sh /usr/share/openclash/openclash_fake_block.sh
fi
mkdir -p /tmp/dnsmasq.d
ln -s /etc/openclash/dnsmasq_fake_block.conf /tmp/dnsmasq.d/dnsmasq_openclash.conf
fi
}
yml_check()
@ -326,6 +339,7 @@ if [ "$enable" -eq 1 ] && [ -f "$CONFIG_FILE" ]; then
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)
direct_dns=$(uci get openclash.config.direct_dns 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
@ -396,10 +410,10 @@ fi
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
}
fake_block "$en_mode" "$direct_dns"
/etc/init.d/dnsmasq restart >/dev/null 2>&1
if pidof clash >/dev/null; then
echo "第八步: 添加 OpenClash 计划任务,启动进程守护程序..." >$START_LOG
@ -484,7 +498,6 @@ stop()
echo "第五步:删除 OpenClash 残留文件..." >$START_LOG
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

File diff suppressed because one or more lines are too long

View File

@ -13,6 +13,7 @@ s.title = translate("Will Modify The Config File Or Subscribe According To The S
s.anonymous = true
s:tab("settings", translate("General-Settings"))
s:tab("dns", translate("DNS Setting"))
s:tab("rules", translate("Rules Setting"))
s:tab("dashboard", translate("Dashboard Settings"))
s:tab("config_update", translate("Config Update"))
@ -44,24 +45,6 @@ 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"))
o:value("1", translate("Enable"))
o.default = 0
o = s:taboption("settings", ListValue, "ipv6_enable", translate("Enable ipv6 Resolve"))
o.description = translate("Force Enable to Resolve ipv6 DNS Requests")
o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default=0
o = s:taboption("settings", Value, "proxy_port")
o.title = translate("Redir Port")
o.default = 7892
@ -83,6 +66,67 @@ o.datatype = "port"
o.rmempty = false
o.description = translate("Please Make Sure Ports Available")
---- DNS Settings
o = s:taboption("dns", 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("dns", ListValue, "enable_custom_dns", translate("Custom DNS Setting"))
o.description = translate("Set OpenClash Upstream DNS Resolve Server")
o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default = 0
o = s:taboption("dns", ListValue, "ipv6_enable", translate("Enable ipv6 Resolve"))
o.description = translate("Force Enable to Resolve ipv6 DNS Requests")
o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default=0
o = s:taboption("dns", ListValue, "dns_advanced_setting", translate("Advanced Setting"))
o.description = translate("DNS Advanced Settings")
o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
o.default=0
o = s:taboption("dns", Value, "direct_dns", translate("Specify DNS Server"))
o.description = translate("Specify DNS Server For List, Only One IP Server Address Support")
o.default="114.114.114.114"
o.placeholder = translate("114.114.114.114 or 127.0.0.1#5300")
o:depends("dns_advanced_setting", "1")
o = s:taboption("dns", Button, translate("Fake-IP Block List Update"))
o.title = translate("Fake-IP Block List Update")
o:depends("dns_advanced_setting", "1")
o.inputtitle = translate("Check And Update")
o.inputstyle = "reload"
o.write = function()
uci:set("openclash", "config", "enable", 1)
uci:commit("openclash")
SYS.call("sh /usr/share/openclash/openclash_fake_block.sh && /etc/init.d/openclash restart >/dev/null 2>&1 &")
HTTP.redirect(DISP.build_url("admin", "services", "openclash"))
end
custom_fake_black = s:taboption("dns", Value, "custom_fake_black")
custom_fake_black.template = "cbi/tvalue"
custom_fake_black.description = translate("Domain Names In The List Do Not Return Fake-IP, One rule per line")
custom_fake_black.rows = 20
custom_fake_black.wrap = "off"
custom_fake_black:depends("dns_advanced_setting", "1")
function custom_fake_black.cfgvalue(self, section)
return NXFS.readfile("/etc/config/openclash_custom_fake_black.conf") or ""
end
function custom_fake_black.write(self, section, value)
if value then
value = value:gsub("\r\n?", "\n")
NXFS.writefile("/etc/config/openclash_custom_fake_black.conf", value)
end
end
---- Rules Settings
o = s:taboption("rules", ListValue, "enable_custom_clash_rules", translate("Custom Clash Rules"))
o.description = translate("Use Custom Rules")

View File

@ -0,0 +1,13 @@
#! /bin/sh
echo "ÉèÖÃFake-IPºÚÃûµ¥..." >$START_LOG
direct_dns=$(uci get openclash.config.direct_dns 2>/dev/null)
[ -z "$direct_dns" ] && {
direct_dns="114.114.114.114"
}
rm -rf /etc/openclash/dnsmasq_fake_block.conf 2>/dev/null
for i in `cat /etc/config/openclash_custom_fake_black.conf`
do
if [ -z "$(echo $i |grep '^ \{0,\}#' 2>/dev/null)" ]; then
echo "server=/$i/$direct_dns" >>/etc/openclash/dnsmasq_fake_block.conf
fi
done

View File

@ -9,10 +9,12 @@
fi
if [ "$2" = "fake-ip" ]; then
if [ ! -z "$(grep "^ \{0,\}fake-ip-range:" "$7")" ]; then
sed -i "/^ \{0,\}fake-ip-range:/c\ fake-ip-range: 198.18.0.1/16" "$7"
else
sed -i "/enhanced-mode:/a\ fake-ip-range: 198.18.0.1/16" "$7"
if [ -z "$(grep "^ \{0,\}fake-ip-range: 198.18.0.1/16" "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}fake-ip-range:" "$7")" ]; then
sed -i "/^ \{0,\}fake-ip-range:/c\ fake-ip-range: 198.18.0.1/16" "$7"
else
sed -i "/enhanced-mode:/a\ fake-ip-range: 198.18.0.1/16" "$7"
fi
fi
else
sed -i '/^ \{0,\}fake-ip-range:/d' "$7" 2>/dev/null

View File

@ -9,7 +9,7 @@ msgid "A Clash Client For OpenWrt"
msgstr "一个运行在OpenWrt上的Clash客户端兼容Shadowsocks、Vmess等协议根据灵活的规则配置实现策略代理"
msgid "Will Modify The Config File Or Subscribe According To The Settings On This Page"
msgstr "将按照以下设置本地化配置文件和获取订阅"
msgstr "将按照本页设置本地化配置文件和获取订阅"
msgid "Technical Support"
msgstr "技术支持"
@ -23,6 +23,9 @@ msgstr "接管设置"
msgid "General-Settings"
msgstr "全局设置"
msgid "DNS Setting"
msgstr "DNS设置"
msgid "Config Update"
msgstr "配置文件订阅"
@ -108,7 +111,25 @@ msgid "Use Custom Rules"
msgstr "启用后将把自定义规则增加到配置文件并优先匹配,规则请到下方文本框编辑"
msgid "Add Custom DNS Servers"
msgstr "设置自定义上游DNS服务器在上方全局设置中启用本功能后生效"
msgstr "设置自定义上游DNS服务器在上方DNS设置中启用本功能后生效"
msgid "Advanced Setting"
msgstr "高级设置"
msgid "DNS Advanced Settings"
msgstr "DNS高级设置如您不知道选项有何用请不要随意修改"
msgid "Specify DNS Server"
msgstr "Fake-IP模式黑名单DNS服务器"
msgid "Specify DNS Server For List, Only One IP Server Address Support"
msgstr "指定下方列表中域名的DNS服务器只支持填写一个IP地址更改后点击下方按钮生效"
msgid "Domain Names In The List Do Not Return Fake-IP, One rule per line"
msgstr "每行请只填写一个域名列表中的域名在Fake-IP模式下查询DNS时将返回真实IP地址更改后点击上方按钮生效"
msgid "Fake-IP Block List Update"
msgstr "更新Fake-IP域名黑名单"
msgid "Set OpenClash Upstream DNS Resolve Server"
msgstr "启用将覆盖配置文件内的设置,请先在下方配置好服务器"
@ -145,7 +166,7 @@ msgstr ""
"允许解析IPV6类型的DNS请求如果您没有公网IPV6地址但开启了IPV6的DHCP服务客户端连接可能会出现异常"
msgid "Rules Setting"
msgstr "规则设置(访问控制)"
msgstr "规则设置(访问控制)"
msgid "Server Config"
msgstr "配置文件"