From b3b4b5d3f1d04856ea602fc5b1494f041ac60dd1 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Fri, 4 Nov 2022 21:56:25 +0100 Subject: [PATCH] timezone work --- changedetectionio/__init__.py | 2 +- changedetectionio/forms.py | 19 +++++++++---------- changedetectionio/model/App.py | 15 ++++++++------- changedetectionio/templates/settings.html | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index fc29f91e..2af1a388 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -1441,7 +1441,7 @@ def ticker_thread_check_time_launch_checks(): if not watch.is_schedule_permitted: # Skip if the schedule (day of week and time) isnt permitted continue - + if not uuid in running_uuids and uuid not in [q_uuid for p,q_uuid in update_q.queue]: # Proxies can be set to have a limit on seconds between which they can be called watch_proxy = datastore.get_preferred_proxy_for_watch(uuid=uuid) diff --git a/changedetectionio/forms.py b/changedetectionio/forms.py index eb13636a..e044abfd 100644 --- a/changedetectionio/forms.py +++ b/changedetectionio/forms.py @@ -1,5 +1,5 @@ import re - +import pytz from wtforms import ( BooleanField, Field, @@ -407,7 +407,6 @@ class watchForm(commonSettingsForm): return result - # datastore.data['settings']['requests'].. class globalSettingsRequestForm(Form): time_between_check = FormField(TimeBetweenCheckForm) @@ -420,21 +419,21 @@ class globalSettingsRequestForm(Form): # datastore.data['settings']['application'].. class globalSettingsApplicationForm(commonSettingsForm): + api_access_token_enabled = BooleanField('API access token security check enabled', default=True, validators=[validators.Optional()]) base_url = StringField('Base URL', validators=[validators.Optional()]) - global_subtractive_selectors = StringListField('Remove elements', [ValidateCSSJSONXPATHInput(allow_xpath=False, allow_json=False)]) - global_ignore_text = StringListField('Ignore Text', [ValidateListRegex()]) - ignore_whitespace = BooleanField('Ignore whitespace') - removepassword_button = SubmitField('Remove password', render_kw={"class": "pure-button pure-button-primary"}) empty_pages_are_a_change = BooleanField('Treat empty pages as a change?', default=False) - render_anchor_tag_content = BooleanField('Render anchor tag content', default=False) fetch_backend = RadioField('Fetch Method', default="html_requests", choices=content_fetcher.available_fetchers(), validators=[ValidateContentFetcherIsReady()]) - api_access_token_enabled = BooleanField('API access token security check enabled', default=True, validators=[validators.Optional()]) - password = SaltyPasswordField() - filter_failure_notification_threshold_attempts = IntegerField('Number of times the filter can be missing before sending a notification', render_kw={"style": "width: 5em;"}, validators=[validators.NumberRange(min=0, message="Should contain zero or more attempts")]) + global_ignore_text = StringListField('Ignore Text', [ValidateListRegex()]) + global_subtractive_selectors = StringListField('Remove elements', [ValidateCSSJSONXPATHInput(allow_xpath=False, allow_json=False)]) + ignore_whitespace = BooleanField('Ignore whitespace') + password = SaltyPasswordField() + removepassword_button = SubmitField('Remove password', render_kw={"class": "pure-button pure-button-primary"}) + render_anchor_tag_content = BooleanField('Render anchor tag content', default=False) + timezone = SelectField('Timezone', choices=pytz.all_timezones) class globalSettingsForm(Form): diff --git a/changedetectionio/model/App.py b/changedetectionio/model/App.py index 07e5fe4e..60fe8534 100644 --- a/changedetectionio/model/App.py +++ b/changedetectionio/model/App.py @@ -23,24 +23,25 @@ class model(dict): 'proxy': None # Preferred proxy connection }, 'application': { + # Custom notification content 'api_access_token_enabled': True, - 'password': False, 'base_url' : None, - 'extract_title_as_title': False, 'empty_pages_are_a_change': False, + 'extract_title_as_title': False, 'fetch_backend': getenv("DEFAULT_FETCH_BACKEND", "html_requests"), 'filter_failure_notification_threshold_attempts': _FILTER_FAILURE_THRESHOLD_ATTEMPTS_DEFAULT, 'global_ignore_text': [], # List of text to ignore when calculating the comparison checksum 'global_subtractive_selectors': [], 'ignore_whitespace': True, - 'render_anchor_tag_content': False, - 'notification_urls': [], # Apprise URL list - # Custom notification content - 'notification_title': default_notification_title, 'notification_body': default_notification_body, 'notification_format': default_notification_format, + 'notification_title': default_notification_title, + 'notification_urls': [], # Apprise URL list + 'password': False, + 'render_anchor_tag_content': False, 'schema_version' : 0, - 'webdriver_delay': None # Extra delay in seconds before extracting text + 'timezone': None, + 'webdriver_delay': None, # Extra delay in seconds before extracting text } } } diff --git a/changedetectionio/templates/settings.html b/changedetectionio/templates/settings.html index 69764b7d..f671c6ac 100644 --- a/changedetectionio/templates/settings.html +++ b/changedetectionio/templates/settings.html @@ -174,8 +174,8 @@ nav
+ {{ render_field(form.application.form.timezone) }} Current Date / Time and timezone is
- Select your timezone name