Development
This commit is contained in:
parent
b0892a2ddd
commit
50e2beb2cb
1 changed files with 7 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ import json, re, subprocess, os, sys, html as html_mod
|
||||||
import sanitize
|
import sanitize
|
||||||
import validation as validate
|
import validation as validate
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
|
||||||
from config_utils import core_hash, get_pending_entries, get_dashboard_pending, _seconds_until_next_run, _format_timing, _is_locked, _lock_mtime, PRODUCT_DISPLAY_NAME
|
from config_utils import core_hash, get_pending_entries, get_dashboard_pending, _seconds_until_next_run, _format_timing, _is_locked, _lock_mtime, PRODUCT_DISPLAY_NAME
|
||||||
|
|
||||||
bp = Blueprint('view_page', __name__)
|
bp = Blueprint('view_page', __name__)
|
||||||
|
|
@ -430,7 +431,12 @@ def _blocklist_stats_html(core):
|
||||||
entries = sum(1 for _ in f)
|
entries = sum(1 for _ in f)
|
||||||
mtime = int(os.path.getmtime(bl_path))
|
mtime = int(os.path.getmtime(bl_path))
|
||||||
size_str = _fmt_bytes(os.path.getsize(bl_path))
|
size_str = _fmt_bytes(os.path.getsize(bl_path))
|
||||||
last_refreshed = f'{datetime.fromtimestamp(mtime).strftime("%Y-%m-%d %H:%M")} ({_relative_time(mtime)})'
|
tz_name = session.get('timezone', '')
|
||||||
|
try:
|
||||||
|
tz = ZoneInfo(tz_name) if tz_name else timezone.utc
|
||||||
|
except ZoneInfoNotFoundError:
|
||||||
|
tz = timezone.utc
|
||||||
|
last_refreshed = f'{datetime.fromtimestamp(mtime, tz=tz).strftime("%Y-%m-%d %H:%M")} ({_relative_time(mtime)})'
|
||||||
except Exception:
|
except Exception:
|
||||||
entries, size_str, last_refreshed = '-', '-', 'Never'
|
entries, size_str, last_refreshed = '-', '-', 'Never'
|
||||||
rows += (f'<tr>'
|
rows += (f'<tr>'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue