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
c7ca9d7e
Commit
c7ca9d7e
authored
Jul 15, 2021
by
ciro
Browse files
fix shfmt issues
parent
98ef5151
Changes
1
Hide whitespace changes
Inline
Side-by-side
notify/pushbullet.sh
View file @
c7ca9d7e
...
@@ -6,37 +6,37 @@
...
@@ -6,37 +6,37 @@
PUSHBULLET_URI
=
"https://api.pushbullet.com/v2/pushes"
PUSHBULLET_URI
=
"https://api.pushbullet.com/v2/pushes"
pushbullet_send
()
{
pushbullet_send
()
{
_subject
=
"
$1
"
_subject
=
"
$1
"
_content
=
"
$2
"
_content
=
"
$2
"
_statusCode
=
"
$3
"
#0: success, 1: error 2($RENEW_SKIP): skipped
_statusCode
=
"
$3
"
#0: success, 1: error 2($RENEW_SKIP): skipped
_debug
"_statusCode"
"
$_statusCode
"
_debug
"_statusCode"
"
$_statusCode
"
PUSHBULLET_TOKEN
=
"
${
PUSHBULLET_TOKEN
:-
$(
_readaccountconf_mutable PUSHBULLET_TOKEN
)
}
"
PUSHBULLET_TOKEN
=
"
${
PUSHBULLET_TOKEN
:-
$(
_readaccountconf_mutable PUSHBULLET_TOKEN
)
}
"
if
[
-z
"
$PUSHBULLET_TOKEN
"
]
;
then
if
[
-z
"
$PUSHBULLET_TOKEN
"
]
;
then
PUSHBULLET_TOKEN
=
""
PUSHBULLET_TOKEN
=
""
_err
"You didn't specify a Pushbullet application token yet."
_err
"You didn't specify a Pushbullet application token yet."
return
1
return
1
fi
fi
_saveaccountconf_mutable PUSHBULLET_TOKEN
"
$PUSHBULLET_TOKEN
"
_saveaccountconf_mutable PUSHBULLET_TOKEN
"
$PUSHBULLET_TOKEN
"
PUSHBULLET_DEVICE
=
"
${
PUSHBULLET_DEVICE
:-
$(
_readaccountconf_mutable PUSHBULLET_DEVICE
)
}
"
PUSHBULLET_DEVICE
=
"
${
PUSHBULLET_DEVICE
:-
$(
_readaccountconf_mutable PUSHBULLET_DEVICE
)
}
"
if
[
-z
"
$PUSHBULLET_DEVICE
"
]
;
then
if
[
-z
"
$PUSHBULLET_DEVICE
"
]
;
then
_saveaccountconf_mutable PUSHBULLET_TOKEN
"
$PUSHBULLET_TOKEN
"
_saveaccountconf_mutable PUSHBULLET_TOKEN
"
$PUSHBULLET_TOKEN
"
fi
fi
export
_H1
=
"Content-Type: application/json"
export
_H1
=
"Content-Type: application/json"
export
_H2
=
"Access-Token:
${
PUSHBULLET_TOKEN
}
"
export
_H2
=
"Access-Token:
${
PUSHBULLET_TOKEN
}
"
_content
=
"
$(
printf
"*%s*
\n
"
"
$_content
"
| _json_encode
)
"
_content
=
"
$(
printf
"*%s*
\n
"
"
$_content
"
| _json_encode
)
"
_subject
=
"
$(
printf
"*%s*
\n
"
"
$_subject
"
| _json_encode
)
"
_subject
=
"
$(
printf
"*%s*
\n
"
"
$_subject
"
| _json_encode
)
"
_data
=
"{
\"
type
\"
:
\"
note
\"
,
\"
title
\"
:
\"
${
_subject
}
\"
,
\"
body
\"
:
\"
${
_content
}
\"
,
\"
device_iden
\"
:
\"
${
PUSHBULLET_DEVICE
}
\"
}"
_data
=
"{
\"
type
\"
:
\"
note
\"
,
\"
title
\"
:
\"
${
_subject
}
\"
,
\"
body
\"
:
\"
${
_content
}
\"
,
\"
device_iden
\"
:
\"
${
PUSHBULLET_DEVICE
}
\"
}"
response
=
"
$(
_post
"
$_data
"
"
$PUSHBULLET_URI
"
)
"
response
=
"
$(
_post
"
$_data
"
"
$PUSHBULLET_URI
"
)
"
if
[
"
$?
"
!=
"0"
]
||
_contains
"
$response
"
"
\"
error_code
\"
"
;
then
if
[
"
$?
"
!=
"0"
]
||
_contains
"
$response
"
"
\"
error_code
\"
"
;
then
_err
"PUSHBULLET send error."
_err
"PUSHBULLET send error."
_err
"
$response
"
_err
"
$response
"
return
1
return
1
fi
fi
_info
"PUSHBULLET send success."
_info
"PUSHBULLET send success."
return
0
return
0
}
}
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