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
9bb58e47
Unverified
Commit
9bb58e47
authored
Sep 02, 2023
by
neil
Committed by
GitHub
Sep 02, 2023
Browse files
Merge pull request #4728 from Eagle3386/dev-1
Fix Auth API access for DSM 6
parents
f4ff2d5d
b793dbf9
Changes
1
Show whitespace changes
Inline
Side-by-side
deploy/synology_dsm.sh
View file @
9bb58e47
...
@@ -91,8 +91,10 @@ synology_dsm_deploy() {
...
@@ -91,8 +91,10 @@ synology_dsm_deploy() {
_debug
"Getting API version"
_debug
"Getting API version"
response
=
$(
_get
"
$_base_url
/webapi/query.cgi?api=SYNO.API.Info&version=1&method=query&query=SYNO.API.Auth"
)
response
=
$(
_get
"
$_base_url
/webapi/query.cgi?api=SYNO.API.Info&version=1&method=query&query=SYNO.API.Auth"
)
api_path
=
$(
echo
"
$response
"
|
grep
"SYNO.API.Auth"
|
sed
-n
's/.*"path" *: *"\([0-9]*\)".*/\1/p'
)
api_version
=
$(
echo
"
$response
"
|
grep
"SYNO.API.Auth"
|
sed
-n
's/.*"maxVersion" *: *\([0-9]*\).*/\1/p'
)
api_version
=
$(
echo
"
$response
"
|
grep
"SYNO.API.Auth"
|
sed
-n
's/.*"maxVersion" *: *\([0-9]*\).*/\1/p'
)
_debug3 response
"
$response
"
_debug3 response
"
$response
"
_debug3 api_path
"
$api_path
"
_debug3 api_version
"
$api_version
"
_debug3 api_version
"
$api_version
"
# Login, get the session ID & SynoToken from JSON
# Login, get the session ID & SynoToken from JSON
...
@@ -133,12 +135,15 @@ synology_dsm_deploy() {
...
@@ -133,12 +135,15 @@ synology_dsm_deploy() {
[
-n
"
${
SYNO_Device_Name
}
"
]
||
SYNO_Device_Name
=
"CertRenewal"
[
-n
"
${
SYNO_Device_Name
}
"
]
||
SYNO_Device_Name
=
"CertRenewal"
fi
fi
response
=
$(
_get
"
$_base_url
/webapi/entry.cgi?api=SYNO.API.Auth&version=
$api_version
&method=login&format=sid&account=
$encoded_username
&passwd=
$encoded_password
&otp_code=
$otp_code
&enable_syno_token=yes&enable_device_token=yes&device_name=
$SYNO_Device_Name
"
)
response
=
$(
_get
"
$_base_url
/webapi/
$api_path
?api=SYNO.API.Auth&version=
$api_version
&method=login&format=sid&account=
$encoded_username
&passwd=
$encoded_password
&otp_code=
$otp_code
&enable_syno_token=yes&enable_device_token=yes&device_name=
$SYNO_Device_Name
"
)
_debug3 response
"
$response
"
_secure_debug3 response
"
$response
"
SYNO_Device_ID
=
$(
echo
"
$response
"
|
grep
"device_id"
|
sed
-n
's/.*"device_id" *: *"\([^"]*\).*/\1/p'
)
id_property
=
'device_id'
[
"
${
api_version
}
"
-gt
'6'
]
||
id_property
=
'did'
SYNO_Device_ID
=
$(
echo
"
$response
"
|
grep
"
$id_property
"
|
sed
-n
's/.*"'
$id_property
'" *: *"\([^"]*\).*/\1/p'
)
_secure_debug2 SYNO_Device_ID
"
$SYNO_Device_ID
"
_secure_debug2 SYNO_Device_ID
"
$SYNO_Device_ID
"
else
else
response
=
$(
_get
"
$_base_url
/webapi/
entry.cgi
?api=SYNO.API.Auth&version=
$api_version
&method=login&format=sid&account=
$encoded_username
&passwd=
$encoded_password
&enable_syno_token=yes&device_name=
$SYNO_Device_Name
&device_id=
$SYNO_Device_ID
"
)
response
=
$(
_get
"
$_base_url
/webapi/
$api_path
?api=SYNO.API.Auth&version=
$api_version
&method=login&format=sid&account=
$encoded_username
&passwd=
$encoded_password
&enable_syno_token=yes&device_name=
$SYNO_Device_Name
&device_id=
$SYNO_Device_ID
"
)
_debug3 response
"
$response
"
_debug3 response
"
$response
"
fi
fi
...
...
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