From d11c58108902789972d07359d4eb02e6129d4bf7 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Mon, 22 May 2023 15:45:38 +0200 Subject: [PATCH] Add alert if extra headers file found --- changedetectionio/__init__.py | 1 + changedetectionio/model/Watch.py | 1 + changedetectionio/store.py | 1 + changedetectionio/templates/edit.html | 5 +++++ 4 files changed, 8 insertions(+) diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index d07a52ed..67d2f0be 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -700,6 +700,7 @@ def changedetection_app(config=None, datastore_o=None): form=form, has_default_notification_urls=True if len(datastore.data['settings']['application']['notification_urls']) else False, has_empty_checktime=using_default_check_time, + has_extra_headers_file=watch.has_extra_headers_file or datastore.has_extra_headers_file, is_html_webdriver=is_html_webdriver, jq_support=jq_support, playwright_enabled=os.getenv('PLAYWRIGHT_DRIVER_URL', False), diff --git a/changedetectionio/model/Watch.py b/changedetectionio/model/Watch.py index 923ef6d1..2e6d6f43 100644 --- a/changedetectionio/model/Watch.py +++ b/changedetectionio/model/Watch.py @@ -473,6 +473,7 @@ class model(dict): # None is set return False + @property def has_extra_headers_file(self): if os.path.isfile(os.path.join(self.watch_data_dir, 'headers.txt')): return True diff --git a/changedetectionio/store.py b/changedetectionio/store.py index c5cedbf7..5e071ce5 100644 --- a/changedetectionio/store.py +++ b/changedetectionio/store.py @@ -505,6 +505,7 @@ class ChangeDetectionStore: return None + @property def has_extra_headers_file(self): filepath = os.path.join(self.datastore_path, 'headers.txt') return os.path.isfile(filepath) diff --git a/changedetectionio/templates/edit.html b/changedetectionio/templates/edit.html index 805c79c7..63b96455 100644 --- a/changedetectionio/templates/edit.html +++ b/changedetectionio/templates/edit.html @@ -152,6 +152,11 @@ {{ render_field(form.headers, rows=5, placeholder="Example Cookie: foobar User-Agent: wonderbra 1.0") }} + {% if has_extra_headers_file %} +
+ Alert! Extra headers file found and will be added to this watch! +
+ {% endif %}
{{ render_field(form.body, rows=5, placeholder="Example