Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
143eac09
Commit
143eac09
authored
Aug 05, 2019
by
neilpang
Browse files
fix notify message
parent
d74dfb1f
Changes
4
Hide whitespace changes
Inline
Side-by-side
acme.sh
View file @
143eac09
...
@@ -5932,7 +5932,8 @@ _send_notify() {
...
@@ -5932,7 +5932,8 @@ _send_notify() {
_send_err=0
_send_err=0
for _n_hook in $(echo "$_nhooks" | tr ',' " "); do
for _n_hook in $(echo "$_nhooks" | tr ',' " "); do
_n_hook_file="$(_findHook "" $_SUB_FOLDER_NOTIFY "$_n_hook")"
_n_hook_file="$(_findHook "" $_SUB_FOLDER_NOTIFY "$_n_hook")"
_info "Found $_n_hook_file for $_n_hook"
_info "Sending via: $_n_hook"
_debug "Found $_n_hook_file for $_n_hook"
if [ -z "$_n_hook_file" ]; then
if [ -z "$_n_hook_file" ]; then
_err "Can not find the hook file for $_n_hook"
_err "Can not find the hook file for $_n_hook"
continue
continue
...
@@ -5971,7 +5972,7 @@ _set_notify_hook() {
...
@@ -5971,7 +5972,7 @@ _set_notify_hook() {
_nhooks="$1"
_nhooks="$1"
_test_subject="Hello, this is notification from $PROJECT_NAME"
_test_subject="Hello, this is notification from $PROJECT_NAME"
_test_content="If you receive this
email
, your notification works."
_test_content="If you receive this
message
, your notification works."
_send_notify "$_test_subject" "$_test_content" "$_nhooks" 0
_send_notify "$_test_subject" "$_test_content" "$_nhooks" 0
...
...
notify/ifttt.sh
View file @
143eac09
...
@@ -73,13 +73,13 @@ ifttt_send() {
...
@@ -73,13 +73,13 @@ ifttt_send() {
_subject
=
$(
echo
"
$_subject
"
| _json_encode
)
_subject
=
$(
echo
"
$_subject
"
| _json_encode
)
_data
=
"{
\"
$IFTTT_SUBJECT_KEY
\"
:
\"
$_subject
\"
,
\"
$IFTTT_CONTENT_KEY
\"
:
\"
$_content
\"
}"
_data
=
"{
\"
$IFTTT_SUBJECT_KEY
\"
:
\"
$_subject
\"
,
\"
$IFTTT_CONTENT_KEY
\"
:
\"
$_content
\"
}"
response
=
""
#just make shellcheck happy
response
=
"
$(
_post
"
$_data
"
"
$IFTTT_API_URL
"
""
"POST"
"application/json"
)
"
if
_post
"
$_data
"
"
$IFTTT_API_URL
"
""
"POST"
"application/json"
;
then
if
_contains
"
$response
"
"Congratulations"
;
then
if
[
"
$?
"
=
"0"
]
&&
_contains
"
$response
"
"Congratulations"
;
then
_info
"IFTTT webhooks event fired success."
_info
"IFTTT webhooks event fired success."
return
0
return
0
fi
fi
fi
_err
"IFTTT webhooks event fired error."
_err
"IFTTT webhooks event fired error."
_err
"
$response
"
_err
"
$response
"
return
1
return
1
...
...
notify/pushover.sh
View file @
143eac09
...
@@ -50,13 +50,13 @@ pushover_send() {
...
@@ -50,13 +50,13 @@ pushover_send() {
_subject
=
"
$(
printf
"*%s*
\n
"
"
$_subject
"
| _json_encode
)
"
_subject
=
"
$(
printf
"*%s*
\n
"
"
$_subject
"
| _json_encode
)
"
_data
=
"{
\"
token
\"
:
\"
$PUSHOVER_TOKEN
\"
,
\"
user
\"
:
\"
$PUSHOVER_USER
\"
,
\"
title
\"
:
\"
$_subject
\"
,
\"
message
\"
:
\"
$_content
\"
,
\"
sound
\"
:
\"
$PUSHOVER_SOUND
\"
,
\"
device
\"
:
\"
$PUSHOVER_DEVICE
\"
,
\"
priority
\"
:
\"
$PUSHOVER_PRIORITY
\"
}"
_data
=
"{
\"
token
\"
:
\"
$PUSHOVER_TOKEN
\"
,
\"
user
\"
:
\"
$PUSHOVER_USER
\"
,
\"
title
\"
:
\"
$_subject
\"
,
\"
message
\"
:
\"
$_content
\"
,
\"
sound
\"
:
\"
$PUSHOVER_SOUND
\"
,
\"
device
\"
:
\"
$PUSHOVER_DEVICE
\"
,
\"
priority
\"
:
\"
$PUSHOVER_PRIORITY
\"
}"
response
=
""
#just make shellcheck happy
response
=
"
$(
_post
"
$_data
"
"
$PUSHOVER_URI
"
)
"
if
_post
"
$_data
"
"
$PUSHOVER_URI
"
;
then
if
_contains
"
$response
"
"{
\"
status
\"
:1"
;
then
if
[
"
$?
"
=
"0"
]
&&
_contains
"
$response
"
"{
\"
status
\"
:1"
;
then
_info
"PUSHOVER send success."
_info
"PUSHOVER send success."
return
0
return
0
fi
fi
fi
_err
"PUSHOVER send error."
_err
"PUSHOVER send error."
_err
"
$response
"
_err
"
$response
"
return
1
return
1
...
...
notify/sendgrid.sh
View file @
143eac09
...
@@ -42,13 +42,13 @@ sendgrid_send() {
...
@@ -42,13 +42,13 @@ sendgrid_send() {
_content
=
"
$(
echo
"
$_content
"
| _json_encode
)
"
_content
=
"
$(
echo
"
$_content
"
| _json_encode
)
"
_data
=
"{
\"
personalizations
\"
: [{
\"
to
\"
: [{
\"
email
\"
:
\"
$SENDGRID_TO
\"
}]}],
\"
from
\"
: {
\"
email
\"
:
\"
$SENDGRID_FROM
\"
},
\"
subject
\"
:
\"
$_subject
\"
,
\"
content
\"
: [{
\"
type
\"
:
\"
text/plain
\"
,
\"
value
\"
:
\"
$_content
\"
}]}"
_data
=
"{
\"
personalizations
\"
: [{
\"
to
\"
: [{
\"
email
\"
:
\"
$SENDGRID_TO
\"
}]}],
\"
from
\"
: {
\"
email
\"
:
\"
$SENDGRID_FROM
\"
},
\"
subject
\"
:
\"
$_subject
\"
,
\"
content
\"
: [{
\"
type
\"
:
\"
text/plain
\"
,
\"
value
\"
:
\"
$_content
\"
}]}"
response
=
""
#just make shellcheck happy
response
=
"
$(
_post
"
$_data
"
"https://api.sendgrid.com/v3/mail/send"
)
"
if
_post
"
$_data
"
"https://api.sendgrid.com/v3/mail/send"
;
then
if
[
-z
"
$response
"
]
;
then
if
[
"
$?
"
=
"0"
]
&&
[
-z
"
$response
"
]
;
then
_info
"sendgrid send sccess."
_info
"sendgrid send sccess."
return
0
return
0
fi
fi
fi
_err
"sendgrid send error."
_err
"sendgrid send error."
_err
"
$response
"
_err
"
$response
"
return
1
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