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, ''
|
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:
|
return 'Last checked: ---'
|
||||||
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: ---'
|
|
||||||
|
|
||||||
def _vpn_info():
|
def _vpn_info():
|
||||||
for vlan in _load_core().get('vlans', []):
|
for vlan in _load_core().get('vlans', []):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue