Development
This commit is contained in:
parent
6298f27d29
commit
465cb9eb0c
1 changed files with 4 additions and 10 deletions
|
|
@ -562,17 +562,11 @@ def _public_ip_info(ddns_cfg):
|
|||
return 'DDNS Offline', domains_sub, next_interval, ''
|
||||
|
||||
def _ddns_last_checked():
|
||||
"""Return 'Last checked: X ago' by scanning ddns.log in reverse for 'Public IP retrieved from'."""
|
||||
try:
|
||||
with open(f'{CONFIGS_DIR}/ddns.log') as f:
|
||||
lines = f.read().splitlines()
|
||||
for line in reversed(lines):
|
||||
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: ---'
|
||||
mtime = os.path.getmtime(f'{CONFIGS_DIR}/.ddns-last-service')
|
||||
return f'Last checked: {_relative_time(mtime)}'
|
||||
except OSError:
|
||||
return 'Last checked: ---'
|
||||
|
||||
def _vpn_info():
|
||||
for vlan in _load_core().get('vlans', []):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue