@@ -680,38 +680,61 @@ function sub_info_get()
680
680
if string.match (info , " expire=%d+" ) then
681
681
day_expire = tonumber (string.sub (string.match (info , " expire=%d+" ), 8 , - 1 )) or nil
682
682
end
683
- expire = os.date (" %Y-%m-%d" , day_expire ) or " null"
684
- if day_expire and os.time () <= day_expire then
683
+
684
+ if day_expire and day_expire == 0 then
685
+ expire = luci .i18n .translate (" Long-term" )
686
+ elseif day_expire then
687
+ expire = os.date (" %Y-%m-%d" , day_expire ) or " null"
688
+ else
689
+ expire = " null"
690
+ end
691
+
692
+ if day_expire and day_expire ~= 0 and os.time () <= day_expire then
685
693
day_left = math.ceil ((day_expire - os.time ()) / (3600 * 24 ))
686
694
if math.ceil (day_left / 365 ) > 50 then
687
695
day_left = " ∞"
688
696
end
697
+ elseif day_expire and day_expire == 0 then
698
+ day_left = " ∞"
689
699
elseif day_expire == nil then
690
700
day_left = " null"
691
701
else
692
702
day_left = 0
693
703
end
694
- if used and total and used <= total then
695
- percent = string.format (" %.1f" ,((total - used )/ total )* 100 ) or nil
696
- surplus = fs .filesize (total - used ) or " null"
704
+
705
+ if used and total and used <= total and total > 0 then
706
+ percent = string.format (" %.1f" ,((total - used )/ total )* 100 ) or " 100"
707
+ surplus = fs .filesize (total - used )
708
+ elseif used and total and used > total and total > 0 then
709
+ percent = " 0"
710
+ surplus = " -" .. fs .filesize (total - used )
711
+ elseif used and total and used < total and total == 0.0 then
712
+ percent = " 0"
713
+ surplus = fs .filesize (total - used )
714
+ elseif used and total and used == total and total == 0.0 then
715
+ percent = " 0"
716
+ surplus = " 0.0 KB"
717
+ elseif used and total and used > total and total == 0.0 then
718
+ percent = " 100"
719
+ surplus = fs .filesize (total - used )
697
720
elseif used == nil and total and total > 0.0 then
698
721
percent = 100
699
- surplus = total
700
- elseif total and total == 0.0 then
722
+ surplus = fs . filesize ( total )
723
+ elseif used == nil and total and total == 0.0 then
701
724
percent = 100
702
725
surplus = " ∞"
703
726
else
704
727
percent = 0
705
728
surplus = " null"
706
729
end
707
- if total and total > 0.0 then
708
- total = fs .filesize (total ) or " null "
730
+ if total and total > 0 then
731
+ total = fs .filesize (total )
709
732
elseif total and total == 0.0 then
710
733
total = " ∞"
711
734
else
712
735
total = " null"
713
736
end
714
- used = fs .filesize (used ) or " null "
737
+ used = fs .filesize (used )
715
738
sub_info = " Successful"
716
739
else
717
740
sub_info = " No Sub Info Found"
@@ -1196,6 +1219,10 @@ function action_refresh_log()
1196
1219
if len == log_len then return nil end
1197
1220
if log_len == 0 then
1198
1221
if len > limit then lens = limit else lens = len end
1222
+ elseif len - log_len > limit then
1223
+ lens = limit
1224
+ elseif len < log_len then
1225
+ lens = len
1199
1226
else
1200
1227
lens = len - log_len
1201
1228
end
0 commit comments