mirror of
https://github.com/EV21/dynb.git
synced 2025-12-26 16:39:32 +01:00
cosmetic: 🎨 fix shell style
This commit is contained in:
48
dynb.sh
48
dynb.sh
@@ -108,13 +108,15 @@ function logtime() {
|
|||||||
|
|
||||||
# The main domain as an identifier for the dns zone is required for the updateRecord call
|
# The main domain as an identifier for the dns zone is required for the updateRecord call
|
||||||
function getMainDomain() {
|
function getMainDomain() {
|
||||||
request=$( echo "{}" | \
|
request=$(
|
||||||
jq '(.method="nameserver.list")' | \
|
echo "{}" |
|
||||||
jq "(.params.user=\"$DYNB_USERNAME\")" | \
|
jq '(.method="nameserver.list")' |
|
||||||
|
jq "(.params.user=\"$DYNB_USERNAME\")" |
|
||||||
jq "(.params.pass=\"$DYNB_PASSWORD\")"
|
jq "(.params.pass=\"$DYNB_PASSWORD\")"
|
||||||
)
|
)
|
||||||
|
|
||||||
_response=$(curl --silent \
|
_response=$(
|
||||||
|
curl --silent \
|
||||||
"$_interface_str" \
|
"$_interface_str" \
|
||||||
--user-agent "$_userAgent" \
|
--user-agent "$_userAgent" \
|
||||||
--header "Content-Type: application/json" \
|
--header "Content-Type: application/json" \
|
||||||
@@ -125,15 +127,17 @@ function getMainDomain() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function fetchDNSRecords() {
|
function fetchDNSRecords() {
|
||||||
request=$( echo "{}" | \
|
request=$(
|
||||||
jq '(.method="'nameserver.info'")' | \
|
echo "{}" |
|
||||||
jq "(.params.user=\"$DYNB_USERNAME\")" | \
|
jq '(.method="'nameserver.info'")' |
|
||||||
jq "(.params.pass=\"$DYNB_PASSWORD\")" | \
|
jq "(.params.user=\"$DYNB_USERNAME\")" |
|
||||||
jq "(.params.domain=\"$_main_domain\")" | \
|
jq "(.params.pass=\"$DYNB_PASSWORD\")" |
|
||||||
|
jq "(.params.domain=\"$_main_domain\")" |
|
||||||
jq "(.params.name=\"$DYNB_DYN_DOMAIN\")"
|
jq "(.params.name=\"$DYNB_DYN_DOMAIN\")"
|
||||||
)
|
)
|
||||||
|
|
||||||
_response=$( curl --silent \
|
_response=$(
|
||||||
|
curl --silent \
|
||||||
"$_interface_str" \
|
"$_interface_str" \
|
||||||
--user-agent "$_userAgent" \
|
--user-agent "$_userAgent" \
|
||||||
--header "Content-Type: application/json" \
|
--header "Content-Type: application/json" \
|
||||||
@@ -187,16 +191,18 @@ function updateRecord() {
|
|||||||
IP=$_new_IPv6
|
IP=$_new_IPv6
|
||||||
fi
|
fi
|
||||||
if [[ $IP != "" ]]; then
|
if [[ $IP != "" ]]; then
|
||||||
request=$( echo "{}" | \
|
request=$(
|
||||||
jq '(.method="nameserver.updateRecord")' | \
|
echo "{}" |
|
||||||
jq "(.params.user=\"$DYNB_USERNAME\")" | \
|
jq '(.method="nameserver.updateRecord")' |
|
||||||
jq "(.params.pass=\"$DYNB_PASSWORD\")" | \
|
jq "(.params.user=\"$DYNB_USERNAME\")" |
|
||||||
jq "(.params.id=\"$ID\")" | \
|
jq "(.params.pass=\"$DYNB_PASSWORD\")" |
|
||||||
jq "(.params.content=\"$IP\")" | \
|
jq "(.params.id=\"$ID\")" |
|
||||||
|
jq "(.params.content=\"$IP\")" |
|
||||||
jq "(.params.ttl=\"$TTL\")"
|
jq "(.params.ttl=\"$TTL\")"
|
||||||
)
|
)
|
||||||
|
|
||||||
_response=$(curl --silent \
|
_response=$(
|
||||||
|
curl --silent \
|
||||||
"$_interface_str" \
|
"$_interface_str" \
|
||||||
--user-agent "$_userAgent" \
|
--user-agent "$_userAgent" \
|
||||||
--header "Content-Type: application/json" \
|
--header "Content-Type: application/json" \
|
||||||
@@ -269,7 +275,8 @@ function dynupdate() {
|
|||||||
"${dyndns_update_url}")
|
"${dyndns_update_url}")
|
||||||
;;
|
;;
|
||||||
dynv6* | duckDNS* | duckdns*)
|
dynv6* | duckDNS* | duckdns*)
|
||||||
_response=$(curl --silent "$_interface_str" \
|
_response=$(
|
||||||
|
curl --silent "$_interface_str" \
|
||||||
--user-agent "$_userAgent" \
|
--user-agent "$_userAgent" \
|
||||||
"${dyndns_update_url}"
|
"${dyndns_update_url}"
|
||||||
)
|
)
|
||||||
@@ -677,7 +684,7 @@ function doUpdates() {
|
|||||||
## MAIN method ##
|
## MAIN method ##
|
||||||
#################
|
#################
|
||||||
function dynb() {
|
function dynb() {
|
||||||
# shellcheck disable=SC1091
|
# shellcheck disable=SC1091,SC1090
|
||||||
source "$(dirname "$(realpath "$0")")/dynb-parsing.sh"
|
source "$(dirname "$(realpath "$0")")/dynb-parsing.sh"
|
||||||
|
|
||||||
# shellcheck source=.env
|
# shellcheck source=.env
|
||||||
@@ -702,8 +709,7 @@ function dynb() {
|
|||||||
checkDependencies
|
checkDependencies
|
||||||
|
|
||||||
if loopMode; then
|
if loopMode; then
|
||||||
while :
|
while :; do
|
||||||
do
|
|
||||||
doUpdates
|
doUpdates
|
||||||
sleep $DYNB_INTERVAL
|
sleep $DYNB_INTERVAL
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user