Compare commits

...

3 Commits

Author SHA1 Message Date
dgtlmoon
5382ba3b73 tweak 2023-01-19 20:56:06 +01:00
dgtlmoon
7b5729a4da better name 2023-01-19 20:54:37 +01:00
dgtlmoon
7fbf4fe13b Ability for watch to use a more obvious system default 2023-01-19 20:52:34 +01:00
3 changed files with 10 additions and 10 deletions

View File

@@ -571,6 +571,8 @@ def changedetection_app(config=None, datastore_o=None):
data=default, data=default,
) )
form.fetch_backend.choices.append(("system", 'System settings default'))
# form.browser_steps[0] can be assumed that we 'goto url' first # form.browser_steps[0] can be assumed that we 'goto url' first
if datastore.proxy_list is None: if datastore.proxy_list is None:
@@ -599,10 +601,6 @@ def changedetection_app(config=None, datastore_o=None):
using_default_check_time = False using_default_check_time = False
break break
# Use the default if it's the same as system-wide.
if form.fetch_backend.data == datastore.data['settings']['application']['fetch_backend']:
extra_update_obj['fetch_backend'] = None
# Ignore text # Ignore text
@@ -652,8 +650,10 @@ def changedetection_app(config=None, datastore_o=None):
watch = datastore.data['watching'].get(uuid) watch = datastore.data['watching'].get(uuid)
system_uses_webdriver = datastore.data['settings']['application']['fetch_backend'] == 'html_webdriver' system_uses_webdriver = datastore.data['settings']['application']['fetch_backend'] == 'html_webdriver'
is_html_webdriver = True if watch.get('fetch_backend') == 'html_webdriver' or (
watch.get('fetch_backend', None) is None and system_uses_webdriver) else False is_html_webdriver = False
if (watch.get('fetch_backend') == 'system' and system_uses_webdriver) or watch.get('fetch_backend') == 'html_requests':
is_html_webdriver = True
output = render_template("edit.html", output = render_template("edit.html",
browser_steps_config=browser_step_ui_config, browser_steps_config=browser_step_ui_config,

View File

@@ -92,9 +92,8 @@ class perform_site_check():
# Pluggable content fetcher # Pluggable content fetcher
prefer_backend = watch.get_fetch_backend prefer_backend = watch.get_fetch_backend
# @todo move this to Watch model get_fetch_backend if not prefer_backend or prefer_backend == 'system':
if not prefer_backend: prefer_backend = self.datastore.data['settings']['application']['fetch_backend']
prefer_backend = self.datastore.data['settings']['application']['fetch_backend']
if hasattr(content_fetcher, prefer_backend): if hasattr(content_fetcher, prefer_backend):
klass = getattr(content_fetcher, prefer_backend) klass = getattr(content_fetcher, prefer_backend)

View File

@@ -138,7 +138,7 @@ class ValidateContentFetcherIsReady(object):
from changedetectionio import content_fetcher from changedetectionio import content_fetcher
# Better would be a radiohandler that keeps a reference to each class # Better would be a radiohandler that keeps a reference to each class
if field.data is not None: if field.data is not None and field.data != 'system':
klass = getattr(content_fetcher, field.data) klass = getattr(content_fetcher, field.data)
some_object = klass() some_object = klass()
try: try:
@@ -345,6 +345,7 @@ class quickWatchForm(Form):
edit_and_watch_submit_button = SubmitField('Edit > Watch', render_kw={"class": "pure-button pure-button-primary"}) edit_and_watch_submit_button = SubmitField('Edit > Watch', render_kw={"class": "pure-button pure-button-primary"})
# Common to a single watch and the global settings # Common to a single watch and the global settings
class commonSettingsForm(Form): class commonSettingsForm(Form):
notification_urls = StringListField('Notification URL List', validators=[validators.Optional(), ValidateAppRiseServers()]) notification_urls = StringListField('Notification URL List', validators=[validators.Optional(), ValidateAppRiseServers()])