From 76ffc3e891218c8ee4538db8a616297f2ced0214 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Thu, 13 Jun 2024 11:52:12 +0200 Subject: [PATCH] RSS - Setting to hide muted watches in RSS feed (default ON) (#2411) --- changedetectionio/flask_app.py | 4 ++-- changedetectionio/forms.py | 2 ++ changedetectionio/model/App.py | 2 ++ changedetectionio/store.py | 4 ++-- changedetectionio/templates/settings.html | 3 +++ 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/changedetectionio/flask_app.py b/changedetectionio/flask_app.py index 3a3bb0f8..02e041b1 100644 --- a/changedetectionio/flask_app.py +++ b/changedetectionio/flask_app.py @@ -339,7 +339,7 @@ def changedetection_app(config=None, datastore_o=None): # @todo needs a .itemsWithTag() or something - then we can use that in Jinaj2 and throw this away for uuid, watch in datastore.data['watching'].items(): # @todo tag notification_muted skip also (improve Watch model) - if watch.get('notification_muted'): + if datastore.data['settings']['application'].get('rss_hide_muted_watches') and watch.get('notification_muted'): continue if limit_tag and not limit_tag in watch['tags']: continue @@ -472,7 +472,7 @@ def changedetection_app(config=None, datastore_o=None): # Don't link to hosting when we're on the hosting environment active_tag=active_tag, active_tag_uuid=active_tag_uuid, - app_rss_token=datastore.data['settings']['application']['rss_access_token'], + app_rss_token=datastore.data['settings']['application'].get('rss_access_token'), datastore=datastore, errored_count=errored_count, form=form, diff --git a/changedetectionio/forms.py b/changedetectionio/forms.py index 673be9ca..16720aa2 100644 --- a/changedetectionio/forms.py +++ b/changedetectionio/forms.py @@ -572,6 +572,8 @@ class globalSettingsApplicationForm(commonSettingsForm): removepassword_button = SubmitField('Remove password', render_kw={"class": "pure-button pure-button-primary"}) render_anchor_tag_content = BooleanField('Render anchor tag content', default=False) shared_diff_access = BooleanField('Allow access to view diff page when password is enabled', default=False, validators=[validators.Optional()]) + rss_hide_muted_watches = BooleanField('Hide muted watches from RSS feed', default=True, + validators=[validators.Optional()]) 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, diff --git a/changedetectionio/model/App.py b/changedetectionio/model/App.py index 75384f17..e412542b 100644 --- a/changedetectionio/model/App.py +++ b/changedetectionio/model/App.py @@ -46,6 +46,8 @@ class model(dict): 'pager_size': 50, 'password': False, 'render_anchor_tag_content': False, + 'rss_access_token': None, + 'rss_hide_muted_watches': True, 'schema_version' : 0, 'shared_diff_access': False, 'webdriver_delay': None , # Extra delay in seconds before extracting text diff --git a/changedetectionio/store.py b/changedetectionio/store.py index 6e84ac2f..d11e7243 100644 --- a/changedetectionio/store.py +++ b/changedetectionio/store.py @@ -124,12 +124,12 @@ class ChangeDetectionStore: self.__data['app_guid'] = str(uuid_builder.uuid4()) # Generate the URL access token for RSS feeds - if not 'rss_access_token' in self.__data['settings']['application']: + if not self.__data['settings']['application'].get('rss_access_token'): secret = secrets.token_hex(16) self.__data['settings']['application']['rss_access_token'] = secret # Generate the API access token - if not 'api_access_token' in self.__data['settings']['application']: + if not self.__data['settings']['application'].get('api_access_token'): secret = secrets.token_hex(16) self.__data['settings']['application']['api_access_token'] = secret diff --git a/changedetectionio/templates/settings.html b/changedetectionio/templates/settings.html index 0e3cea34..1212def0 100644 --- a/changedetectionio/templates/settings.html +++ b/changedetectionio/templates/settings.html @@ -62,6 +62,9 @@ Allow access to view watch diff page when password is enabled (Good for sharing the diff page) +
+ {{ render_checkbox_field(form.application.form.rss_hide_muted_watches) }} +
{{ render_field(form.application.form.pager_size) }} Number of items per page in the watch overview list, 0 to disable.