Skip to content

Commit

Permalink
0.46.063
Browse files Browse the repository at this point in the history
  • Loading branch information
vernesong committed Dec 26, 2024
1 parent 5a73c08 commit 8af662b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion luci-app-openclash/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.46.062
PKG_VERSION:=0.46.063
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
Expand Down
22 changes: 18 additions & 4 deletions luci-app-openclash/luasrc/controller/openclash.lua
Original file line number Diff line number Diff line change
Expand Up @@ -675,20 +675,34 @@ function sub_info_get()
expire = os.date("%Y-%m-%d", day_expire) or "null"
if day_expire and os.time() <= day_expire then
day_left = math.ceil((day_expire - os.time()) / (3600*24))
if math.ceil(day_left / 365) > 50 then
day_left = ""
end
elseif day_expire == nil then
day_left = "null"
else
day_left = 0
end
if used and total and used < total then
if used and total and used <= total then
percent = string.format("%.1f",((total-used)/total)*100) or nil
elseif used == nil or total == nil or total == 0 then
surplus = fs.filesize(total - used) or "null"
elseif used == nil and total and total > 0.0 then
percent = 100
surplus = total
elseif total and total == 0.0 then
percent = 100
surplus = ""
else
percent = 0
surplus = "null"
end
if total and total > 0.0 then
total = fs.filesize(total) or "null"
elseif total and total == 0.0 then
total = ""
else
total = "null"
end
surplus = fs.filesize(total - used) or "null"
total = fs.filesize(total) or "null"
used = fs.filesize(used) or "null"
sub_info = "Successful"
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1585,7 +1585,7 @@ function network_test()
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
if tonumber(httpcode1) == 204 or tonumber(httpcode2) == 204 then
unlock_auto_select()
return
end
Expand Down

0 comments on commit 8af662b

Please sign in to comment.