Development

This commit is contained in:
Matthew Grotke 2026-05-24 12:22:07 -04:00
parent 6298f27d29
commit 465cb9eb0c

View file

@ -562,16 +562,10 @@ def _public_ip_info(ddns_cfg):
return 'DDNS Offline', domains_sub, next_interval, '' return 'DDNS Offline', domains_sub, next_interval, ''
def _ddns_last_checked(): def _ddns_last_checked():
"""Return 'Last checked: X ago' by scanning ddns.log in reverse for 'Public IP retrieved from'."""
try: try:
with open(f'{CONFIGS_DIR}/ddns.log') as f: mtime = os.path.getmtime(f'{CONFIGS_DIR}/.ddns-last-service')
lines = f.read().splitlines() return f'Last checked: {_relative_time(mtime)}'
for line in reversed(lines): except OSError:
if 'Public IP retrieved from' in line:
dt = datetime.strptime(line[:19], '%Y-%m-%d %H:%M:%S')
return f'Last checked: {_relative_time(dt.timestamp())}'
except Exception:
pass
return 'Last checked: ---' return 'Last checked: ---'
def _vpn_info(): def _vpn_info():