From 51acfbdbda463633f286906c672beaff506741b9 Mon Sep 17 00:00:00 2001 From: ntmmfts Date: Sat, 8 Jan 2022 00:29:37 -1000 Subject: [PATCH] before v0.39.6 --- changedetectionio/__init__.py | 5 +- changedetectionio/forms.py | 4 +- changedetectionio/static/js/tabs.js | 66 +++++++++++++-------------- changedetectionio/store.py | 3 +- changedetectionio/templates/edit.html | 11 +++-- 5 files changed, 48 insertions(+), 41 deletions(-) diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index 5dc59761..1c662160 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -456,7 +456,8 @@ def changedetection_app(config=None, datastore_o=None): update_obj = {'url': form.url.data.strip(), 'minutes_between_check': form.minutes_between_check.data, - 'use_seconds': form.use_seconds.data, + 'seconds_between_check': form.seconds_between_check.data, + 'minutes_or_seconds': form.minutes_or_seconds.data, 'tag': form.tag.data.strip(), 'title': form.title.data.strip(), 'headers': form.headers.data, @@ -974,7 +975,7 @@ def ticker_thread_check_time_launch_checks(): # If they supplied an individual entry minutes to threshold. if 'minutes_between_check' in watch and watch['minutes_between_check'] is not None: # Cast to int just incase #160, kluge for checks in seconds - max_time = int(watch['minutes_between_check']) * (1 if watch['use_seconds'] else 60) + max_time = int(watch['minutes_between_check']) * 60 #(1 if watch['use_seconds'] else 60) else: # Default system wide. max_time = int(copied_datastore.data['settings']['requests']['minutes_between_check']) * 60 diff --git a/changedetectionio/forms.py b/changedetectionio/forms.py index 74f9a3c8..b87d1fee 100644 --- a/changedetectionio/forms.py +++ b/changedetectionio/forms.py @@ -229,7 +229,9 @@ class watchForm(commonSettingsForm): minutes_between_check = html5.IntegerField('Maximum time in minutes until recheck', [validators.Optional(), validators.NumberRange(min=1)]) - use_seconds = BooleanField('Use seconds') + seconds_between_check = html5.IntegerField('Maximum time in seconds until recheck', + [validators.Optional(), validators.NumberRange(min=1,max=59)]) + minutes_or_seconds = RadioField('Minutes or Seconds', choices=[('minutes','Minutes'),('seconds','Seconds')]) css_filter = StringField('CSS/JSON Filter', [ValidateCSSJSONInput()]) title = StringField('Title') diff --git a/changedetectionio/static/js/tabs.js b/changedetectionio/static/js/tabs.js index a4b3c2fb..98fbd790 100644 --- a/changedetectionio/static/js/tabs.js +++ b/changedetectionio/static/js/tabs.js @@ -50,37 +50,37 @@ function focus_error_tab() { } function use_seconds_change() { - var isChecked = document.querySelectorAll('input[id="use_seconds"]:checked').length - var labelIntegerField = document.querySelector("label[for=minutes_between_check]"); - var msgDefault = document.getElementById("minutes-message-default"); - var msgNonDefault = document.getElementById("minutes-message-non-default"); - var msgWarning = document.getElementById("seconds-warning"); - if (isChecked) { - labelIntegerField.innerHTML = "Maximum time in seconds until recheck"; - try { - msgDefault.style.display = "none"; - } catch(error) { - // continue, won't be present if not default interval - } - try { - msgNonDefault.style.display = "none"; - } catch(error) { - // continue, won't be present if not default interval - } - msgWarning.style.display = ""; - } - else { - labelIntegerField.innerHTML = "Maximum time in minutes until recheck"; - try { - msgDefault.style.display = ""; - } catch(error) { - // continue, won't be present if not default interval - } - try { - msgNonDefault.style.display = ""; - } catch(error) { - // continue, won't be present if not default interval - } - msgWarning.style.display = "none"; - } + // var isChecked = document.querySelectorAll('input[id="use_seconds"]:checked').length + // var labelIntegerField = document.querySelector("label[for=minutes_between_check]"); + // var msgDefault = document.getElementById("minutes-message-default"); + // var msgNonDefault = document.getElementById("minutes-message-non-default"); + // var msgWarning = document.getElementById("seconds-warning"); + // if (isChecked) { + // labelIntegerField.innerHTML = "Maximum time in seconds until recheck"; + // try { + // msgDefault.style.display = "none"; + // } catch(error) { + //continue, won't be present if not default interval + // } + // try { + // msgNonDefault.style.display = "none"; + // } catch(error) { + //continue, won't be present if not default interval + // } + // msgWarning.style.display = ""; + // } + // else { + // labelIntegerField.innerHTML = "Maximum time in minutes until recheck"; + // try { + // msgDefault.style.display = ""; + // } catch(error) { + //continue, won't be present if not default interval + // } + // try { + // msgNonDefault.style.display = ""; + // } catch(error) { + //continue, won't be present if not default interval + // } + // msgWarning.style.display = "none"; + // } } \ No newline at end of file diff --git a/changedetectionio/store.py b/changedetectionio/store.py index da95ba03..0a66f12c 100644 --- a/changedetectionio/store.py +++ b/changedetectionio/store.py @@ -68,7 +68,8 @@ class ChangeDetectionStore: # Requires setting to None on submit if it's the same as the default 'minutes_between_check': None, # #160 - 'use_seconds': False, + 'seconds_between_check': None, + 'minutes_or_seconds': 'minutes', 'previous_md5': "", 'uuid': str(uuid_builder.uuid4()), 'headers': {}, # Extra headers to send diff --git a/changedetectionio/templates/edit.html b/changedetectionio/templates/edit.html index 92f0f981..3fab07e1 100644 --- a/changedetectionio/templates/edit.html +++ b/changedetectionio/templates/edit.html @@ -32,7 +32,10 @@ Organisational tag/group name used in the main listing page
- {{ render_field(form.minutes_between_check) }} + + {{ render_field(form.minutes_between_check) }} + {{ render_field(form.minutes_or_seconds, onchange="minutes_or_seconds_change()") }} + {% if using_default_minutes %} Currently using the default global settings, change to another value if you want to be specific. @@ -42,10 +45,10 @@ {% endif %}
- {{ render_field(form.use_seconds, onchange="use_seconds_change()") }} - Warning: Setting the recheck duration too short can overload the queue and lead to + +