Development

This commit is contained in:
Matthew Grotke 2026-06-09 12:17:40 -04:00
parent 0c4ee8a848
commit a2c2d05d58

View file

@ -36,7 +36,7 @@ def _dnsblocking_log_tail(cfg):
return '(error reading log)', '' return '(error reading log)', ''
WARN_ICON = '&nbsp;<span class="tooltip-wrap" data-tooltip="Cached blocklist used. Verify URL is correct." style="display:inline-flex;align-items:center;"><img src="/www/icons/warning.svg" style="width:1em;height:1em;"></span>' WARN_ICON = '&nbsp;<span class="tooltip-wrap" data-tooltip="Stale blocklist used. Verify URL is correct." style="display:inline-flex;align-items:center;"><img src="/www/icons/warning.svg" style="width:1em;height:1em;"></span>'
ERROR_ICON = '&nbsp;<span class="tooltip-wrap" data-tooltip="Blocklist not found. No cached version available." style="display:inline-flex;align-items:center;"><img src="/www/icons/error.svg" style="width:1em;height:1em;"></span>' ERROR_ICON = '&nbsp;<span class="tooltip-wrap" data-tooltip="Blocklist not found. No cached version available." style="display:inline-flex;align-items:center;"><img src="/www/icons/error.svg" style="width:1em;height:1em;"></span>'
@ -65,17 +65,17 @@ def blocklist_stats_html(cfg):
size_str = config_utils.fmt_bytes(os.path.getsize(bl_path)) size_str = config_utils.fmt_bytes(os.path.getsize(bl_path))
except Exception: except Exception:
size_str = '-' size_str = '-'
last_refreshed = 'Local' last_refreshed = 'Local file'
warn = '' warn = ''
else: else:
fetched_at = db.get('fetched_at') fetched_at = db.get('fetched_at')
if fetched_at: if fetched_at:
last_refreshed = ( last_refreshed = (
f'{datetime.fromtimestamp(fetched_at).strftime("%Y-%m-%d %H:%M")}' f'Downloaded {datetime.fromtimestamp(fetched_at).strftime("%Y-%m-%d %H:%M")}'
f' ({config_utils.relative_time(fetched_at, datetime.now(tz=timezone.utc).timestamp())} ago)' f' ({config_utils.relative_time(fetched_at, datetime.now(tz=timezone.utc).timestamp())} ago)'
) )
else: else:
last_refreshed = 'Never' last_refreshed = 'Never downloaded'
save_as = bl.get('save_as', '') save_as = bl.get('save_as', '')
bl_path = f'{config_utils.BLOCKLISTS_DIR}/{save_as}' if save_as else '' bl_path = f'{config_utils.BLOCKLISTS_DIR}/{save_as}' if save_as else ''
try: try: