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
5698bec6
Commit
5698bec6
authored
Nov 02, 2019
by
neilpang
Browse files
fix
https://github.com/Neilpang/acme.sh/issues/2566
parent
3ec49522
Changes
2
Hide whitespace changes
Inline
Side-by-side
acme.sh
View file @
5698bec6
...
...
@@ -6070,7 +6070,7 @@ _send_notify() {
_set_notify_hook
()
{
_nhooks
=
"
$1
"
_test_subject
=
"Hello, this is notification from
$PROJECT_NAME
"
_test_subject
=
"Hello, this is
a
notification from
$PROJECT_NAME
"
_test_content
=
"If you receive this message, your notification works."
_send_notify
"
$_test_subject
"
"
$_test_content
"
"
$_nhooks
"
0
...
...
notify/dingtalk.sh
0 → 100644
View file @
5698bec6
#!/usr/bin/env sh
#Support dingtalk webhooks api
#DINGTALK_WEBHOOK="xxxx"
#optional
#DINGTALK_KEYWORD="yyyy"
#DINGTALK_SIGNING_KEY="SEC08ffdbd403cbc3fc8a65xxxxxxxxxxxxxxxxxxxx"
# subject content statusCode
dingtalk_send
()
{
_subject
=
"
$1
"
_content
=
"
$2
"
_statusCode
=
"
$3
"
#0: success, 1: error 2($RENEW_SKIP): skipped
_debug
"_subject"
"
$_subject
"
_debug
"_content"
"
$_content
"
_debug
"_statusCode"
"
$_statusCode
"
DINGTALK_WEBHOOK
=
"
${
DINGTALK_WEBHOOK
:-
$(
_readaccountconf_mutable DINGTALK_WEBHOOK
)
}
"
if
[
-z
"
$DINGTALK_WEBHOOK
"
]
;
then
DINGTALK_WEBHOOK
=
""
_err
"You didn't specify a dingtalk webhooks DINGTALK_WEBHOOK yet."
_err
"You can get yours from https://dingtalk.com"
return
1
fi
_saveaccountconf_mutable DINGTALK_WEBHOOK
"
$DINGTALK_WEBHOOK
"
DINGTALK_KEYWORD
=
"
${
DINGTALK_KEYWORD
:-
$(
_readaccountconf_mutable DINGTALK_KEYWORD
)
}
"
if
[
"
$DINGTALK_KEYWORD
"
]
;
then
_saveaccountconf_mutable DINGTALK_KEYWORD
"
$DINGTALK_KEYWORD
"
fi
# DINGTALK_SIGNING_KEY="${DINGTALK_SIGNING_KEY:-$(_readaccountconf_mutable DINGTALK_SIGNING_KEY)}"
# if [ -z "$DINGTALK_SIGNING_KEY" ]; then
# DINGTALK_SIGNING_KEY="value1"
# _info "The DINGTALK_SIGNING_KEY is not set, so use the default value1 as key."
# elif ! _hasfield "$_IFTTT_AVAIL_MSG_KEYS" "$DINGTALK_SIGNING_KEY"; then
# _err "The DINGTALK_SIGNING_KEY \"$DINGTALK_SIGNING_KEY\" is not available, should be one of $_IFTTT_AVAIL_MSG_KEYS"
# DINGTALK_SIGNING_KEY=""
# return 1
# else
# _saveaccountconf_mutable DINGTALK_SIGNING_KEY "$DINGTALK_SIGNING_KEY"
# fi
# if [ "$DINGTALK_SIGNING_KEY" = "$IFTTT_CONTENT_KEY" ]; then
# DINGTALK_SIGNING_KEY=""
# IFTTT_CONTENT_KEY=""
# _err "The DINGTALK_SIGNING_KEY must not be same as IFTTT_CONTENT_KEY."
# return 1
# fi
_content
=
$(
echo
"
$_content
"
| _json_encode
)
_subject
=
$(
echo
"
$_subject
"
| _json_encode
)
_data
=
"{
\"
msgtype
\"
:
\"
text
\"
,
\"
text
\"
: {
\"
content
\"
:
\"
[
$DINGTALK_KEYWORD
]
\n
$_subject
\n
$_content
\"
}}"
response
=
"
$(
_post
"
$_data
"
"
$DINGTALK_WEBHOOK
"
""
"POST"
"application/json"
)
"
if
[
"
$?
"
=
"0"
]
&&
_contains
"
$response
"
"errmsg
\"
:
\"
ok"
;
then
_info
"dingtalk webhooks event fired success."
return
0
fi
_err
"dingtalk webhooks event fired error."
_err
"
$response
"
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