diff --git a/package/cnsztl/luci-app-openclash/files/etc/init.d/openclash b/package/cnsztl/luci-app-openclash/files/etc/init.d/openclash index bf6010477c..75b9c43dc6 100755 --- a/package/cnsztl/luci-app-openclash/files/etc/init.d/openclash +++ b/package/cnsztl/luci-app-openclash/files/etc/init.d/openclash @@ -50,7 +50,7 @@ change_dns() { } revert_dns() { - dns_port=$(uci get openclash.config.dns_port 2>/dev/null) + 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 @@ -61,9 +61,9 @@ revert_dns() { 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 + 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 @@ -236,7 +236,7 @@ yml_dns_custom() sed -i "/^ \{0,\}fallback:/c\ fallback:" "$2" 2>/dev/null if [ ! -z "$(grep "^ \{0,1\}- " $2)" ]; then sed -i "s/^ \{0,\}- / - /" "$2" 2>/dev/null #添加参数空格 - fi + fi fi } @@ -423,7 +423,7 @@ fi sleep 5 echo "" >$START_LOG else - if [ "$rule_source" != 0 ]; then + if [ "$rule_source" != 0 ] || [ "$enable_custom_clash_rules" != 0 ]; then echo "错误: OpenClash 启动失败,尝试还原规则并重新启动 Clash 主程序..." >$START_LOG echo "${LOGTIME} OpenClash Can Not Start, Try Use Backup Rules Start Again" >> $LOG_FILE mv "$BACKUP_FILE" /etc/openclash/configrules.bak diff --git a/package/cnsztl/luci-app-openclash/files/usr/lib/lua/luci/view/openclash/myip.htm b/package/cnsztl/luci-app-openclash/files/usr/lib/lua/luci/view/openclash/myip.htm index c32d5b8b63..9e3d677626 100644 --- a/package/cnsztl/luci-app-openclash/files/usr/lib/lua/luci/view/openclash/myip.htm +++ b/package/cnsztl/luci-app-openclash/files/usr/lib/lua/luci/view/openclash/myip.htm @@ -46,6 +46,7 @@ .ip-result { color: #444; font-size:16px; + margin:0px 0px 0px 30px; white-space: nowrap; /*强制span不换行*/ display: inline-block; /*将span当做块级元素对待*/ width: 29%; /*限制宽度*/ @@ -61,7 +62,7 @@ line-height:20px; white-space: nowrap; /*强制span不换行*/ display: inline-block; /*将span当做块级元素对待*/ - width: 40%; /*限制宽度*/ + width: 30%; /*限制宽度*/ overflow: hidden; /*超出宽度部分隐藏*/ text-overflow: ellipsis; /*超出部分以点号代替*/ vertical-align:bottom; @@ -141,7 +142,7 @@ 淘宝 国内:
- IP.SB 海外: + IPAPI 海外:
IPIFY 海外: @@ -183,7 +184,7 @@ $$.getElementById('ip-taobao').innerHTML = '查询中...'; $$.getElementById('ip-ipify').innerHTML = '查询中...'; $$.getElementById('ip-ipipnet').innerHTML = '查询中...'; - $$.getElementById('ip-ipsb').innerHTML = '查询中...'; + $$.getElementById('ip-ipapi').innerHTML = '查询中...'; let random = parseInt(Math.random() * 100000000); let IP = { get: (url, type) => @@ -249,9 +250,12 @@ $$.getElementById('ip-taobao').innerHTML = data.ip; IP.parseIPIpip(data.ip, 'ip-taobao-ipip'); }, - getIpsbIP: (data) => { - $$.getElementById('ip-ipsb').innerHTML = data.address; - $$.getElementById('ip-ipsb-geo').innerHTML = `${data.country} ${data.province} ${data.city} ${data.isp.name}` + getIPApiIP: () => { + IP.get(`https://ipapi.co/json?z=${random}`, 'json') + .then(resp => { + $$.getElementById('ip-ipapi').innerHTML = resp.data.ip; + IP.parseIPIpip(resp.data.ip, 'ip-ipapi-geo'); + }) }, getIpifyIP: () => { IP.get(`https://api.ipify.org/?format=json&z=${random}`, 'json') @@ -303,6 +307,7 @@ HTTP.runcheck(); IP.getIpipnetIP(); IP.getIpifyIP(); + IP.getIPApiIP(); IP.getWebrtcIP(); window.onload=myip_Load(); @@ -315,25 +320,19 @@ tbipScript.src='https://www.taobao.com/help/getip.php'; tbip.appendChild( tbipScript); - var sbip = document.getElementsByTagName('HEAD').item(0); - var sbipScript= document.createElement("script"); - sbipScript.async = "async"; - sbipScript.src='https://ipv4.ip.sb/addrinfo?callback=IP.getIpsbIP'; - sbip.appendChild( sbipScript); - const $$ = document; random = parseInt(Math.random() * 100000000); window.ipCallback = (data) => IP.getTaobaoIP(data); HTTP.runcheck(); IP.getIpipnetIP(); IP.getIpifyIP(); + IP.getIPApiIP(); IP.getWebrtcIP(); setTimeout("myip_Load()",1000*8); } -