pushbits / server

A simple server for push notifications via Matrix (and a minimalistic alternative to Pushover and Gotify) 🚀📯
https://www.pushbits.io
ISC License
305 stars 18 forks source link

Add support for HTML and Markdown + option for colored title #26

Closed CubicrootXYZ closed 3 years ago

CubicrootXYZ commented 3 years ago

Changes:

Testing:

  1. Markdown syntax:
 curl --header "Content-Type: application/json" --request POST --data '{"message":"This does now **support** _Markdown_\n\n Great, isnt it?","title":"my title","extras": {"client::display": {"contentType": "text/markdown"}}}' "yourdomain.tld/message?token=XXXXXXX"

For testing HTML simply switch contentType to text/html. Be aware that not all clients support all HTML tags, not even the recommend one's from the Matrix specs.

  1. Colored title

Add this to your config.yml:

message:
  coloredtitle: true

and send a message with priority:

 curl --header "Content-Type: application/json" --request POST --data '{"message":"This does now **support** _Markdown_\n\n Great, isnt it?","title":"my title","extras": {"client::display": {"contentType": "text/markdown"}},"priority": 1}' "yourdomain.tld/message?token=XXXXXXX"
CubicrootXYZ commented 3 years ago

One thing I am not very happy with: I had to default the Priority to 8 as I choose to use syslog priorities for coloring and there the priority 0 is defined as emergency, which sadly also is the golang default value for int.