Fix Auth API access for DSM 6
This commit is contained in:
parent
f7d9d53ad2
commit
8a09412bef
@ -168,7 +168,7 @@ synology_dsm_deploy() {
|
|||||||
_savedeployconf SYNO_Device_ID "$SYNO_Device_ID"
|
_savedeployconf SYNO_Device_ID "$SYNO_Device_ID"
|
||||||
|
|
||||||
_info "Getting certificates in Synology DSM"
|
_info "Getting certificates in Synology DSM"
|
||||||
response=$(_post "api=SYNO.Core.Certificate.CRT&method=list&version=1&_sid=$sid" "$_base_url/webapi/entry.cgi")
|
response=$(_post "api=SYNO.Core.Certificate.CRT&method=list&version=1&_sid=$sid" "$_base_url/webapi/$api_path")
|
||||||
_debug3 response "$response"
|
_debug3 response "$response"
|
||||||
escaped_certificate="$(printf "%s" "$SYNO_Certificate" | sed 's/\([].*^$[]\)/\\\1/g;s/"/\\\\"/g')"
|
escaped_certificate="$(printf "%s" "$SYNO_Certificate" | sed 's/\([].*^$[]\)/\\\1/g;s/"/\\\\"/g')"
|
||||||
_debug escaped_certificate "$escaped_certificate"
|
_debug escaped_certificate "$escaped_certificate"
|
||||||
@ -202,7 +202,7 @@ synology_dsm_deploy() {
|
|||||||
content="${content%_}" # protect trailing \n
|
content="${content%_}" # protect trailing \n
|
||||||
|
|
||||||
_info "Upload certificate to the Synology DSM"
|
_info "Upload certificate to the Synology DSM"
|
||||||
response=$(_post "$content" "$_base_url/webapi/entry.cgi?api=SYNO.Core.Certificate&method=import&version=1&SynoToken=$token&_sid=$sid" "" "POST" "multipart/form-data; boundary=${delim}")
|
response=$(_post "$content" "$_base_url/webapi/$api_path?api=SYNO.Core.Certificate&method=import&version=1&SynoToken=$token&_sid=$sid" "" "POST" "multipart/form-data; boundary=${delim}")
|
||||||
_debug3 response "$response"
|
_debug3 response "$response"
|
||||||
|
|
||||||
if ! echo "$response" | grep '"error":' >/dev/null; then
|
if ! echo "$response" | grep '"error":' >/dev/null; then
|
||||||
@ -224,6 +224,6 @@ synology_dsm_deploy() {
|
|||||||
#################### Private functions below ##################################
|
#################### Private functions below ##################################
|
||||||
_logout() {
|
_logout() {
|
||||||
# Logout to not occupy a permanent session, e.g. in DSM's "Connected Users" widget
|
# Logout to not occupy a permanent session, e.g. in DSM's "Connected Users" widget
|
||||||
response=$(_get "$_base_url/webapi/entry.cgi?api=SYNO.API.Auth&version=$api_version&method=logout")
|
response=$(_get "$_base_url/webapi/$api_path?api=SYNO.API.Auth&version=$api_version&method=logout")
|
||||||
_debug3 response "$response"
|
_debug3 response "$response"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user