Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
ae4c186f
Commit
ae4c186f
authored
Sep 07, 2023
by
Tobias Grave
Browse files
Fix Variomedia API
parent
86521ec4
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_variomedia.sh
View file @
ae4c186f
...
@@ -69,7 +69,7 @@ dns_variomedia_rm() {
...
@@ -69,7 +69,7 @@ dns_variomedia_rm() {
return
1
return
1
fi
fi
_record_id
=
"
$(
echo
"
$response
"
|
cut
-d
'['
-f2
|
cut
-d
']'
-f1
|
sed
's/},[ \t]*{/\},§\{/g'
|
tr
§
'\n'
|
grep
"
$_sub_domain
"
|
grep
"
$txtvalue
"
|
sed
's/^{//;s/}[,]?$//'
|
tr
,
'\n'
|
tr
-d
'\"'
|
grep
^id |
cut
-d
:
-f2
|
tr
-d
' '
)
"
_record_id
=
"
$(
echo
"
$response
"
|
sed
-E
's/,"tags":\[[^]]*\]//g'
|
cut
-d
'['
-f2
|
cut
-d
']'
-f1
|
sed
's/},[ \t]*{/\},§\{/g'
|
tr
§
'\n'
|
grep
"
$_sub_domain
"
|
grep
--
"
$txtvalue
"
|
sed
's/^{//;s/}[,]?$//'
|
tr
,
'\n'
|
tr
-d
'\"'
|
grep
^id |
cut
-d
:
-f2
|
tr
-d
' '
)
"
_debug _record_id
"
$_record_id
"
_debug _record_id
"
$_record_id
"
if
[
"
$_record_id
"
]
;
then
if
[
"
$_record_id
"
]
;
then
_info
"Successfully retrieved the record id for ACME challenge."
_info
"Successfully retrieved the record id for ACME challenge."
...
@@ -93,11 +93,11 @@ dns_variomedia_rm() {
...
@@ -93,11 +93,11 @@ dns_variomedia_rm() {
# _sub_domain=_acme-challenge.www
# _sub_domain=_acme-challenge.www
# _domain=domain.com
# _domain=domain.com
_get_root
()
{
_get_root
()
{
fulldomain
=
$1
domain
=
$1
i
=
1
i
=
2
p
=
1
while
true
;
do
while
true
;
do
h
=
$(
printf
"%s"
"
$fulldomain
"
|
cut
-d
.
-f
$i
-100
)
h
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
.
-f
$i
-100
)
_debug h
"
$h
"
if
[
-z
"
$h
"
]
;
then
if
[
-z
"
$h
"
]
;
then
return
1
return
1
fi
fi
...
@@ -106,17 +106,14 @@ _get_root() {
...
@@ -106,17 +106,14 @@ _get_root() {
return
1
return
1
fi
fi
if
_startswith
"
$response
"
"
\{\"
data
\"
:"
;
then
if
_contains
"
$response
"
"
\"
id
\"
:
\"
$h
\"
"
;
then
if
_contains
"
$response
"
"
\"
id
\"
:
\"
$h
\"
"
;
then
_sub_domain
=
$(
printf
"%s"
"
$domain
"
|
cut
-d
'.'
-f
1-
$p
)
_sub_domain
=
"
$(
echo
"
$fulldomain
"
|
sed
"s/
\\
.
$h
\$
//"
)
"
_domain
=
"
$h
"
_domain
=
$h
return
0
return
0
fi
fi
fi
p
=
$i
i
=
$(
_math
"
$i
"
+ 1
)
i
=
$(
_math
"
$i
"
+ 1
)
done
done
_debug
"root domain not found"
return
1
return
1
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment