Skip to content

Commit 8ba7d02

Browse files
authored
Merge pull request #4059 from NerLOR/master
dns_world4you: fix _parse_paket_nr
2 parents ef8a199 + db83643 commit 8ba7d02

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

dnsapi/dns_world4you.sh

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,14 @@ dns_world4you_add() {
5454
if _contains "$res" "successfully"; then
5555
return 0
5656
else
57-
msg=$(echo "$res" | tr '\n' '\t' | sed 's/.*<h3 class="mb-5">[^\t]*\t *\([^\t]*\)\t.*/\1/')
58-
if _contains "$msg" '^<\!DOCTYPE html>'; then
59-
msg='Unknown error'
60-
fi
61-
_err "Unable to add record: $msg"
62-
if _contains "$msg" '^<\!DOCTYPE html>'; then
57+
msg=$(echo "$res" | grep -A 15 'data-type="danger"' | grep "<h3[^>]*>[^<]" | sed 's/<[^>]*>\|^\s*//g')
58+
if [ "$msg" = '' ]; then
59+
_err "Unable to add record: Unknown error"
6360
echo "$ret" >'error-01.html'
6461
echo "$res" >'error-02.html'
6562
_err "View error-01.html and error-02.html for debugging"
63+
else
64+
_err "Unable to add record: my.world4you.com: $msg"
6665
fi
6766
return 1
6867
fi
@@ -119,15 +118,14 @@ dns_world4you_rm() {
119118
if _contains "$res" "successfully"; then
120119
return 0
121120
else
122-
msg=$(echo "$res" | tr '\n' '\t' | sed 's/.*<h3 class="mb-5">[^\t]*\t *\([^\t]*\)\t.*/\1/')
123-
if _contains "$msg" '^<\!DOCTYPE html>'; then
124-
msg='Unknown error'
125-
fi
126-
_err "Unable to remove record: $msg"
127-
if _contains "$msg" '^<\!DOCTYPE html>'; then
121+
msg=$(echo "$res" | grep -A 15 'data-type="danger"' | grep "<h3[^>]*>[^<]" | sed 's/<[^>]*>\|^\s*//g')
122+
if [ "$msg" = '' ]; then
123+
_err "Unable to remove record: Unknown error"
128124
echo "$ret" >'error-01.html'
129125
echo "$res" >'error-02.html'
130126
_err "View error-01.html and error-02.html for debugging"
127+
else
128+
_err "Unable to remove record: my.world4you.com: $msg"
131129
fi
132130
return 1
133131
fi
@@ -199,6 +197,6 @@ _get_paketnr() {
199197
TLD="$domain"
200198
_debug domain "$domain"
201199
RECORD=$(echo "$fqdn" | cut -c"1-$((${#fqdn} - ${#TLD} - 1))")
202-
PAKETNR=$(echo "$form" | grep "data-textfilter=\".* $domain " | _head_n 1 | sed 's/^.* \([0-9]*\) .*$/\1/')
200+
PAKETNR=$(echo "$form" | grep "data-textfilter=\".* $domain " | _tail_n 1 | sed "s|.*$WORLD4YOU_API/\\([0-9]*\\)/.*|\\1|")
203201
return 0
204202
}

0 commit comments

Comments
 (0)