implement v2 API, fixes #5

This commit is contained in:
troyengel 2017-09-16 10:22:07 -05:00
parent 414218468f
commit e35aa941e1
4 changed files with 34 additions and 22 deletions

View file

@ -2,7 +2,7 @@
#
## petrified - bash client to update dynamic DNS at freedns.afraid.org
## Copyright (c) 2015 Troy Engel
## Version: 1.0.6
## Version: 2.0.0
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -37,8 +37,8 @@ while getopts ":c:" opt; do
esac
done
## How to update DNS - DDNS_KEY is unique per domain
DDNS_URL=https://freedns.afraid.org/dynamic/update.php
## v2 API - How to update DNS - DDNS_KEY is unique per domain
DDNS_URL=https://sync.afraid.org/u/
DDNS_KEY=""
## Which URL to use to get an IP
@ -215,7 +215,7 @@ fi
# If they don't match, tell upstream
if [[ "${OLDIP}" != "${NEWIP}" ]]; then
UPDURL="${DDNS_URL}?${DDNS_KEY}&address=${NEWIP}"
UPDURL="${DDNS_URL}${DDNS_KEY}/?ip=${NEWIP}"
RESULT=$(curl -m ${CURL_WAIT} -sk "${UPDURL}" 2>/dev/null)
logmsg "${RESULT}"
else