Enable Markdown and HTML notifications. (#288)
This change enable defining the notification body as HTML or Markdown. This can be very
useful to have more user-friendly notifications such as:
* applying a heading style to the `{watch_title}` to make it stand out
* creating clickable links using the `{watch_url}`, `{preview_url}` and `{diff_url}`.
Changes
=======
* Add a `notification_format` to the notification settings, defaults to plain text.
* Use the `body_format` parameter of Apprise's `notify` method.
Co-authored-by: Malo Jaffré <malo.jaffre@dunnhumby.com>
This commit is contained in:
@@ -415,6 +415,7 @@ def changedetection_app(config=None, datastore_o=None):
|
||||
'trigger_text': form.trigger_text.data,
|
||||
'notification_title': form.notification_title.data,
|
||||
'notification_body': form.notification_body.data,
|
||||
'notification_format': form.notification_format.data,
|
||||
'extract_title_as_title': form.extract_title_as_title.data
|
||||
|
||||
}
|
||||
@@ -454,7 +455,8 @@ def changedetection_app(config=None, datastore_o=None):
|
||||
n_object = {'watch_url': form.url.data.strip(),
|
||||
'notification_urls': form.notification_urls.data,
|
||||
'notification_title': form.notification_title.data,
|
||||
'notification_body' : form.notification_body.data
|
||||
'notification_body' : form.notification_body.data,
|
||||
'notification_format' : form.notification_format.data,
|
||||
}
|
||||
notification_q.put(n_object)
|
||||
|
||||
@@ -501,6 +503,7 @@ def changedetection_app(config=None, datastore_o=None):
|
||||
form.fetch_backend.data = datastore.data['settings']['application']['fetch_backend']
|
||||
form.notification_title.data = datastore.data['settings']['application']['notification_title']
|
||||
form.notification_body.data = datastore.data['settings']['application']['notification_body']
|
||||
form.notification_format.data = datastore.data['settings']['application']['notification_format']
|
||||
form.base_url.data = datastore.data['settings']['application']['base_url']
|
||||
|
||||
# Password unset is a GET
|
||||
@@ -519,6 +522,7 @@ def changedetection_app(config=None, datastore_o=None):
|
||||
datastore.data['settings']['application']['fetch_backend'] = form.fetch_backend.data
|
||||
datastore.data['settings']['application']['notification_title'] = form.notification_title.data
|
||||
datastore.data['settings']['application']['notification_body'] = form.notification_body.data
|
||||
datastore.data['settings']['application']['notification_format'] = form.notification_format.data
|
||||
datastore.data['settings']['application']['notification_urls'] = form.notification_urls.data
|
||||
datastore.data['settings']['application']['base_url'] = form.base_url.data
|
||||
|
||||
@@ -526,7 +530,8 @@ def changedetection_app(config=None, datastore_o=None):
|
||||
n_object = {'watch_url': "Test from changedetection.io!",
|
||||
'notification_urls': form.notification_urls.data,
|
||||
'notification_title': form.notification_title.data,
|
||||
'notification_body': form.notification_body.data
|
||||
'notification_body': form.notification_body.data,
|
||||
'notification_format': form.notification_format.data,
|
||||
}
|
||||
notification_q.put(n_object)
|
||||
flash('Notifications queued.')
|
||||
|
||||
Reference in New Issue
Block a user