diff --git a/Makefile b/Makefile index b300eed7..9388ee1a 100644 --- a/Makefile +++ b/Makefile @@ -139,7 +139,8 @@ define Package/$(PKG_NAME)/install $(INSTALL_BIN) ./root/usr/share/rpcd/acl.d/luci-app-clash.json $(1)/usr/share/rpcd/acl.d $(INSTALL_BIN) ./root/usr/share/clash/rules/g_rules/Steam.rules $(1)/usr/share/clash/rules/g_rules $(INSTALL_BIN) ./root//usr/share/clash/rules/rules.list $(1)/usr/share/clash/rules - + + $(INSTALL_BIN) ./root/usr/share/clash/luci_version $(1)/usr/share/clash $(INSTALL_BIN) ./root/usr/share/clash/rule.yaml $(1)/usr/share/clash $(INSTALL_BIN) ./root/usr/share/clash/server.list $(1)/usr/share/clash $(INSTALL_BIN) ./root/usr/share/clash/clash_real.txt $(1)/usr/share/clash diff --git a/luasrc/controller/clash.lua b/luasrc/controller/clash.lua index 6590c66a..af695ae7 100644 --- a/luasrc/controller/clash.lua +++ b/luasrc/controller/clash.lua @@ -170,9 +170,9 @@ local function localip() return luci.sys.exec("uci get network.lan.ipaddr") end ---local function check_version() --- return luci.sys.exec("sh /usr/share/clash/check_luci_version.sh") ---end +local function check_version() + return luci.sys.exec("sh /usr/share/clash/check_luci_version.sh") +end local function check_core() return luci.sys.exec("sh /usr/share/clash/check_core_version.sh") @@ -186,19 +186,12 @@ local function check_clashtun_core() return luci.sys.exec("sh /usr/share/clash/check_clashtun_core_version.sh") end ---local function current_version() --- return luci.sys.exec("sed -n 1p /usr/share/clash/luci_version") ---end - ---local function new_version() --- return luci.sys.exec("sed -n 1p /usr/share/clash/new_luci_version") ---end local function current_version() - return luci.sys.exec("opkg list-installed |grep 'luci-app-clash' |awk -F '- ' '{print $2}'") + return luci.sys.exec("sed -n 1p /usr/share/clash/luci_version") end local function new_version() - return luci.sys.exec("curl -sL "https://api.github.com/repos/frainzy1477/luci-app-clash/releases/latest" --connect-timeout 10| grep 'tag_name' | cut -d\" -f4") + return luci.sys.exec("sed -n 1p /usr/share/clash/new_luci_version") end local function new_core_version() @@ -337,7 +330,7 @@ end function check_status() luci.http.prepare_content("application/json") luci.http.write_json({ - --check_version = check_version(), + check_version = check_version(), check_core = check_core(), current_version = current_version(), check_clashr_core = check_clashr_core(), diff --git a/luasrc/view/clash/status.htm b/luasrc/view/clash/status.htm index 68d05e1a..8dae2304 100644 --- a/luasrc/view/clash/status.htm +++ b/luasrc/view/clash/status.htm @@ -240,7 +240,7 @@ - XHR.poll(3,'<%=luci.dispatcher.build_url("admin", "services", "clash", "check_status")%>', null, function(x, status) {}); + XHR.poll(5,'<%=luci.dispatcher.build_url("admin", "services", "clash", "check_status")%>', null, function(x, status) {}); //]]> diff --git a/luasrc/view/clash/update.htm b/luasrc/view/clash/update.htm index 2e008582..0d82602c 100644 --- a/luasrc/view/clash/update.htm +++ b/luasrc/view/clash/update.htm @@ -76,7 +76,7 @@ }); - XHR.poll(3,'<%=luci.dispatcher.build_url("admin", "services", "clash", "check_status")%>', null, function(x, status) {}); + XHR.poll(5,'<%=luci.dispatcher.build_url("admin", "services", "clash", "check_status")%>', null, function(x, status) {}); XHR.poll(1,'<%=luci.dispatcher.build_url("admin", "services", "clash", "status")%>', null, function(x, status) { diff --git a/root/usr/share/clash/luci_version b/root/usr/share/clash/luci_version new file mode 100644 index 00000000..65bc964a --- /dev/null +++ b/root/usr/share/clash/luci_version @@ -0,0 +1 @@ +v1.7.5.4