diff --git a/package/ctcgfw/luci-app-openclash/files/usr/lib/lua/luci/controller/openclash.lua b/package/ctcgfw/luci-app-openclash/files/usr/lib/lua/luci/controller/openclash.lua index 586fac7060..ab087eb6ee 100644 --- a/package/ctcgfw/luci-app-openclash/files/usr/lib/lua/luci/controller/openclash.lua +++ b/package/ctcgfw/luci-app-openclash/files/usr/lib/lua/luci/controller/openclash.lua @@ -129,7 +129,7 @@ end end local function corelv() - local new = luci.sys.exec("sh /usr/share/openclash/clash_version.sh") + local new = luci.sys.call(string.format("sh /usr/share/openclash/clash_version.sh")) local core_lv = luci.sys.exec("sed -n 1p /tmp/clash_last_version 2>/dev/null") return core_lv..","..new end diff --git a/package/ctcgfw/luci-app-openclash/files/usr/lib/lua/luci/model/cbi/openclash/client.lua b/package/ctcgfw/luci-app-openclash/files/usr/lib/lua/luci/model/cbi/openclash/client.lua index b4ea33efeb..c3b62f8b68 100644 --- a/package/ctcgfw/luci-app-openclash/files/usr/lib/lua/luci/model/cbi/openclash/client.lua +++ b/package/ctcgfw/luci-app-openclash/files/usr/lib/lua/luci/model/cbi/openclash/client.lua @@ -37,28 +37,28 @@ function config_check(CONFIG_FILE) end if yaml then if (proxy == 0) then - proxy = 0 + proxy = "" else if (proxy_provier == 0) then - proxy = 0 + proxy = "" else proxy = " - 代理服务器" end end if (group == 0) then - group = 0 + group = "" else group = " - 策略组" end if (rule == 0) then - rule = 0 + rule = "" else rule = " - 规则" end - if proxy and group and rule then + if (proxy=="") and (group=="") and (rule=="") then return "Config Normal" else - return proxy..group..rule.."部分异常" + return proxy..group..rule.." - 部分异常" end elseif (yaml ~= 0) then return "配置文件不存在" diff --git a/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/clash_version.sh b/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/clash_version.sh index d231eed972..8b116ae2b1 100755 --- a/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/clash_version.sh +++ b/package/ctcgfw/luci-app-openclash/files/usr/share/openclash/clash_version.sh @@ -1,9 +1,9 @@ #!/bin/sh CKTIME=$(date "+%Y-%m-%d-%H") LAST_OPVER="/tmp/clash_last_version" -LAST_VER=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |awk -F '-' '{print $1$2}' |sed -i "s/v//" |sed -i "s/.//") -CLASH_VERF=$(echo "/etc/openclash/clash -v 2>/dev/null" && awk -F ' ' '{print $2}') -CLASH_VER=$(echo "$CLASH_VERF" 2>/dev/null |awk -F ' ' '{print $2}' |awk -F '-' '{print $1$2}' |sed -i "s/v//" |sed -i "s/.//") +LAST_VER=$(sed -n 1p "$LAST_OPVER" 2>/dev/null |awk -F '-' '{print $1$2}' 2>/dev/null |awk -F '.' '{print $2$3}' 2>/dev/null) +CLASH_VERF=$(/etc/openclash/clash -v 2>/dev/null) +CLASH_VER=$(echo "$CLASH_VERF" 2>/dev/null |awk -F ' ' '{print $2}' 2>/dev/null |awk -F '-' '{print $1$2}' 2>/dev/null |awk -F '.' '{print $2$3}' 2>/dev/null) version_url="https://raw.githubusercontent.com/vernesong/OpenClash/master/core_version" if [ "$CKTIME" != "$(grep "CheckTime" $LAST_OPVER 2>/dev/null |awk -F ':' '{print $2}')" ]; then curl -sL --connect-timeout 10 --retry 2 "$version_url" -o $LAST_OPVER >/dev/null 2>&1 @@ -15,4 +15,4 @@ if [ "$CKTIME" != "$(grep "CheckTime" $LAST_OPVER 2>/dev/null |awk -F ':' '{prin fi if [ "$LAST_VER" -gt "$CLASH_VER" ]; then return 2 -fi \ No newline at end of file +fi 2>/dev/null \ No newline at end of file