Add alert if extra headers file found

1448-basic-headers-fetch-from-file
dgtlmoon 1 year ago
parent 5e5fe6dc05
commit d11c581089

@ -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),

@ -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

@ -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)

@ -152,6 +152,11 @@
{{ render_field(form.headers, rows=5, placeholder="Example
Cookie: foobar
User-Agent: wonderbra 1.0") }}
{% if has_extra_headers_file %}
<div class="pure-form-message-inline">
<strong>Alert! Extra headers file found and will be added to this watch!</strong>
</div>
{% endif %}
</div>
<div class="pure-control-group" id="request-body">
{{ render_field(form.body, rows=5, placeholder="Example

Loading…
Cancel
Save