mirror of
https://github.com/unraid/webgui.git
synced 2026-01-15 06:00:14 -06:00
Merge pull request #1093 from ludoux/master
Add notification agent for Pushplus
This commit is contained in:
BIN
plugins/dynamix/icons/pushplus.png
Normal file
BIN
plugins/dynamix/icons/pushplus.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
@@ -380,6 +380,44 @@ done
|
||||
]]>
|
||||
</Script>
|
||||
</Agent>
|
||||
<Agent>
|
||||
<Name>Pushplus</Name>
|
||||
<Variables>
|
||||
<Variable Help="Get your token from [a href='https://www.pushplus.plus/push1.html' target='_blank'][u]here[/u][/a]." Desc="Push Token" Default="FILL WITH YOUR OWN">TOKEN</Variable>
|
||||
<Variable Help="Optional. Specify the group code or the 'topic' mentioned in the [a href='https://www.pushplus.plus/doc/guide/api.html' target='_blank'][u]API docs[/u][/a] used for this push. It's used to [a href='https://www.pushplus.plus/push2.html' target='_blank'][u]push to multiple people[/u][/a] instead of pushing to the owner. [b]To disable this feature, specify 'none'.[/b]" Desc="Specific Group Code" Default="none">TOPIC</Variable>
|
||||
<Variable Help="Optional. Specify the message channel used for this push. [b]The default value is 'wechat'.[/b]" Desc="Specific Channel" Default="wechat">CHANNEL</Variable>
|
||||
<Variable Help="Optional. Specify the webhook used for this push when the push channel is 'webhook' or 'cp'. [b]To disable this feature, specify 'none'.[/b]" Desc="Webhook" Default="none">WEBHOOK</Variable>
|
||||
<Variable Help="Optional. Specify the callback url used for this push and the pushplus server will send a post request to it after each push completed. [b]To disable this feature, specify 'none'.[/b]" Desc="Callback Url" Default="none">CALLBACKURL</Variable>
|
||||
<Variable Help="Specify the fields which are included in the title of the notification." Desc="Notification Title" Default="$SUBJECT">TITLE</Variable>
|
||||
<Variable Help="Specify the fields which are included in the message body of the notification." Desc="Notification Message" Default="$DESCRIPTION">MESSAGE</Variable>
|
||||
</Variables>
|
||||
<Script>
|
||||
<![CDATA[
|
||||
#!/bin/bash
|
||||
############
|
||||
{0}
|
||||
############
|
||||
#Pushplus don't allow \n in title
|
||||
TITLE=$(echo -e "$TITLE" | tr "\n" " ")
|
||||
MESSAGE=$(echo -e "$MESSAGE")
|
||||
[[ -n "${TOPIC}" && "${TOPIC}" == "none" ]] && TOPIC=""
|
||||
[[ -n "${CHANNEL}" && "${CHANNEL}" == "none" ]] && CHANNEL="wechat"
|
||||
[[ -n "${WEBHOOK}" && "${WEBHOOK}" == "none" ]] && WEBHOOK=""
|
||||
[[ -n "${CALLBACKURL}" && "${CALLBACKURL}" == "none" ]] && CALLBACKURL=""
|
||||
|
||||
curl -s -k -X POST \
|
||||
-F "token=$TOKEN" \
|
||||
-F "title=$TITLE" \
|
||||
-F "content=$MESSAGE" \
|
||||
-F "topic=$TOPIC" \
|
||||
-F "template=txt" \
|
||||
-F "channel=$CHANNEL" \
|
||||
-F "webhook=$WEBHOOK" \
|
||||
-F "callbackUrl=$CALLBACKURL" \
|
||||
"https://www.pushplus.plus/send" 2>&1
|
||||
]]>
|
||||
</Script>
|
||||
</Agent>
|
||||
<Agent>
|
||||
<Name>ServerChan</Name>
|
||||
<Variables>
|
||||
|
||||
Reference in New Issue
Block a user