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
596a1764
Commit
596a1764
authored
Aug 26, 2020
by
Ed Lynes
Browse files
vetted by shfmt
parent
8e09e1b2
Changes
1
Show whitespace changes
Inline
Side-by-side
dnsapi/dns_edgedns.sh
View file @
596a1764
...
@@ -68,12 +68,13 @@ dns_edgedns_add() {
...
@@ -68,12 +68,13 @@ dns_edgedns_add() {
_debug3
"existing TXT found"
_debug3
"existing TXT found"
_debug3
"record data"
"
$rdlist
"
_debug3
"record data"
"
$rdlist
"
# value already there?
# value already there?
if _contains
"
$rdlist
"
"
$txtvalue
"
; then
if _contains
"
$rdlist
"
"
$txtvalue
"
; then
return 0
return 0
fi
fi
_txt_val=
""
_txt_val=
""
while [
"
$_txt_val
"
!=
"
$rdlist
"
] && [
"
${
rdlist
}
"
]; do
while [
"
$_txt_val
"
!=
"
$rdlist
"
] && [
"
${
rdlist
}
"
]; do
_txt_val=
"
${
rdlist
%%,*
}
"
; rdlist=
"
${
rdlist
#*,
}
"
_txt_val=
"
${
rdlist
%%,*
}
"
rdlist=
"
${
rdlist
#*,
}
"
rdata=
"
${
rdata
}
,
\"
${
_txt_val
}
\"
"
rdata=
"
${
rdata
}
,
\"
${
_txt_val
}
\"
"
done
done
fi
fi
...
@@ -139,10 +140,11 @@ dns_edgedns_rm() {
...
@@ -139,10 +140,11 @@ dns_edgedns_rm() {
rdata=
""
rdata=
""
_txt_val=
""
_txt_val=
""
while [
"
$_txt_val
"
!=
"
$rdlist
"
] && [
"
$rdlist
"
]; do
while [
"
$_txt_val
"
!=
"
$rdlist
"
] && [
"
$rdlist
"
]; do
_txt_val=
"
${
rdlist
%%,*
}
"
; rdlist=
"
${
rdlist
#*,
}
"
_txt_val=
"
${
rdlist
%%,*
}
"
rdlist=
"
${
rdlist
#*,
}
"
_debug3
"_txt_val"
"
$_txt_val
"
_debug3
"_txt_val"
"
$_txt_val
"
_debug3
"txtvalue"
"
$txtvalue
"
_debug3
"txtvalue"
"
$txtvalue
"
if ! _contains
"
$_txt_val
"
"
$txtvalue
"
; then
if ! _contains
"
$_txt_val
"
"
$txtvalue
"
; then
rdata=
"
${
rdata
}${
comma
}
\"
${
_txt_val
}
\"
"
rdata=
"
${
rdata
}${
comma
}
\"
${
_txt_val
}
\"
"
comma=
","
comma=
","
fi
fi
...
@@ -244,7 +246,7 @@ _EDGEDNS_getZoneInfo() {
...
@@ -244,7 +246,7 @@ _EDGEDNS_getZoneInfo() {
return
1
return
1
fi
fi
fi
fi
if
_contains
"
$curResult
"
"
\"
zone
\"
:"
;
then
if
_contains
"
$curResult
"
"
\"
zone
\"
:"
;
then
_debug2
"Zone data"
"
${
curResult
}
"
_debug2
"Zone data"
"
${
curResult
}
"
zone
=
$(
echo
"
${
curResult
}
"
| _egrep_o
"
\"
zone
\"\\
s*:
\\
s*
\"
[^
\"
]*
\"
"
| _head_n 1 |
cut
-d
:
-f
2 |
tr
-d
"
\"
"
)
zone
=
$(
echo
"
${
curResult
}
"
| _egrep_o
"
\"
zone
\"\\
s*:
\\
s*
\"
[^
\"
]*
\"
"
| _head_n 1 |
cut
-d
:
-f
2 |
tr
-d
"
\"
"
)
_debug3
"Zone"
"
${
zone
}
"
_debug3
"Zone"
"
${
zone
}
"
...
@@ -283,7 +285,7 @@ _edgedns_rest() {
...
@@ -283,7 +285,7 @@ _edgedns_rest() {
# Set in acme.sh _post/_get
# Set in acme.sh _post/_get
#_edgedns_headers="${_edgedns_headers}${tab}User-Agent:ACME DNSAPI Edge DNS version ${ACME_EDGEDNS_VERSION}"
#_edgedns_headers="${_edgedns_headers}${tab}User-Agent:ACME DNSAPI Edge DNS version ${ACME_EDGEDNS_VERSION}"
_edgedns_headers
=
"
${
_edgedns_headers
}${
tab
}
Accept: application/json,*/*"
_edgedns_headers
=
"
${
_edgedns_headers
}${
tab
}
Accept: application/json,*/*"
if
[
"
$m
"
!=
"GET"
]
&&
[
"
$m
"
!=
"DELETE"
]
;
then
if
[
"
$m
"
!=
"GET"
]
&&
[
"
$m
"
!=
"DELETE"
]
;
then
_edgedns_content_type
=
"application/json"
_edgedns_content_type
=
"application/json"
_debug3
"_request_body"
"
$_request_body
"
_debug3
"_request_body"
"
$_request_body
"
_body_len
=
$(
echo
"
$_request_body
"
|
tr
-d
"
\n\r
"
|
awk
'{print length}'
)
_body_len
=
$(
echo
"
$_request_body
"
|
tr
-d
"
\n\r
"
|
awk
'{print length}'
)
...
@@ -296,10 +298,11 @@ _edgedns_rest() {
...
@@ -296,10 +298,11 @@ _edgedns_rest() {
work_header
=
"
${
_edgedns_headers
}${
tab
}
"
work_header
=
"
${
_edgedns_headers
}${
tab
}
"
_debug3
"work_header"
"
$work_header
"
_debug3
"work_header"
"
$work_header
"
while
[
"
$work_header
"
]
;
do
while
[
"
$work_header
"
]
;
do
entry
=
"
${
work_header
%%\\t*
}
"
;
work_header
=
"
${
work_header
#*\\t
}
"
entry
=
"
${
work_header
%%\\t*
}
"
work_header
=
"
${
work_header
#*\\t
}
"
export
"
$(
printf
"_H%s=%s"
"
$hdr_indx
"
"
$entry
"
)
"
export
"
$(
printf
"_H%s=%s"
"
$hdr_indx
"
"
$entry
"
)
"
_debug2
"Request Header "
"
$entry
"
_debug2
"Request Header "
"
$entry
"
hdr_indx
=
$((
hdr_indx
+
1
))
hdr_indx
=
$((
hdr_indx
+
1
))
done
done
# clear headers from previous request to avoid getting wrong http code on timeouts
# clear headers from previous request to avoid getting wrong http code on timeouts
...
@@ -444,5 +447,3 @@ _edgedns_base64_sha256() {
...
@@ -444,5 +447,3 @@ _edgedns_base64_sha256() {
# filepath=$1
# filepath=$1
# section=$2
# section=$2
#}
#}
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