diff --git a/luci-app-openclash/Makefile b/luci-app-openclash/Makefile index bcd91feafc..69c2cffceb 100644 --- a/luci-app-openclash/Makefile +++ b/luci-app-openclash/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-openclash -PKG_VERSION:=0.46.061 +PKG_VERSION:=0.46.062 PKG_MAINTAINER:=vernesong PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) diff --git a/luci-app-openclash/po/zh-cn/openclash.zh-cn.po b/luci-app-openclash/po/zh-cn/openclash.zh-cn.po index 49e77a912b..72255cc471 100644 --- a/luci-app-openclash/po/zh-cn/openclash.zh-cn.po +++ b/luci-app-openclash/po/zh-cn/openclash.zh-cn.po @@ -3448,4 +3448,7 @@ msgid "Internal ports" msgstr "内部端口" msgid "Target" -msgstr "对象" \ No newline at end of file +msgstr "对象" + +msgid "Error: Network Anomaly, Suspend Unlock Detection..." +msgstr "错误:网络异常,暂停解锁检测..." \ No newline at end of file diff --git a/luci-app-openclash/root/usr/share/openclash/openclash_streaming_unlock.lua b/luci-app-openclash/root/usr/share/openclash/openclash_streaming_unlock.lua index 4d50d22f6b..1e4e80ff23 100644 --- a/luci-app-openclash/root/usr/share/openclash/openclash_streaming_unlock.lua +++ b/luci-app-openclash/root/usr/share/openclash/openclash_streaming_unlock.lua @@ -1579,4 +1579,18 @@ function openai_unlock_test() end end -unlock_auto_select() \ No newline at end of file +function network_test() + local test_url1 = "https://www.gstatic.com/generate_204" + local test_url2 = "https://cp.cloudflare.com/generate_204" + local httpcode1 = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' '%s'", UA, test_url1)) + local httpcode2 = SYS.exec(string.format("curl -sL --connect-timeout 5 -m 5 --speed-time 5 --speed-limit 1 --retry 2 -o /dev/null -w %%{http_code} -H 'Accept-Language: en' -H 'Content-Type: application/json' -H 'User-Agent: %s' '%s'", UA, test_url2)) + if httpcode1 or httpcode2 then + if tonumber(httpcode1) == 200 or tonumber(httpcode2) == 200 then + unlock_auto_select() + return + end + end + print("Error: Network Anomaly, Suspend Unlock Detection...") +end + +network_test() \ No newline at end of file