From 3b14be4fef278958e5e053643bbb7f65f6d55bb5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Sep 2021 16:17:45 +0200 Subject: [PATCH 1/2] Bump tar from 6.1.6 to 6.1.9 in /changedetectionio/static/styles (#209) Bumps [tar](https://github.com/npm/node-tar) from 6.1.6 to 6.1.9. - [Release notes](https://github.com/npm/node-tar/releases) - [Changelog](https://github.com/npm/node-tar/blob/main/CHANGELOG.md) - [Commits](https://github.com/npm/node-tar/compare/v6.1.6...v6.1.9) --- updated-dependencies: - dependency-name: tar dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- changedetectionio/static/styles/package-lock.json | 14 +++++++------- changedetectionio/static/styles/package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/changedetectionio/static/styles/package-lock.json b/changedetectionio/static/styles/package-lock.json index eb20cf9c..44af44fd 100644 --- a/changedetectionio/static/styles/package-lock.json +++ b/changedetectionio/static/styles/package-lock.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": { "node-sass": "^6.0.1", - "tar": "^6.1.6", + "tar": "^6.1.9", "trim-newlines": "^3.0.1" } }, @@ -1624,9 +1624,9 @@ } }, "node_modules/tar": { - "version": "6.1.6", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.6.tgz", - "integrity": "sha512-oaWyu5dQbHaYcyZCTfyPpC+VmI62/OM2RTUYavTk1MDr1cwW5Boi3baeYQKiZbY2uSQJGr+iMOzb/JFxLrft+g==", + "version": "6.1.9", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.9.tgz", + "integrity": "sha512-XjLaMNl76o07zqZC/aW4lwegdY07baOH1T8w3AEfrHAdyg/oYO4ctjzEBq9Gy9fEP9oHqLIgvx6zuGDGe+bc8Q==", "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", @@ -3218,9 +3218,9 @@ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=" }, "tar": { - "version": "6.1.6", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.6.tgz", - "integrity": "sha512-oaWyu5dQbHaYcyZCTfyPpC+VmI62/OM2RTUYavTk1MDr1cwW5Boi3baeYQKiZbY2uSQJGr+iMOzb/JFxLrft+g==", + "version": "6.1.9", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.9.tgz", + "integrity": "sha512-XjLaMNl76o07zqZC/aW4lwegdY07baOH1T8w3AEfrHAdyg/oYO4ctjzEBq9Gy9fEP9oHqLIgvx6zuGDGe+bc8Q==", "requires": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", diff --git a/changedetectionio/static/styles/package.json b/changedetectionio/static/styles/package.json index ca17305c..b801f7e7 100644 --- a/changedetectionio/static/styles/package.json +++ b/changedetectionio/static/styles/package.json @@ -11,7 +11,7 @@ "license": "ISC", "dependencies": { "node-sass": "^6.0.1", - "tar": "^6.1.6", + "tar": "^6.1.9", "trim-newlines": "^3.0.1" } } From bd0d9048e7a1f71c3bf30e1036ffd9037076ef0d Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Fri, 17 Sep 2021 15:58:04 +0200 Subject: [PATCH 2/2] Re #42 - Notifications refactor token replacement fix possible missing value for watch_title --- changedetectionio/notification.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/changedetectionio/notification.py b/changedetectionio/notification.py index 3106f80d..bd75359e 100644 --- a/changedetectionio/notification.py +++ b/changedetectionio/notification.py @@ -14,7 +14,11 @@ valid_tokens = { def process_notification(n_object, datastore): - apobj = apprise.Apprise() + import logging + log = logging.getLogger('apprise') + log.setLevel('TRACE') + apobj = apprise.Apprise(debug=True) + for url in n_object['notification_urls']: print (">> Process Notification: AppRise notifying {}".format(url.strip())) apobj.add(url.strip()) @@ -26,18 +30,17 @@ def process_notification(n_object, datastore): # Insert variables into the notification content notification_parameters = create_notification_parameters(n_object, datastore) - raw_notification_text = [n_body, n_title] - parameterised_notification_text = dict( - [ - (i, n.replace(n, n.format(**notification_parameters))) - for i, n in zip(['body', 'title'], raw_notification_text) - ] - ) + for n_k in notification_parameters: + token = '{' + n_k + '}' + val = notification_parameters[n_k] + n_title = n_title.replace(token, val) + n_body = n_body.replace(token, val) + apobj.notify( - body=parameterised_notification_text["body"], - title=parameterised_notification_text["title"] + body=n_body, + title=n_title ) @@ -73,11 +76,11 @@ def create_notification_parameters(n_object, datastore): # Valid_tokens also used as a field validator tokens.update( { - 'base_url': base_url, + 'base_url': base_url if base_url is not None else '', 'watch_url': watch_url, 'watch_uuid': uuid, - 'watch_title': watch_title, - 'watch_tag': watch_tag, + 'watch_title': watch_title if watch_title is not None else '', + 'watch_tag': watch_tag if watch_tag is not None else '', 'diff_url': diff_url, 'preview_url': preview_url, 'current_snapshot': n_object['current_snapshot'] if 'current_snapshot' in n_object else ''