Skip to content

Commit 0d8a314

Browse files
authored
Merge pull request #5123 from acmesh-official/dev
sync
2 parents bc90376 + e7cfde1 commit 0d8a314

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

deploy/synology_dsm.sh

+6-3
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ synology_dsm_deploy() {
227227
fi
228228
fi
229229

230-
error_code=$(echo "$response" | grep '"error"' | grep -oP '(?<="code":)\d+')
230+
error_code=$(echo "$response" | grep '"error":' | grep -o '"code":[0-9]*' | grep -o '[0-9]*')
231+
_debug2 error_code "$error_code"
231232
# Account has 2FA-OTP enabled, since error 403 reported.
232233
# https://global.download.synology.com/download/Document/Software/DeveloperGuide/Firmware/DSM/All/enu/Synology_DiskStation_Administration_CLI_Guide.pdf
233234
if [ "$error_code" == "403" ]; then
@@ -261,7 +262,8 @@ synology_dsm_deploy() {
261262
_secure_debug2 SYNO_DEVICE_ID "$SYNO_DEVICE_ID"
262263
fi
263264
fi
264-
error_code=$(echo "$response" | grep '"error"' | grep -oP '(?<="code":)\d+')
265+
error_code=$(echo "$response" | grep '"error":' | grep -o '"code":[0-9]*' | grep -o '[0-9]*')
266+
_debug2 error_code "$error_code"
265267
fi
266268

267269
if [ -n "$error_code" ]; then
@@ -323,7 +325,8 @@ synology_dsm_deploy() {
323325
id=$(echo "$response" | sed -n "s/.*\"desc\":\"$escaped_certificate\",\"id\":\"\([^\"]*\).*/\1/p")
324326
_debug2 id "$id"
325327

326-
error_code=$(echo "$response" | grep '"error"' | grep -oP '(?<="code":)\d+')
328+
error_code=$(echo "$response" | grep '"error":' | grep -o '"code":[0-9]*' | grep -o '[0-9]*')
329+
_debug2 error_code "$error_code"
327330
if [ -n "$error_code" ]; then
328331
if [ "$error_code" -eq 105 ]; then
329332
_err "Current user is not administrator and does not have sufficient permission for deploying."

dnsapi/dns_kappernet.sh

+4-7
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
#KAPPERNETDNS_Key="yourKAPPERNETapikey"
88
#KAPPERNETDNS_Secret="yourKAPPERNETapisecret"
9-
10-
KAPPERNETDNS_Api="https://dnspanel.kapper.net/API/1.2?APIKey=$KAPPERNETDNS_Key&APISecret=$KAPPERNETDNS_Secret"
9+
#KAPPERNETDNS_Api="https://dnspanel.kapper.net/API/1.2?APIKey=$KAPPERNETDNS_Key&APISecret=$KAPPERNETDNS_Secret"
1110

1211
###############################################################################
1312
# called with
@@ -19,10 +18,9 @@ dns_kappernet_add() {
1918

2019
KAPPERNETDNS_Key="${KAPPERNETDNS_Key:-$(_readaccountconf_mutable KAPPERNETDNS_Key)}"
2120
KAPPERNETDNS_Secret="${KAPPERNETDNS_Secret:-$(_readaccountconf_mutable KAPPERNETDNS_Secret)}"
21+
KAPPERNETDNS_Api="https://dnspanel.kapper.net/API/1.2?APIKey=$KAPPERNETDNS_Key&APISecret=$KAPPERNETDNS_Secret"
2222

2323
if [ -z "$KAPPERNETDNS_Key" ] || [ -z "$KAPPERNETDNS_Secret" ]; then
24-
KAPPERNETDNS_Key=""
25-
KAPPERNETDNS_Secret=""
2624
_err "Please specify your kapper.net api key and secret."
2725
_err "If you have not received yours - send your mail to"
2826
_err "[email protected] to get your key and secret."
@@ -66,10 +64,9 @@ dns_kappernet_rm() {
6664

6765
KAPPERNETDNS_Key="${KAPPERNETDNS_Key:-$(_readaccountconf_mutable KAPPERNETDNS_Key)}"
6866
KAPPERNETDNS_Secret="${KAPPERNETDNS_Secret:-$(_readaccountconf_mutable KAPPERNETDNS_Secret)}"
67+
KAPPERNETDNS_Api="https://dnspanel.kapper.net/API/1.2?APIKey=$KAPPERNETDNS_Key&APISecret=$KAPPERNETDNS_Secret"
6968

7069
if [ -z "$KAPPERNETDNS_Key" ] || [ -z "$KAPPERNETDNS_Secret" ]; then
71-
KAPPERNETDNS_Key=""
72-
KAPPERNETDNS_Secret=""
7370
_err "Please specify your kapper.net api key and secret."
7471
_err "If you have not received yours - send your mail to"
7572
_err "[email protected] to get your key and secret."
@@ -141,7 +138,7 @@ _kappernet_api() {
141138
if [ "$method" = "GET" ]; then
142139
response="$(_get "$url")"
143140
else
144-
_err "Unsupported method"
141+
_err "Unsupported method or missing Secret/Key"
145142
return 1
146143
fi
147144

0 commit comments

Comments
 (0)