diff --git a/README.md b/README.md index 727731e..1fb4d0d 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,10 @@ The primary purposes for building yet another DDNS tool for updating Cloudflare - Unforunately Cloudflare does not allow limiting the edit privileges to a single DNS record in a zone at this point. - Self-hosted option for receving DDNS updates from a router or other local source rather than depending on querying an external API for public IP address changes -Valid response codes were gathered from here: +Valid response codes were gathered from here:\ + https://help.dyn.com/remote-access-api/\ https://github.com/troglobit/inadyn/blob/master/plugins/common.c This service requires a GET request in the following format - https://:@ddns.example.com/update?hostname=&ip= + https://:@ddns.example.com/nic/update?hostname=&myip= diff --git a/app.py b/app.py index bdc53cc..48713d0 100644 --- a/app.py +++ b/app.py @@ -30,6 +30,7 @@ def unauthorized(): return "badauth" @app.route('/update') +@app.route('/nic/update') @auth.login_required def main(): # Set hostname variable @@ -39,8 +40,8 @@ def main(): hostname = 'blank' # Set ip variable - if 'ip' in request.args: - ip = request.args.get('ip') + if 'myip' in request.args: + ip = request.args.get('myip') else: ip = 'blank' diff --git a/tests/test_app.py b/tests/test_app.py index 8f92a3d..2ec159f 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -12,25 +12,25 @@ def basic_auth(username, password): def test_good_auth(app, client): auth_headers = basic_auth('testuser', 'testpass') - res = client.get('/update?hostname=test.domain.com&ip=0.0.0.0', headers=auth_headers) + res = client.get('/nic/update?hostname=test.domain.com&myip=0.0.0.0', headers=auth_headers) assert b'noapitoken' in res.data assert res.status_code == 200 def test_bad_auth(app, client): auth_headers = basic_auth('testuser', 'badpass') - res = client.get('/update?hostname=test.domain.com&ip=0.0.0.0', headers=auth_headers) + res = client.get('/nic/update?hostname=test.domain.com&myip=0.0.0.0', headers=auth_headers) assert b'badauth' in res.data assert res.status_code == 401 def test_missing_hostname(app, client): auth_headers = basic_auth('testuser', 'testpass') - res = client.get('/update?ip=0.0.0.0', headers=auth_headers) + res = client.get('/nic/update?myip=0.0.0.0', headers=auth_headers) assert b'nohost' in res.data assert res.status_code == 200 def test_missing_ip(app, client): auth_headers = basic_auth('testuser', 'testpass') - res = client.get('/update?hostname=test.domain.com', headers=auth_headers) + res = client.get('/nic/update?hostname=test.domain.com', headers=auth_headers) assert b'noip' in res.data assert res.status_code == 200