From cd45492ebb3dd74e7bd07bef37afdf8e33d2eea4 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Fri, 12 Dec 2025 15:13:24 +0100 Subject: [PATCH] Shuffling endpoint --- changedetectionio/blueprint/rss/main_feed.py | 2 +- changedetectionio/blueprint/rss/tag.py | 2 +- changedetectionio/blueprint/ui/__init__.py | 8 + changedetectionio/blueprint/ui/edit.py | 4 +- .../blueprint/ui/templates/diff.html | 6 +- changedetectionio/blueprint/ui/views.py | 474 +----------------- .../watchlist/templates/watch-overview.html | 4 +- .../test_custom_browser_url.py | 2 +- .../tests/fetchers/test_content.py | 2 +- .../fetchers/test_custom_js_before_content.py | 2 +- .../proxy_list/test_select_custom_proxy.py | 2 +- .../tests/proxy_socks5/test_socks5_proxy.py | 2 +- .../proxy_socks5/test_socks5_proxy_sources.py | 2 +- .../tests/test_access_control.py | 4 +- changedetectionio/tests/test_api.py | 2 +- changedetectionio/tests/test_auth.py | 2 +- changedetectionio/tests/test_backend.py | 14 +- .../tests/test_block_while_text_present.py | 2 +- changedetectionio/tests/test_conditions.py | 2 +- changedetectionio/tests/test_css_selector.py | 2 +- .../tests/test_element_removal.py | 4 +- changedetectionio/tests/test_encoding.py | 4 +- changedetectionio/tests/test_errorhandling.py | 2 +- changedetectionio/tests/test_extract_csv.py | 2 +- changedetectionio/tests/test_extract_regex.py | 4 +- changedetectionio/tests/test_group.py | 4 +- .../tests/test_history_consistency.py | 4 +- changedetectionio/tests/test_ignore.py | 4 +- changedetectionio/tests/test_ignore_text.py | 4 +- .../tests/test_ignorehyperlinks.py | 4 +- changedetectionio/tests/test_jinja2.py | 4 +- .../tests/test_jsonpath_jq_selector.py | 12 +- changedetectionio/tests/test_obfuscations.py | 2 +- changedetectionio/tests/test_pdf.py | 4 +- .../tests/test_preview_endpoints.py | 6 +- changedetectionio/tests/test_request.py | 12 +- changedetectionio/tests/test_rss.py | 4 +- changedetectionio/tests/test_security.py | 6 +- changedetectionio/tests/test_source.py | 6 +- changedetectionio/tests/test_trigger.py | 6 +- changedetectionio/tests/test_trigger_regex.py | 2 +- .../tests/test_trigger_regex_with_filter.py | 2 +- changedetectionio/tests/test_ui.py | 2 +- changedetectionio/tests/test_unique_lines.py | 4 +- .../tests/test_xpath_selector.py | 18 +- .../tests/visualselector/test_fetch_data.py | 4 +- 46 files changed, 103 insertions(+), 567 deletions(-) diff --git a/changedetectionio/blueprint/rss/main_feed.py b/changedetectionio/blueprint/rss/main_feed.py index 6c24e66de..4c382baea 100644 --- a/changedetectionio/blueprint/rss/main_feed.py +++ b/changedetectionio/blueprint/rss/main_feed.py @@ -81,7 +81,7 @@ def construct_main_feed_routes(rss_blueprint, datastore): timestamp_from = dates[-2] guid = generate_watch_guid(watch, timestamp_to) # Because we are called via whatever web server, flask should figure out the right path - diff_link = {'href': url_for('ui.ui_views.diff_history_page', uuid=watch['uuid'], _external=True)} + diff_link = {'href': url_for('ui.ui_diff.diff_history_page', uuid=watch['uuid'], _external=True)} # Get template and build notification context n_body_template = get_rss_template(datastore, watch, rss_content_format, diff --git a/changedetectionio/blueprint/rss/tag.py b/changedetectionio/blueprint/rss/tag.py index c6daf77b1..7e22af71d 100644 --- a/changedetectionio/blueprint/rss/tag.py +++ b/changedetectionio/blueprint/rss/tag.py @@ -67,7 +67,7 @@ def construct_tag_routes(rss_blueprint, datastore): watch['uuid'] = uuid # Include a link to the diff page - diff_link = {'href': url_for('ui.ui_views.diff_history_page', uuid=watch['uuid'], _external=True)} + diff_link = {'href': url_for('ui.ui_diff.diff_history_page', uuid=watch['uuid'], _external=True)} # Get watch label watch_label = get_watch_label(datastore, watch) diff --git a/changedetectionio/blueprint/ui/__init__.py b/changedetectionio/blueprint/ui/__init__.py index 7755d2ca8..956298bad 100644 --- a/changedetectionio/blueprint/ui/__init__.py +++ b/changedetectionio/blueprint/ui/__init__.py @@ -6,6 +6,7 @@ from changedetectionio.store import ChangeDetectionStore from changedetectionio.blueprint.ui.edit import construct_blueprint as construct_edit_blueprint from changedetectionio.blueprint.ui.notification import construct_blueprint as construct_notification_blueprint from changedetectionio.blueprint.ui.views import construct_blueprint as construct_views_blueprint +from changedetectionio.blueprint.ui import diff, preview def _handle_operations(op, uuids, datastore, worker_handler, update_q, queuedWatchMetaData, watch_check_update, extra_data=None, emit_flash=True): from flask import request, flash @@ -121,6 +122,13 @@ def construct_blueprint(datastore: ChangeDetectionStore, update_q, worker_handle views_blueprint = construct_views_blueprint(datastore, update_q, queuedWatchMetaData, watch_check_update) ui_blueprint.register_blueprint(views_blueprint) + # Register diff and preview blueprints + diff_blueprint = diff.construct_blueprint(datastore) + ui_blueprint.register_blueprint(diff_blueprint) + + preview_blueprint = preview.construct_blueprint(datastore) + ui_blueprint.register_blueprint(preview_blueprint) + # Import the login decorator from changedetectionio.auth_decorator import login_optionally_required diff --git a/changedetectionio/blueprint/ui/edit.py b/changedetectionio/blueprint/ui/edit.py index d394a9069..a823ae996 100644 --- a/changedetectionio/blueprint/ui/edit.py +++ b/changedetectionio/blueprint/ui/edit.py @@ -206,7 +206,7 @@ def construct_blueprint(datastore: ChangeDetectionStore, update_q, queuedWatchMe # Diff page [edit] link should go back to diff page if request.args.get("next") and request.args.get("next") == 'diff': - return redirect(url_for('ui.ui_views.diff_history_page', uuid=uuid)) + return redirect(url_for('ui.ui_diff.diff_history_page', uuid=uuid)) return redirect(url_for('watchlist.index', tag=request.args.get("tag",''))) @@ -340,6 +340,6 @@ def construct_blueprint(datastore: ChangeDetectionStore, update_q, queuedWatchMe s = re.sub(r'[0-9]+', r'\\d+', s) datastore.data["watching"][uuid]['ignore_text'].append('/' + s + '/') - return f"Click to preview" + return f"Click to preview" return edit_blueprint \ No newline at end of file diff --git a/changedetectionio/blueprint/ui/templates/diff.html b/changedetectionio/blueprint/ui/templates/diff.html index 827ece36b..abd80fded 100644 --- a/changedetectionio/blueprint/ui/templates/diff.html +++ b/changedetectionio/blueprint/ui/templates/diff.html @@ -21,7 +21,7 @@
-
+
{% if versions|length >= 1 %} @@ -125,7 +125,7 @@
{%- endfor -%} -
{{ from_version|format_timestamp_timeago }} {%- if note -%}{{ note }}{%- endif -%} Goto single snapshot
+
{{ from_version|format_timestamp_timeago }} {%- if note -%}{{ note }}{%- endif -%} Goto single snapshot
{{ content| diff_unescape_difference_spans }}
@@ -146,7 +146,7 @@
diff --git a/changedetectionio/blueprint/ui/views.py b/changedetectionio/blueprint/ui/views.py index 58f970d63..e46695fc8 100644 --- a/changedetectionio/blueprint/ui/views.py +++ b/changedetectionio/blueprint/ui/views.py @@ -1,484 +1,12 @@ -from flask import Blueprint, request, redirect, url_for, flash, render_template, make_response, send_from_directory, abort -import os -import time -import re -from loguru import logger -from markupsafe import Markup - -from changedetectionio.diff import ( - REMOVED_STYLE, ADDED_STYLE, REMOVED_INNER_STYLE, ADDED_INNER_STYLE, - REMOVED_PLACEMARKER_OPEN, REMOVED_PLACEMARKER_CLOSED, - ADDED_PLACEMARKER_OPEN, ADDED_PLACEMARKER_CLOSED, - CHANGED_PLACEMARKER_OPEN, CHANGED_PLACEMARKER_CLOSED, - CHANGED_INTO_PLACEMARKER_OPEN, CHANGED_INTO_PLACEMARKER_CLOSED -) -from changedetectionio.notification.handler import apply_html_color_to_body +from flask import Blueprint, request, redirect, url_for, flash from changedetectionio.store import ChangeDetectionStore from changedetectionio.auth_decorator import login_optionally_required -from changedetectionio import html_tools, diff, strtobool from changedetectionio import worker_handler -def build_diff_cell_visualizer(content, resolution=100): - """ - Build a visual cell grid for the diff visualizer. - - Analyzes the content for placemarkers indicating changes and creates a - grid of cells representing the document, with each cell marked as: - - 'deletion' for removed content - - 'insertion' for added content - - 'mixed' for cells containing both deletions and insertions - - empty string for cells with no changes - - Args: - content: The diff content with placemarkers - resolution: Number of cells to create (default 100) - - Returns: - List of dicts with 'class' key for each cell's CSS class - """ - if not content: - return [{'class': ''} for _ in range(resolution)] - now = time.time() - # Work with character positions for better accuracy - content_length = len(content) - - if content_length == 0: - return [{'class': ''} for _ in range(resolution)] - - chars_per_cell = max(1, content_length / resolution) - - # Track change type for each cell - cell_data = {} - - # Placemarkers to detect - change_markers = { - REMOVED_PLACEMARKER_OPEN: 'deletion', - ADDED_PLACEMARKER_OPEN: 'insertion', - CHANGED_PLACEMARKER_OPEN: 'deletion', - CHANGED_INTO_PLACEMARKER_OPEN: 'insertion', - } - - # Find all occurrences of each marker - for marker, change_type in change_markers.items(): - pos = 0 - while True: - pos = content.find(marker, pos) - if pos == -1: - break - - # Calculate which cell this marker falls into - cell_index = min(int(pos / chars_per_cell), resolution - 1) - - if cell_index not in cell_data: - cell_data[cell_index] = change_type - elif cell_data[cell_index] != change_type: - # Mixed changes in this cell - cell_data[cell_index] = 'mixed' - - pos += len(marker) - - # Build the cell list - cells = [] - for i in range(resolution): - change_type = cell_data.get(i, '') - cells.append({'class': change_type}) - - logger.debug(f"Built diff cell visualizer: {len([c for c in cells if c['class']])} cells with changes out of {resolution} in {time.time() - now:.2f}s") - - return cells - def construct_blueprint(datastore: ChangeDetectionStore, update_q, queuedWatchMetaData, watch_check_update): views_blueprint = Blueprint('ui_views', __name__, template_folder="../ui/templates") - # Diff display preferences configuration - single source of truth - DIFF_PREFERENCES_CONFIG = { - 'changesOnly': {'default': True, 'type': 'bool'}, - 'ignoreWhitespace': {'default': False, 'type': 'bool'}, - 'removed': {'default': True, 'type': 'bool'}, - 'added': {'default': True, 'type': 'bool'}, - 'replaced': {'default': True, 'type': 'bool'}, - 'type': {'default': 'diffLines', 'type': 'value'}, - } - - @views_blueprint.app_template_filter('diff_unescape_difference_spans') - def diff_unescape_difference_spans(content): - """Emulate Jinja2's auto-escape, then selectively unescape our diff spans.""" - from markupsafe import escape - - if not content: - return Markup('') - - # Step 1: Escape everything like Jinja2 would (this makes it XSS-safe) - escaped_content = escape(str(content)) - - # Step 2: Unescape only our exact diff spans generated by apply_html_color_to_body() - # Pattern matches the exact structure: - # - - # Unescape outer span opening tags with full attributes (role, aria-label, title) - # Matches removed/added/changed/changed_into spans - result = re.sub( - rf'<span style="({re.escape(REMOVED_STYLE)}|{re.escape(ADDED_STYLE)})" ' - rf'role="(deletion|insertion|note)" ' - rf'aria-label="([^&]+?)" ' - rf'title="([^&]+?)">', - r'', - str(escaped_content), - flags=re.IGNORECASE - ) - - # Unescape inner span opening tags (without additional attributes) - # This matches the darker background styles for changed parts within lines - result = re.sub( - rf'<span style="({re.escape(REMOVED_INNER_STYLE)}|{re.escape(ADDED_INNER_STYLE)})">', - r'', - result, - flags=re.IGNORECASE - ) - - # Unescape closing tags (but only as many as we opened) - open_count = result.count('', 1) - - return Markup(result) - - @views_blueprint.route("/preview/", methods=['GET']) - @login_optionally_required - def preview_page(uuid): - content = [] - versions = [] - timestamp = None - - # More for testing, possible to return the first/only - if uuid == 'first': - uuid = list(datastore.data['watching'].keys()).pop() - - try: - watch = datastore.data['watching'][uuid] - except KeyError: - flash("No history found for the specified link, bad link?", "error") - return redirect(url_for('watchlist.index')) - - system_uses_webdriver = datastore.data['settings']['application']['fetch_backend'] == 'html_webdriver' - extra_stylesheets = [url_for('static_content', group='styles', filename='diff.css')] - - is_html_webdriver = False - if (watch.get('fetch_backend') == 'system' and system_uses_webdriver) or watch.get('fetch_backend') == 'html_webdriver' or watch.get('fetch_backend', '').startswith('extra_browser_'): - is_html_webdriver = True - - triggered_line_numbers = [] - ignored_line_numbers = [] - blocked_line_numbers = [] - - if datastore.data['watching'][uuid].history_n == 0 and (watch.get_error_text() or watch.get_error_snapshot()): - flash("Preview unavailable - No fetch/check completed or triggers not reached", "error") - else: - # So prepare the latest preview or not - preferred_version = request.args.get('version') - versions = list(watch.history.keys()) - timestamp = versions[-1] - if preferred_version and preferred_version in versions: - timestamp = preferred_version - - try: - versions = list(watch.history.keys()) - content = watch.get_history_snapshot(timestamp=timestamp) - - triggered_line_numbers = html_tools.strip_ignore_text(content=content, - wordlist=watch.get('trigger_text'), - mode='line numbers' - ) - ignored_line_numbers = html_tools.strip_ignore_text(content=content, - wordlist=watch.get('ignore_text'), - mode='line numbers' - ) - blocked_line_numbers = html_tools.strip_ignore_text(content=content, - wordlist=watch.get("text_should_not_be_present"), - mode='line numbers' - ) - except Exception as e: - content.append({'line': f"File doesnt exist or unable to read timestamp {timestamp}", 'classes': ''}) - - output = render_template("preview.html", - content=content, - current_diff_url=watch['url'], - current_version=timestamp, - extra_stylesheets=extra_stylesheets, - extra_title=f" - Diff - {watch.label} @ {timestamp}", - highlight_ignored_line_numbers=ignored_line_numbers, - highlight_triggered_line_numbers=triggered_line_numbers, - highlight_blocked_line_numbers=blocked_line_numbers, - history_n=watch.history_n, - is_html_webdriver=is_html_webdriver, - last_error=watch['last_error'], - last_error_screenshot=watch.get_error_snapshot(), - last_error_text=watch.get_error_text(), - screenshot=watch.get_screenshot(), - uuid=uuid, - versions=versions, - watch=watch, - ) - - return output - - @views_blueprint.route("/diff/", methods=['POST']) - @login_optionally_required - def diff_history_page_build_report(uuid): - import importlib - from changedetectionio import forms - - # More for testing, possible to return the first/only - if uuid == 'first': - uuid = list(datastore.data['watching'].keys()).pop() - - try: - watch = datastore.data['watching'][uuid] - except KeyError: - flash("No history found for the specified link, bad link?", "error") - return redirect(url_for('watchlist.index')) - - # For submission of requesting an extract - extract_form = forms.extractDataForm(formdata=request.form, - data={'extract_regex': request.form.get('extract_regex', '')} - ) - if not extract_form.validate(): - flash("An error occurred, please see below.", "error") - # Use processor-specific render with the error form - processor_name = watch.get('processor', 'text_json_diff') - try: - processor_module = importlib.import_module(f'changedetectionio.processors.{processor_name}.difference') - if hasattr(processor_module, 'render'): - return processor_module.render( - watch=watch, - datastore=datastore, - request=request, - url_for=url_for, - render_template=render_template, - flash=flash, - redirect=redirect, - extract_form=extract_form - ) - except (ImportError, ModuleNotFoundError): - pass - # Fallback to text_json_diff - from changedetectionio.processors.text_json_diff.difference import render as default_render - return default_render( - watch=watch, - datastore=datastore, - request=request, - url_for=url_for, - render_template=render_template, - flash=flash, - redirect=redirect, - extract_form=extract_form - ) - - else: - extract_regex = request.form.get('extract_regex', '').strip() - output = watch.extract_regex_from_all_history(extract_regex) - if output: - watch_dir = os.path.join(datastore.datastore_path, uuid) - response = make_response(send_from_directory(directory=watch_dir, path=output, as_attachment=True)) - response.headers['Content-type'] = 'text/csv' - response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate' - response.headers['Pragma'] = 'no-cache' - response.headers['Expires'] = "0" - return response - - flash('No matches found while scanning all of the watch history for that RegEx.', 'error') - return redirect(url_for('ui.ui_views.diff_history_page', uuid=uuid) + '#extract') - - def _render_diff_template(uuid, extract_form=None): - """Helper function to render the diff template with all required data""" - from changedetectionio import forms - - # More for testing, possible to return the first/only - if uuid == 'first': - uuid = list(datastore.data['watching'].keys()).pop() - - extra_stylesheets = [url_for('static_content', group='styles', filename='diff.css')] - try: - watch = datastore.data['watching'][uuid] - except KeyError: - flash("No history found for the specified link, bad link?", "error") - return redirect(url_for('watchlist.index')) - - # Use provided form or create a new one - if extract_form is None: - extract_form = forms.extractDataForm(formdata=request.form, - data={'extract_regex': request.form.get('extract_regex', '')} - ) - history = watch.history - dates = list(history.keys()) - - # If a "from_version" was requested, then find it (or the closest one) - # Also set "from version" to be the closest version to the one that was last viewed. - - best_last_viewed_timestamp = watch.get_from_version_based_on_last_viewed - from_version_timestamp = best_last_viewed_timestamp if best_last_viewed_timestamp else dates[-2] - from_version = request.args.get('from_version', from_version_timestamp ) - - # Use the current one if nothing was specified - to_version = request.args.get('to_version', str(dates[-1])) - - try: - to_version_file_contents = watch.get_history_snapshot(timestamp=to_version) - except Exception as e: - logger.error(f"Unable to read watch history to-version for version {to_version}: {str(e)}") - to_version_file_contents = f"Unable to read to-version at {to_version}.\n" - - try: - from_version_file_contents = watch.get_history_snapshot(timestamp=from_version) - except Exception as e: - logger.error(f"Unable to read watch history from-version for version {from_version}: {str(e)}") - from_version_file_contents = f"Unable to read to-version {from_version}.\n" - - screenshot_url = watch.get_screenshot() - - system_uses_webdriver = datastore.data['settings']['application']['fetch_backend'] == 'html_webdriver' - - is_html_webdriver = False - if (watch.get('fetch_backend') == 'system' and system_uses_webdriver) or watch.get('fetch_backend') == 'html_webdriver' or watch.get('fetch_backend', '').startswith('extra_browser_'): - is_html_webdriver = True - - password_enabled_and_share_is_off = False - if datastore.data['settings']['application'].get('password') or os.getenv("SALTED_PASS", False): - password_enabled_and_share_is_off = not datastore.data['settings']['application'].get('shared_diff_access') - - datastore.set_last_viewed(uuid, time.time()) - - # Parse diff preferences from request using config as single source of truth - # Check if this is a user submission (any diff pref param exists in query string) - user_submitted = any(key in request.args for key in DIFF_PREFERENCES_CONFIG.keys()) - - diff_prefs = {} - for key, config in DIFF_PREFERENCES_CONFIG.items(): - if user_submitted: - # User submitted form - missing checkboxes are explicitly OFF - if config['type'] == 'bool': - diff_prefs[key] = strtobool(request.args.get(key, 'off')) - else: - diff_prefs[key] = request.args.get(key, config['default']) - else: - # Initial load - use defaults from config - diff_prefs[key] = config['default'] - - content = diff.render_diff(previous_version_file_contents=from_version_file_contents, - newest_version_file_contents=to_version_file_contents, - include_replaced=diff_prefs['replaced'], - include_added=diff_prefs['added'], - include_removed=diff_prefs['removed'], - include_equal=diff_prefs['changesOnly'], - ignore_junk=diff_prefs['ignoreWhitespace'], - word_diff=diff_prefs['type'] == 'diffWords', - ) - - # Build cell grid visualizer before applying HTML color (so we can detect placemarkers) - diff_cell_grid = build_diff_cell_visualizer(content) - - content = apply_html_color_to_body(n_body=content) - offscreen_content = render_template("diff-offscreen-options.html") - - note = '' - if str(from_version) != str(dates[-2]) or str(to_version) != str(dates[-1]): - note = 'Note: You are not viewing the latest changes.' - - output = render_template("diff.html", - #initial_scroll_line_number=100, - bottom_horizontal_offscreen_contents=offscreen_content, - content=content, - current_diff_url=watch['url'], - diff_cell_grid=diff_cell_grid, - diff_prefs=diff_prefs, - extra_classes='difference-page', - extra_stylesheets=extra_stylesheets, - extra_title=f" - {watch.label} - History", - extract_form=extract_form, - from_version=str(from_version), - is_html_webdriver=is_html_webdriver, - last_error=watch['last_error'], - last_error_screenshot=watch.get_error_snapshot(), - last_error_text=watch.get_error_text(), - newest=to_version_file_contents, - newest_version_timestamp=dates[-1], - note=note, - password_enabled_and_share_is_off=password_enabled_and_share_is_off, - pure_menu_fixed=False, - screenshot=screenshot_url, - to_version=str(to_version), - uuid=uuid, - versions=dates, # All except current/last - watch_a=watch, - ) - return output - - @views_blueprint.route("/diff/", methods=['GET']) - @login_optionally_required - def diff_history_page(uuid): - """ - Render the history/diff page for a watch. - - This route is processor-aware: it delegates rendering to the processor's - difference.py module, allowing different processor types to provide - custom visualizations: - - text_json_diff: Text/HTML diff with syntax highlighting - - restock_diff: Could show price charts and stock history - - image_diff: Could show image comparison slider/overlay - - Each processor implements processors/{type}/difference.py::render() - If a processor doesn't have a difference module, falls back to text_json_diff. - """ - import importlib - - # More for testing, possible to return the first/only - if uuid == 'first': - uuid = list(datastore.data['watching'].keys()).pop() - - try: - watch = datastore.data['watching'][uuid] - except KeyError: - flash("No history found for the specified link, bad link?", "error") - return redirect(url_for('watchlist.index')) - - # Get the processor type for this watch - processor_name = watch.get('processor', 'text_json_diff') - - try: - # Try to import the processor's difference module - processor_module = importlib.import_module(f'changedetectionio.processors.{processor_name}.difference') - - # Call the processor's render() function - if hasattr(processor_module, 'render'): - return processor_module.render( - watch=watch, - datastore=datastore, - request=request, - url_for=url_for, - render_template=render_template, - flash=flash, - redirect=redirect - ) - except (ImportError, ModuleNotFoundError) as e: - logger.warning(f"Processor {processor_name} does not have a difference module, falling back to text_json_diff: {e}") - - # Fallback: if processor doesn't have difference module, use text_json_diff as default - from changedetectionio.processors.text_json_diff.difference import render as default_render - return default_render( - watch=watch, - datastore=datastore, - request=request, - url_for=url_for, - render_template=render_template, - flash=flash, - redirect=redirect - ) - - @views_blueprint.route("/form/add/quickwatch", methods=['POST']) @login_optionally_required def form_quick_watch_add(): diff --git a/changedetectionio/blueprint/watchlist/templates/watch-overview.html b/changedetectionio/blueprint/watchlist/templates/watch-overview.html index a37b8eae3..976ea2fa6 100644 --- a/changedetectionio/blueprint/watchlist/templates/watch-overview.html +++ b/changedetectionio/blueprint/watchlist/templates/watch-overview.html @@ -235,8 +235,8 @@ document.addEventListener('DOMContentLoaded', function() { Recheck Edit - - + +
diff --git a/changedetectionio/tests/custom_browser_url/test_custom_browser_url.py b/changedetectionio/tests/custom_browser_url/test_custom_browser_url.py index 102adbe62..514a99658 100644 --- a/changedetectionio/tests/custom_browser_url/test_custom_browser_url.py +++ b/changedetectionio/tests/custom_browser_url/test_custom_browser_url.py @@ -66,7 +66,7 @@ def do_test(client, live_server, make_test_use_extra_browser=False): wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) assert b'cool it works' in res.data diff --git a/changedetectionio/tests/fetchers/test_content.py b/changedetectionio/tests/fetchers/test_content.py index c169dc528..89623fdc5 100644 --- a/changedetectionio/tests/fetchers/test_content.py +++ b/changedetectionio/tests/fetchers/test_content.py @@ -36,7 +36,7 @@ def test_fetch_webdriver_content(client, live_server, measure_memory_usage, data wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) logging.getLogger().info("Looking for correct fetched HTML (text) from server") diff --git a/changedetectionio/tests/fetchers/test_custom_js_before_content.py b/changedetectionio/tests/fetchers/test_custom_js_before_content.py index 76c89ce2f..2ee8836de 100644 --- a/changedetectionio/tests/fetchers/test_custom_js_before_content.py +++ b/changedetectionio/tests/fetchers/test_custom_js_before_content.py @@ -42,7 +42,7 @@ def test_execute_custom_js(client, live_server, measure_memory_usage, datastore_ # Check HTML conversion detected and workd res = client.get( - url_for("ui.ui_views.preview_page", uuid=uuid), + url_for("ui.ui_preview.preview_page", uuid=uuid), follow_redirects=True ) assert b"This text should be removed" not in res.data diff --git a/changedetectionio/tests/proxy_list/test_select_custom_proxy.py b/changedetectionio/tests/proxy_list/test_select_custom_proxy.py index bddeff277..c06022477 100644 --- a/changedetectionio/tests/proxy_list/test_select_custom_proxy.py +++ b/changedetectionio/tests/proxy_list/test_select_custom_proxy.py @@ -40,7 +40,7 @@ def test_select_custom(client, live_server, measure_memory_usage, datastore_path assert b'Proxy Authentication Required' not in res.data res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) # We should see something via proxy diff --git a/changedetectionio/tests/proxy_socks5/test_socks5_proxy.py b/changedetectionio/tests/proxy_socks5/test_socks5_proxy.py index 850474bb2..99b6d54d1 100644 --- a/changedetectionio/tests/proxy_socks5/test_socks5_proxy.py +++ b/changedetectionio/tests/proxy_socks5/test_socks5_proxy.py @@ -74,7 +74,7 @@ def test_socks5(client, live_server, measure_memory_usage, datastore_path): wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) diff --git a/changedetectionio/tests/proxy_socks5/test_socks5_proxy_sources.py b/changedetectionio/tests/proxy_socks5/test_socks5_proxy_sources.py index c605fef60..f0bf81c63 100644 --- a/changedetectionio/tests/proxy_socks5/test_socks5_proxy_sources.py +++ b/changedetectionio/tests/proxy_socks5/test_socks5_proxy_sources.py @@ -61,7 +61,7 @@ def test_socks5_from_proxiesjson_file(client, live_server, measure_memory_usage, wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) diff --git a/changedetectionio/tests/test_access_control.py b/changedetectionio/tests/test_access_control.py index 6a2b680b1..febbe7ca7 100644 --- a/changedetectionio/tests/test_access_control.py +++ b/changedetectionio/tests/test_access_control.py @@ -49,7 +49,7 @@ def test_check_access_control(app, client, live_server, measure_memory_usage, da assert b"Login" in res.data # The diff page should return something valid when logged out - res = c.get(url_for("ui.ui_views.diff_history_page", uuid="first")) + res = c.get(url_for("ui.ui_diff.diff_history_page", uuid="first")) assert b'Random content' in res.data # access to assets should work (check_authentication) @@ -186,5 +186,5 @@ def test_check_access_control(app, client, live_server, measure_memory_usage, da assert res.status_code == 403 # The diff page should return something valid when logged out - res = c.get(url_for("ui.ui_views.diff_history_page", uuid="first")) + res = c.get(url_for("ui.ui_diff.diff_history_page", uuid="first")) assert b'Random content' not in res.data diff --git a/changedetectionio/tests/test_api.py b/changedetectionio/tests/test_api.py index a248bb865..47285bd7e 100644 --- a/changedetectionio/tests/test_api.py +++ b/changedetectionio/tests/test_api.py @@ -189,7 +189,7 @@ def test_api_simple(client, live_server, measure_memory_usage, datastore_path): assert watch.get('viewed') == False # Loading the most recent snapshot should force viewed to become true - client.get(url_for("ui.ui_views.diff_history_page", uuid="first"), follow_redirects=True) + client.get(url_for("ui.ui_diff.diff_history_page", uuid="first"), follow_redirects=True) time.sleep(3) # Fetch the whole watch again, viewed should be true diff --git a/changedetectionio/tests/test_auth.py b/changedetectionio/tests/test_auth.py index 4ac30ad87..2e073e212 100644 --- a/changedetectionio/tests/test_auth.py +++ b/changedetectionio/tests/test_auth.py @@ -26,7 +26,7 @@ def test_basic_auth(client, live_server, measure_memory_usage, datastore_path): wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) diff --git a/changedetectionio/tests/test_backend.py b/changedetectionio/tests/test_backend.py index f0549b9b9..3215328e8 100644 --- a/changedetectionio/tests/test_backend.py +++ b/changedetectionio/tests/test_backend.py @@ -45,7 +45,7 @@ def test_check_basic_change_detection_functionality(client, live_server, measure # Check HTML conversion detected and workd res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) # Check this class does not appear (that we didnt see the actual source) @@ -82,7 +82,7 @@ def test_check_basic_change_detection_functionality(client, live_server, measure # # Following the 'diff' link, it should no longer display as 'has-unread-changes' even after we recheck it a few times - res = client.get(url_for("ui.ui_views.diff_history_page", uuid=uuid)) + res = client.get(url_for("ui.ui_diff.diff_history_page", uuid=uuid)) assert b'selected=""' in res.data, "Confirm diff history page loaded" assert b'Which is across multiple lines' in res.data @@ -91,7 +91,7 @@ def test_check_basic_change_detection_functionality(client, live_server, measure # Check the [preview] pulls the right one res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) assert b'which has this one new line' in res.data @@ -273,7 +273,7 @@ got it\r\n ### check the front end res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) assert b"some random text that should be split by line\n" in res.data @@ -333,7 +333,7 @@ got it\r\n ### check the front end res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -378,7 +378,7 @@ def test_plaintext_even_if_xml_content(client, live_server, measure_memory_usage wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -405,7 +405,7 @@ def test_plaintext_even_if_xml_content_and_can_apply_filters(client, live_server wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) diff --git a/changedetectionio/tests/test_block_while_text_present.py b/changedetectionio/tests/test_block_while_text_present.py index 69f9ca1b6..e70db27bd 100644 --- a/changedetectionio/tests/test_block_while_text_present.py +++ b/changedetectionio/tests/test_block_while_text_present.py @@ -145,7 +145,7 @@ def test_check_block_changedetection_text_NOT_present(client, live_server, measu client.get(url_for("ui.form_watch_checknow"), follow_redirects=True) wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid=uuid) + url_for("ui.ui_preview.preview_page", uuid=uuid) ) assert b'blocked_line_numbers = [10]' in res.data diff --git a/changedetectionio/tests/test_conditions.py b/changedetectionio/tests/test_conditions.py index 9bebd6ef3..2a35beca6 100644 --- a/changedetectionio/tests/test_conditions.py +++ b/changedetectionio/tests/test_conditions.py @@ -291,7 +291,7 @@ def test_lev_conditions_plugin(client, live_server, measure_memory_usage, datast # Check the content saved initially, even tho a condition was set - this is the first snapshot so shouldnt be affected by conditions res = client.get( - url_for("ui.ui_views.preview_page", uuid=uuid), + url_for("ui.ui_preview.preview_page", uuid=uuid), follow_redirects=True ) assert b'Which is across multiple lines' in res.data diff --git a/changedetectionio/tests/test_css_selector.py b/changedetectionio/tests/test_css_selector.py index 46605f0ce..03914ec42 100644 --- a/changedetectionio/tests/test_css_selector.py +++ b/changedetectionio/tests/test_css_selector.py @@ -157,7 +157,7 @@ def test_check_multiple_filters(client, live_server, measure_memory_usage, datas wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) diff --git a/changedetectionio/tests/test_element_removal.py b/changedetectionio/tests/test_element_removal.py index bc9503be5..5fde2206a 100644 --- a/changedetectionio/tests/test_element_removal.py +++ b/changedetectionio/tests/test_element_removal.py @@ -192,7 +192,7 @@ def test_element_removal_full(client, live_server, measure_memory_usage, datasto wait_for_all_checks(client) # so that we set the state to 'has-unread-changes' after all the edits - client.get(url_for("ui.ui_views.diff_history_page", uuid="first")) + client.get(url_for("ui.ui_diff.diff_history_page", uuid="first")) # Make a change to header/footer/nav set_modified_response(datastore_path=datastore_path) @@ -239,7 +239,7 @@ body > table > tr:nth-child(3) > td:nth-child(3)""", wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) diff --git a/changedetectionio/tests/test_encoding.py b/changedetectionio/tests/test_encoding.py index 8a050ea4b..cbc1595b6 100644 --- a/changedetectionio/tests/test_encoding.py +++ b/changedetectionio/tests/test_encoding.py @@ -41,7 +41,7 @@ def test_check_encoding_detection(client, live_server, measure_memory_usage, dat assert live_server.app.config['DATASTORE'].data['watching'][uuid]['content-type'] == "text/html" res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -63,7 +63,7 @@ def test_check_encoding_detection_missing_content_type_header(client, live_serve wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) diff --git a/changedetectionio/tests/test_errorhandling.py b/changedetectionio/tests/test_errorhandling.py index 66438e3d9..ace9f5e65 100644 --- a/changedetectionio/tests/test_errorhandling.py +++ b/changedetectionio/tests/test_errorhandling.py @@ -34,7 +34,7 @@ def _runner_test_http_errors(client, live_server, http_code, expected_text, data # Error viewing tabs should appear res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) diff --git a/changedetectionio/tests/test_extract_csv.py b/changedetectionio/tests/test_extract_csv.py index 1ca4f83b4..1abbb8fef 100644 --- a/changedetectionio/tests/test_extract_csv.py +++ b/changedetectionio/tests/test_extract_csv.py @@ -41,7 +41,7 @@ def test_check_extract_text_from_diff(client, live_server, measure_memory_usage, wait_for_all_checks(client) res = client.post( - url_for("ui.ui_views.diff_history_page", uuid="first"), + url_for("ui.ui_diff.diff_history_page", uuid="first"), data={"extract_regex": "Now it's ([0-9\.]+)", "extract_submit_button": "Extract as CSV"}, follow_redirects=False diff --git a/changedetectionio/tests/test_extract_regex.py b/changedetectionio/tests/test_extract_regex.py index 1983b8faf..cd72a212e 100644 --- a/changedetectionio/tests/test_extract_regex.py +++ b/changedetectionio/tests/test_extract_regex.py @@ -107,7 +107,7 @@ def test_check_filter_multiline(client, live_server, measure_memory_usage, datas assert b'not at the start of the expression' not in res.data res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) # Plaintext that doesnt look like a regex should match also @@ -174,7 +174,7 @@ def test_check_filter_and_regex_extract(client, live_server, measure_memory_usag # Check HTML conversion detected and workd res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) diff --git a/changedetectionio/tests/test_group.py b/changedetectionio/tests/test_group.py index 64524f37d..09cd53ac7 100644 --- a/changedetectionio/tests/test_group.py +++ b/changedetectionio/tests/test_group.py @@ -94,7 +94,7 @@ def test_setup_group_tag(client, live_server, measure_memory_usage, datastore_pa assert b'Warning, no filters were found' not in res.data res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) assert b'Should be only this' in res.data @@ -419,7 +419,7 @@ def test_order_of_filters_tag_filter_and_watch_filter(client, live_server, measu wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) diff --git a/changedetectionio/tests/test_history_consistency.py b/changedetectionio/tests/test_history_consistency.py index f88c6d0c3..ff69797f1 100644 --- a/changedetectionio/tests/test_history_consistency.py +++ b/changedetectionio/tests/test_history_consistency.py @@ -100,7 +100,7 @@ def test_check_text_history_view(client, live_server, measure_memory_usage, data client.get(url_for("ui.form_watch_checknow"), follow_redirects=True) wait_for_all_checks(client) - res = client.get(url_for("ui.ui_views.diff_history_page", uuid="first")) + res = client.get(url_for("ui.ui_diff.diff_history_page", uuid="first")) assert b'test-one' in res.data assert b'test-two' in res.data @@ -112,7 +112,7 @@ def test_check_text_history_view(client, live_server, measure_memory_usage, data wait_for_all_checks(client) # It should remember the last viewed time, so the first difference is not shown - res = client.get(url_for("ui.ui_views.diff_history_page", uuid="first")) + res = client.get(url_for("ui.ui_diff.diff_history_page", uuid="first")) assert b'test-three' in res.data assert b'test-two' in res.data assert b'test-one' not in res.data diff --git a/changedetectionio/tests/test_ignore.py b/changedetectionio/tests/test_ignore.py index a85f4ee52..6e825a24f 100644 --- a/changedetectionio/tests/test_ignore.py +++ b/changedetectionio/tests/test_ignore.py @@ -49,7 +49,7 @@ def test_ignore(client, live_server, measure_memory_usage, datastore_path): assert b'href' in res.data # It should not be in the preview anymore - res = client.get(url_for("ui.ui_views.preview_page", uuid=uuid)) + res = client.get(url_for("ui.ui_preview.preview_page", uuid=uuid)) assert b'
oh yeah 456' not in res.data # Should be in base.html @@ -84,6 +84,6 @@ def test_strip_ignore_lines(client, live_server, measure_memory_usage, datastore uuid = next(iter(live_server.app.config['DATASTORE'].data['watching'])) # It should not be in the preview anymore - res = client.get(url_for("ui.ui_views.preview_page", uuid=uuid)) + res = client.get(url_for("ui.ui_preview.preview_page", uuid=uuid)) assert b'
' not in res.data assert b'Which is across multiple' not in res.data diff --git a/changedetectionio/tests/test_ignore_text.py b/changedetectionio/tests/test_ignore_text.py index 949021536..37868faca 100644 --- a/changedetectionio/tests/test_ignore_text.py +++ b/changedetectionio/tests/test_ignore_text.py @@ -131,7 +131,7 @@ def test_check_ignore_text_functionality(client, live_server, measure_memory_usa assert b'/test-endpoint' in res.data - res = client.get(url_for("ui.ui_views.preview_page", uuid="first")) + res = client.get(url_for("ui.ui_preview.preview_page", uuid="first")) # nothing ignored because none of the text matched assert b'ignored_line_numbers = []' in res.data @@ -158,7 +158,7 @@ def test_check_ignore_text_functionality(client, live_server, measure_memory_usa res = client.get(url_for("watchlist.index")) assert b'has-unread-changes' in res.data - res = client.get(url_for("ui.ui_views.preview_page", uuid="first")) + res = client.get(url_for("ui.ui_preview.preview_page", uuid="first")) # SHOULD BE be in the preview, it was added in set_modified_original_ignore_response() # and we have "new ignore stuff" in ignore_text diff --git a/changedetectionio/tests/test_ignorehyperlinks.py b/changedetectionio/tests/test_ignorehyperlinks.py index 9a811c538..2e870d5f6 100644 --- a/changedetectionio/tests/test_ignorehyperlinks.py +++ b/changedetectionio/tests/test_ignorehyperlinks.py @@ -82,7 +82,7 @@ def test_render_anchor_tag_content_true(client, live_server, measure_memory_usag wait_for_all_checks(client) # We should not see the rendered anchor tag - res = client.get(url_for("ui.ui_views.preview_page", uuid="first")) + res = client.get(url_for("ui.ui_preview.preview_page", uuid="first")) assert '(/modified_link)' not in res.data.decode() # Goto the settings page, ENABLE render anchor tag @@ -106,7 +106,7 @@ def test_render_anchor_tag_content_true(client, live_server, measure_memory_usag # check that the anchor tag content is rendered - res = client.get(url_for("ui.ui_views.preview_page", uuid="first")) + res = client.get(url_for("ui.ui_preview.preview_page", uuid="first")) assert '(/modified_link)' in res.data.decode() # since the link has changed, and we chose to render anchor tag content, diff --git a/changedetectionio/tests/test_jinja2.py b/changedetectionio/tests/test_jinja2.py index 09612a694..fcca6ab20 100644 --- a/changedetectionio/tests/test_jinja2.py +++ b/changedetectionio/tests/test_jinja2.py @@ -30,7 +30,7 @@ def test_jinja2_in_url_query(client, live_server, measure_memory_usage, datastor # It should report nothing found (no new 'has-unread-changes' class) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) assert b'date=2' in res.data @@ -56,7 +56,7 @@ def test_jinja2_time_offset_in_url_query(client, live_server, measure_memory_usa # Verify the URL was processed correctly (should not have errors) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) # Should have a valid timestamp in the response diff --git a/changedetectionio/tests/test_jsonpath_jq_selector.py b/changedetectionio/tests/test_jsonpath_jq_selector.py index f3e4006e1..d598ecc6c 100644 --- a/changedetectionio/tests/test_jsonpath_jq_selector.py +++ b/changedetectionio/tests/test_jsonpath_jq_selector.py @@ -210,7 +210,7 @@ def test_check_json_without_filter(client, live_server, measure_memory_usage, da wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -253,7 +253,7 @@ def check_json_filter(json_filter, client, live_server, datastore_path): assert b'has-unread-changes' in res.data # Should not see this, because its not in the JSONPath we entered - res = client.get(url_for("ui.ui_views.diff_history_page", uuid=uuid)) + res = client.get(url_for("ui.ui_diff.diff_history_page", uuid=uuid)) # But the change should be there, tho its hard to test the change was detected because it will show old and new versions # And #462 - check we see the proper utf-8 string there @@ -289,7 +289,7 @@ def check_json_filter_bool_val(json_filter, client, live_server, datastore_path) # Give the thread time to pick it up wait_for_all_checks(client) - res = client.get(url_for("ui.ui_views.diff_history_page", uuid="first")) + res = client.get(url_for("ui.ui_diff.diff_history_page", uuid="first")) # But the change should be there, tho its hard to test the change was detected because it will show old and new versions assert b'false' in res.data @@ -361,7 +361,7 @@ def check_json_ext_filter(json_filter, client, live_server, datastore_path): res = client.get(url_for("watchlist.index")) assert b'has-unread-changes' in res.data - res = client.get(url_for("ui.ui_views.preview_page", uuid="first")) + res = client.get(url_for("ui.ui_preview.preview_page", uuid="first")) # We should never see 'ForSale' because we are selecting on 'Sold' in the rule, # But we should know it triggered ('has-unread-changes' assert above) @@ -371,7 +371,7 @@ def check_json_ext_filter(json_filter, client, live_server, datastore_path): # And the difference should have both? - res = client.get(url_for("ui.ui_views.diff_history_page", uuid="first")) + res = client.get(url_for("ui.ui_diff.diff_history_page", uuid="first")) assert b'ForSale' in res.data assert b'Sold' in res.data @@ -432,7 +432,7 @@ def test_correct_header_detect(client, live_server, measure_memory_usage, datast assert b'No parsable JSON found in this document' not in res.data res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) diff --git a/changedetectionio/tests/test_obfuscations.py b/changedetectionio/tests/test_obfuscations.py index e1ef0df28..09d8b9b3a 100644 --- a/changedetectionio/tests/test_obfuscations.py +++ b/changedetectionio/tests/test_obfuscations.py @@ -33,7 +33,7 @@ def test_obfuscations(client, live_server, measure_memory_usage, datastore_path) # Check HTML conversion detected and workd res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) diff --git a/changedetectionio/tests/test_pdf.py b/changedetectionio/tests/test_pdf.py index f82d3a3f4..585893096 100644 --- a/changedetectionio/tests/test_pdf.py +++ b/changedetectionio/tests/test_pdf.py @@ -56,7 +56,7 @@ def test_fetch_pdf(client, live_server, measure_memory_usage, datastore_path): # The original checksum should be not be here anymore (cdio adds it to the bottom of the text) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -64,7 +64,7 @@ def test_fetch_pdf(client, live_server, measure_memory_usage, datastore_path): assert changed_md5.encode('utf-8') in res.data res = client.get( - url_for("ui.ui_views.diff_history_page", uuid="first"), + url_for("ui.ui_diff.diff_history_page", uuid="first"), follow_redirects=True ) diff --git a/changedetectionio/tests/test_preview_endpoints.py b/changedetectionio/tests/test_preview_endpoints.py index 9ae728393..f595359ba 100644 --- a/changedetectionio/tests/test_preview_endpoints.py +++ b/changedetectionio/tests/test_preview_endpoints.py @@ -20,7 +20,7 @@ def test_fetch_pdf(client, live_server, measure_memory_usage, datastore_path): wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -50,7 +50,7 @@ def test_fetch_pdf(client, live_server, measure_memory_usage, datastore_path): # The original checksum should be not be here anymore (cdio adds it to the bottom of the text) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -58,7 +58,7 @@ def test_fetch_pdf(client, live_server, measure_memory_usage, datastore_path): assert changed_md5.encode('utf-8') in res.data res = client.get( - url_for("ui.ui_views.diff_history_page", uuid="first"), + url_for("ui.ui_diff.diff_history_page", uuid="first"), follow_redirects=True ) diff --git a/changedetectionio/tests/test_request.py b/changedetectionio/tests/test_request.py index 66a4b6055..71305c182 100644 --- a/changedetectionio/tests/test_request.py +++ b/changedetectionio/tests/test_request.py @@ -48,7 +48,7 @@ def test_headers_in_request(client, live_server, measure_memory_usage, datastore # The service should echo back the request headers res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -126,7 +126,7 @@ def test_body_in_request(client, live_server, measure_memory_usage, datastore_pa # The service should echo back the body res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -215,7 +215,7 @@ def test_method_in_request(client, live_server, measure_memory_usage, datastore_ # The service should echo back the request verb res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -257,7 +257,7 @@ def test_ua_global_override(client, live_server, measure_memory_usage, datastore wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -281,7 +281,7 @@ def test_ua_global_override(client, live_server, measure_memory_usage, datastore assert b"Updated watch." in res.data wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) assert b"agent-from-watch" in res.data @@ -376,7 +376,7 @@ def test_headers_textfile_in_request(client, live_server, measure_memory_usage, # The service should echo back the request verb res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) diff --git a/changedetectionio/tests/test_rss.py b/changedetectionio/tests/test_rss.py index e198c5c5c..c0845b2b1 100644 --- a/changedetectionio/tests/test_rss.py +++ b/changedetectionio/tests/test_rss.py @@ -124,7 +124,7 @@ def test_basic_cdata_rss_markup(client, live_server, measure_memory_usage, datas wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) assert b'CDATA' not in res.data @@ -166,7 +166,7 @@ def test_rss_xpath_filtering(client, live_server, measure_memory_usage, datastor wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) assert b'CDATA' not in res.data diff --git a/changedetectionio/tests/test_security.py b/changedetectionio/tests/test_security.py index c0d5ccb5f..a9b0cb99d 100644 --- a/changedetectionio/tests/test_security.py +++ b/changedetectionio/tests/test_security.py @@ -101,7 +101,7 @@ def _runner_test_various_file_slash(client, file_uri): if file_uri.startswith('file:///'): # This one should be the full qualified path to the file and should get the contents of this file res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) assert b'_runner_test_various_file_slash' in res.data @@ -154,9 +154,9 @@ def test_xss(client, live_server, measure_memory_usage, datastore_path): live_server.app.config['DATASTORE'].data['watching'][uuid]['url']=XSS_HACK - res = client.get(url_for("ui.ui_views.preview_page", uuid=uuid)) + res = client.get(url_for("ui.ui_preview.preview_page", uuid=uuid)) assert XSS_HACK.encode('utf-8') not in res.data and res.status_code == 200 - client.get(url_for("ui.ui_views.diff_history_page", uuid=uuid)) + client.get(url_for("ui.ui_diff.diff_history_page", uuid=uuid)) assert XSS_HACK.encode('utf-8') not in res.data and res.status_code == 200 res = client.get(url_for("watchlist.index")) assert XSS_HACK.encode('utf-8') not in res.data and res.status_code == 200 diff --git a/changedetectionio/tests/test_source.py b/changedetectionio/tests/test_source.py index e79747524..14975c51b 100644 --- a/changedetectionio/tests/test_source.py +++ b/changedetectionio/tests/test_source.py @@ -22,7 +22,7 @@ def test_check_basic_change_detection_functionality_source(client, live_server, # Check HTML conversion detected and workd res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -43,7 +43,7 @@ def test_check_basic_change_detection_functionality_source(client, live_server, assert b'has-unread-changes' in res.data res = client.get( - url_for("ui.ui_views.diff_history_page", uuid="first"), + url_for("ui.ui_diff.diff_history_page", uuid="first"), follow_redirects=True ) # With diff-match-patch, HTML tags are properly tokenized and excluded from diff spans @@ -75,7 +75,7 @@ def test_check_ignore_elements(client, live_server, measure_memory_usage, datast time.sleep(sleep_time_for_fetch_thread) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) assert b'foobar-detection' not in res.data diff --git a/changedetectionio/tests/test_trigger.py b/changedetectionio/tests/test_trigger.py index 80491703f..25714d97e 100644 --- a/changedetectionio/tests/test_trigger.py +++ b/changedetectionio/tests/test_trigger.py @@ -96,7 +96,7 @@ def test_trigger_functionality(client, live_server, measure_memory_usage, datast # so that we set the state to 'has-unread-changes' after all the edits - client.get(url_for("ui.ui_views.diff_history_page", uuid="first")) + client.get(url_for("ui.ui_diff.diff_history_page", uuid="first")) # Trigger a check client.get(url_for("ui.form_watch_checknow"), follow_redirects=True) @@ -129,11 +129,11 @@ def test_trigger_functionality(client, live_server, measure_memory_usage, datast # https://github.com/dgtlmoon/changedetection.io/issues/616 # Apparently the actual snapshot that contains the trigger never shows - res = client.get(url_for("ui.ui_views.diff_history_page", uuid="first")) + res = client.get(url_for("ui.ui_diff.diff_history_page", uuid="first")) assert b'Add to cart' in res.data # Check the preview/highlighter, we should be able to see what we triggered on, but it should be highlighted - res = client.get(url_for("ui.ui_views.preview_page", uuid="first")) + res = client.get(url_for("ui.ui_preview.preview_page", uuid="first")) assert b'ignored_line_numbers = [8]' in res.data # We should be able to see what we triggered on diff --git a/changedetectionio/tests/test_trigger_regex.py b/changedetectionio/tests/test_trigger_regex.py index acadd10b8..c2cfed4aa 100644 --- a/changedetectionio/tests/test_trigger_regex.py +++ b/changedetectionio/tests/test_trigger_regex.py @@ -52,7 +52,7 @@ def test_trigger_regex_functionality(client, live_server, measure_memory_usage, ) wait_for_all_checks(client) # so that we set the state to 'has-unread-changes' after all the edits - client.get(url_for("ui.ui_views.diff_history_page", uuid="first")) + client.get(url_for("ui.ui_diff.diff_history_page", uuid="first")) with open(os.path.join(datastore_path, "endpoint-content.txt"), "w") as f: f.write("some new noise") diff --git a/changedetectionio/tests/test_trigger_regex_with_filter.py b/changedetectionio/tests/test_trigger_regex_with_filter.py index 339085518..e3b85aa56 100644 --- a/changedetectionio/tests/test_trigger_regex_with_filter.py +++ b/changedetectionio/tests/test_trigger_regex_with_filter.py @@ -55,7 +55,7 @@ def test_trigger_regex_functionality_with_filter(client, live_server, measure_me # Give the thread time to pick it up time.sleep(sleep_time_for_fetch_thread) - client.get(url_for("ui.ui_views.diff_history_page", uuid="first")) + client.get(url_for("ui.ui_diff.diff_history_page", uuid="first")) # Check that we have the expected text.. but it's not in the css filter we want with open(os.path.join(datastore_path, "endpoint-content.txt"), "w") as f: diff --git a/changedetectionio/tests/test_ui.py b/changedetectionio/tests/test_ui.py index 7243a837d..e3c9b3fe8 100644 --- a/changedetectionio/tests/test_ui.py +++ b/changedetectionio/tests/test_ui.py @@ -269,7 +269,7 @@ def test_ui_viewed_unread_flag(client, live_server, measure_memory_usage, datast assert res.data.count(b'data-watch-uuid') == 2 # one should now be viewed, but two in total still - client.get(url_for("ui.ui_views.diff_history_page", uuid="first")) + client.get(url_for("ui.ui_diff.diff_history_page", uuid="first")) res = client.get(url_for("watchlist.index")) assert b'1' in res.data assert res.data.count(b'data-watch-uuid') == 2 diff --git a/changedetectionio/tests/test_unique_lines.py b/changedetectionio/tests/test_unique_lines.py index 285d3117e..294578c87 100644 --- a/changedetectionio/tests/test_unique_lines.py +++ b/changedetectionio/tests/test_unique_lines.py @@ -152,7 +152,7 @@ def test_sort_lines_functionality(client, live_server, measure_memory_usage, dat assert b'has-unread-changes' in res.data res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -195,7 +195,7 @@ def test_extra_filters(client, live_server, measure_memory_usage, datastore_path wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first") + url_for("ui.ui_preview.preview_page", uuid="first") ) assert res.data.count(b"see what happens.") == 1 diff --git a/changedetectionio/tests/test_xpath_selector.py b/changedetectionio/tests/test_xpath_selector.py index e8eabf0e0..bc6372366 100644 --- a/changedetectionio/tests/test_xpath_selector.py +++ b/changedetectionio/tests/test_xpath_selector.py @@ -178,7 +178,7 @@ def test_check_xpath_text_function_utf8(client, live_server, measure_memory_usag # The service should echo back the request headers res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -214,7 +214,7 @@ def test_check_markup_xpath_filter_restriction(client, live_server, measure_memo wait_for_all_checks(client) # view it/reset state back to viewed - client.get(url_for("ui.ui_views.diff_history_page", uuid="first"), follow_redirects=True) + client.get(url_for("ui.ui_diff.diff_history_page", uuid="first"), follow_redirects=True) # Make a change set_modified_response(datastore_path=datastore_path) @@ -310,7 +310,7 @@ def test_xpath1_lxml(client, live_server, measure_memory_usage, datastore_path): assert b'_ElementStringResult' not in res.data # tested with 5.1.1 when it was removed and 5.1.0 assert b'Exception' not in res.data res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -359,7 +359,7 @@ def test_check_with_prefix_include_filters(client, live_server, measure_memory_u wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -437,7 +437,7 @@ def test_xpath_20(client, live_server, measure_memory_usage, datastore_path): wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -471,7 +471,7 @@ def test_xpath_20_function_count(client, live_server, measure_memory_usage, data wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -504,7 +504,7 @@ def test_xpath_20_function_count2(client, live_server, measure_memory_usage, dat wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) @@ -538,7 +538,7 @@ def test_xpath_20_function_string_join_matches(client, live_server, measure_memo wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid=uuid), + url_for("ui.ui_preview.preview_page", uuid=uuid), follow_redirects=True ) @@ -575,7 +575,7 @@ def _subtest_xpath_rss(client, datastore_path, content_type='text/html'): wait_for_all_checks(client) res = client.get( - url_for("ui.ui_views.preview_page", uuid="first"), + url_for("ui.ui_preview.preview_page", uuid="first"), follow_redirects=True ) diff --git a/changedetectionio/tests/visualselector/test_fetch_data.py b/changedetectionio/tests/visualselector/test_fetch_data.py index 2354e0510..f10519ae3 100644 --- a/changedetectionio/tests/visualselector/test_fetch_data.py +++ b/changedetectionio/tests/visualselector/test_fetch_data.py @@ -47,7 +47,7 @@ def test_visual_selector_content_ready(client, live_server, measure_memory_usage assert live_server.app.config['DATASTORE'].data['watching'][uuid].history_n >= 1, "Watch history had atleast 1 (everything fetched OK)" res = client.get( - url_for("ui.ui_views.preview_page", uuid=uuid), + url_for("ui.ui_preview.preview_page", uuid=uuid), follow_redirects=True ) assert b"testheader: yes" in res.data @@ -131,7 +131,7 @@ def test_basic_browserstep(client, live_server, measure_memory_usage, datastore_ # Check HTML conversion detected and workd res = client.get( - url_for("ui.ui_views.preview_page", uuid=uuid), + url_for("ui.ui_preview.preview_page", uuid=uuid), follow_redirects=True ) assert b"This text should be removed" not in res.data