diff --git a/ddns.py b/ddns.py index ebf50be..0ffaa8a 100755 --- a/ddns.py +++ b/ddns.py @@ -383,10 +383,7 @@ def updateip(force): remote = current.read().decode('utf-8') remoteData = json.loads(remote) remoteIP4 = remoteData['domain_record']['data'] - if force == True: - remoteIP4 = '0.0.0.0' - # Only update domains with outdated IP's - if remoteIP4 != current_ip: + if remoteIP4 != current_ip or force == True: data = {'type': 'A', 'data': current_ip} headers = {'Authorization': 'Bearer ' + apikey, "Content-Type": "application/json"} response = requests.patch('https://api.digitalocean.com/v2/domains/'+domain_name+'/records/' + subdomain_id, data=json.dumps(data), headers=headers) @@ -441,7 +438,7 @@ def updatedb(): cursor = conn.cursor() info = conn.execute("PRAGMA table_info('subdomains')").fetchall() if not any(new_table in word for word in info): - add_column = "ALTER TABLE subdomains ADD COLUMN last_updated text" + add_column = "ALTER TABLE subdomains ADD COLUMN last_updated text default 'N/A'" conn.execute(add_column) conn.commit()