diff --git a/changedetectionio/blueprint/tags/__init__.py b/changedetectionio/blueprint/tags/__init__.py index e11910ff7..7c9fffb04 100644 --- a/changedetectionio/blueprint/tags/__init__.py +++ b/changedetectionio/blueprint/tags/__init__.py @@ -22,10 +22,12 @@ def construct_blueprint(datastore: ChangeDetectionStore): tag_count = Counter(tag for watch in datastore.data['watching'].values() if watch.get('tags') for tag in watch['tags']) + from changedetectionio import processors output = render_template("groups-overview.html", app_rss_token=datastore.data['settings']['application'].get('rss_access_token'), available_tags=sorted_tags, form=add_form, + generate_tag_colors=processors.generate_processor_badge_colors, tag_count=tag_count, ) @@ -208,9 +210,17 @@ def construct_blueprint(datastore: ChangeDetectionStore): template = env.from_string(template_str) included_content = template.render(**template_args) + # Watches whose URL currently matches this tag's pattern + matching_watches = { + w_uuid: watch + for w_uuid, watch in datastore.data['watching'].items() + if default.matches_url(watch.get('url', '')) + } + output = render_template("edit-tag.html", extra_form_content=included_content, extra_tab_content=form.extra_tab_content() if form.extra_tab_content() else None, + matching_watches=matching_watches, settings_application=datastore.data['settings']['application'], **template_args ) diff --git a/changedetectionio/blueprint/tags/form.py b/changedetectionio/blueprint/tags/form.py index 6ff3a503c..e8b3e192f 100644 --- a/changedetectionio/blueprint/tags/form.py +++ b/changedetectionio/blueprint/tags/form.py @@ -10,6 +10,8 @@ from changedetectionio.processors.restock_diff.forms import processor_settings_f class group_restock_settings_form(restock_settings_form): overrides_watch = BooleanField('Activate for individual watches in this tag/group?', default=False) + url_match_pattern = StringField('Auto-apply to watches with URLs matching', + render_kw={"placeholder": "e.g. *://example.com/* or github.com/myorg"}) class SingleTag(Form): diff --git a/changedetectionio/blueprint/tags/templates/edit-tag.html b/changedetectionio/blueprint/tags/templates/edit-tag.html index 8a0260903..033051265 100644 --- a/changedetectionio/blueprint/tags/templates/edit-tag.html +++ b/changedetectionio/blueprint/tags/templates/edit-tag.html @@ -43,6 +43,20 @@