|
@ -52,17 +52,26 @@ AddDnsRecordForm[uniqueFormIdTTL]=$formidttl&AddDnsRecordForm[_token]=$form_toke |
|
|
ret=$(_post "$body" "$WORLD4YOU_API/$paketnr/dns" '' POST 'application/x-www-form-urlencoded') |
|
|
ret=$(_post "$body" "$WORLD4YOU_API/$paketnr/dns" '' POST 'application/x-www-form-urlencoded') |
|
|
_resethttp |
|
|
_resethttp |
|
|
|
|
|
|
|
|
if grep '302' >/dev/null <"$HTTP_HEADER"; then |
|
|
|
|
|
|
|
|
if _contains "$(_head_n 3 <"$HTTP_HEADER")" '302'; then |
|
|
res=$(_get "$WORLD4YOU_API/$paketnr/dns") |
|
|
res=$(_get "$WORLD4YOU_API/$paketnr/dns") |
|
|
if _contains "$res" "successfully"; then |
|
|
if _contains "$res" "successfully"; then |
|
|
return 0 |
|
|
return 0 |
|
|
else |
|
|
else |
|
|
msg=$(echo "$res" | tr '\n' '\t' | sed 's/.*<h3 class="mb-5">[^\t]*\t *\([^\t]*\)\t.*/\1/') |
|
|
msg=$(echo "$res" | tr '\n' '\t' | sed 's/.*<h3 class="mb-5">[^\t]*\t *\([^\t]*\)\t.*/\1/') |
|
|
|
|
|
if _contains "$msg" '^<\!DOCTYPE html>'; then |
|
|
|
|
|
msg='Unknown error' |
|
|
|
|
|
fi |
|
|
_err "Unable to add record: $msg" |
|
|
_err "Unable to add record: $msg" |
|
|
|
|
|
if _contains "$msg" '^<\!DOCTYPE html>'; then |
|
|
|
|
|
echo "$ret" >'error-01.html' |
|
|
|
|
|
echo "$res" >'error-02.html' |
|
|
|
|
|
_err "View error-01.html and error-02.html for debugging" |
|
|
|
|
|
fi |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
else |
|
|
else |
|
|
_err "$(_head_n 1 <"$HTTP_HEADER")" |
|
|
|
|
|
|
|
|
_err "$(_head_n 3 <"$HTTP_HEADER")" |
|
|
|
|
|
_err "View $HTTP_HEADER for debugging" |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
@ -111,17 +120,26 @@ DeleteDnsRecordForm[_token]=$form_token" |
|
|
ret=$(_post "$body" "$WORLD4YOU_API/$paketnr/deleteRecord" '' POST 'application/x-www-form-urlencoded') |
|
|
ret=$(_post "$body" "$WORLD4YOU_API/$paketnr/deleteRecord" '' POST 'application/x-www-form-urlencoded') |
|
|
_resethttp |
|
|
_resethttp |
|
|
|
|
|
|
|
|
if grep '302' >/dev/null <"$HTTP_HEADER"; then |
|
|
|
|
|
|
|
|
if _contains "$(_head_n 3 <"$HTTP_HEADER")" '302'; then |
|
|
res=$(_get "$WORLD4YOU_API/$paketnr/dns") |
|
|
res=$(_get "$WORLD4YOU_API/$paketnr/dns") |
|
|
if _contains "$res" "successfully"; then |
|
|
if _contains "$res" "successfully"; then |
|
|
return 0 |
|
|
return 0 |
|
|
else |
|
|
else |
|
|
msg=$(echo "$res" | tr '\n' '\t' | sed 's/.*<h3 class="mb-5">[^\t]*\t *\([^\t]*\)\t.*/\1/') |
|
|
msg=$(echo "$res" | tr '\n' '\t' | sed 's/.*<h3 class="mb-5">[^\t]*\t *\([^\t]*\)\t.*/\1/') |
|
|
|
|
|
if _contains "$msg" '^<\!DOCTYPE html>'; then |
|
|
|
|
|
msg='Unknown error' |
|
|
|
|
|
fi |
|
|
_err "Unable to remove record: $msg" |
|
|
_err "Unable to remove record: $msg" |
|
|
|
|
|
if _contains "$msg" '^<\!DOCTYPE html>'; then |
|
|
|
|
|
echo "$ret" >'error-01.html' |
|
|
|
|
|
echo "$res" >'error-02.html' |
|
|
|
|
|
_err "View error-01.html and error-02.html for debugging" |
|
|
|
|
|
fi |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
else |
|
|
else |
|
|
_err "$(_head_n 1 <"$HTTP_HEADER")" |
|
|
|
|
|
|
|
|
_err "$(_head_n 3 <"$HTTP_HEADER")" |
|
|
|
|
|
_err "View $HTTP_HEADER for debugging" |
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
@ -175,7 +193,7 @@ _get_paketnr() { |
|
|
domains=$(echo "$form" | grep '^ *[A-Za-z0-9_\.-]*\.[A-Za-z0-9_-]*$' | sed 's/^\s*\(\S*\)$/\1/') |
|
|
domains=$(echo "$form" | grep '^ *[A-Za-z0-9_\.-]*\.[A-Za-z0-9_-]*$' | sed 's/^\s*\(\S*\)$/\1/') |
|
|
domain='' |
|
|
domain='' |
|
|
for domain in $domains; do |
|
|
for domain in $domains; do |
|
|
if echo "$fqdn" | grep "$domain\$" >/dev/null; then |
|
|
|
|
|
|
|
|
if _contains "$fqdn" "$domain\$"; then |
|
|
break |
|
|
break |
|
|
fi |
|
|
fi |
|
|
domain='' |
|
|
domain='' |
|
@ -185,7 +203,8 @@ _get_paketnr() { |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
TLD="$domain" |
|
|
TLD="$domain" |
|
|
|
|
|
_debug domain "$domain" |
|
|
RECORD=$(echo "$fqdn" | cut -c"1-$((${#fqdn} - ${#TLD} - 1))") |
|
|
RECORD=$(echo "$fqdn" | cut -c"1-$((${#fqdn} - ${#TLD} - 1))") |
|
|
PAKETNR=$(echo "$form" | grep "data-textfilter=\" $domain " | _head_n 1 | sed 's/^.* \([0-9]*\) .*$/\1/') |
|
|
|
|
|
|
|
|
PAKETNR=$(echo "$form" | grep "data-textfilter=\".* $domain " | _head_n 1 | sed 's/^.* \([0-9]*\) .*$/\1/') |
|
|
return 0 |
|
|
return 0 |
|
|
} |
|
|
} |