diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index b81309d7..9285717a 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -943,34 +943,32 @@ def changedetection_app(config=None, datastore_o=None): return output timestamp = list(watch.history.keys())[-1] - filename = watch.history[timestamp] try: - with open(filename, 'r', encoding='utf-8', errors='ignore') as f: - tmp = f.readlines() + tmp = watch.get_history_snapshot(timestamp).splitlines() - # Get what needs to be highlighted - ignore_rules = watch.get('ignore_text', []) + datastore.data['settings']['application']['global_ignore_text'] + # Get what needs to be highlighted + ignore_rules = watch.get('ignore_text', []) + datastore.data['settings']['application']['global_ignore_text'] - # .readlines will keep the \n, but we will parse it here again, in the future tidy this up - ignored_line_numbers = html_tools.strip_ignore_text(content="".join(tmp), - wordlist=ignore_rules, - mode='line numbers' - ) + # .readlines will keep the \n, but we will parse it here again, in the future tidy this up + ignored_line_numbers = html_tools.strip_ignore_text(content="".join(tmp), + wordlist=ignore_rules, + mode='line numbers' + ) - trigger_line_numbers = html_tools.strip_ignore_text(content="".join(tmp), - wordlist=watch['trigger_text'], - mode='line numbers' - ) - # Prepare the classes and lines used in the template - i=0 - for l in tmp: - classes=[] - i+=1 - if i in ignored_line_numbers: - classes.append('ignored') - if i in trigger_line_numbers: - classes.append('triggered') - content.append({'line': l, 'classes': ' '.join(classes)}) + trigger_line_numbers = html_tools.strip_ignore_text(content="".join(tmp), + wordlist=watch['trigger_text'], + mode='line numbers' + ) + # Prepare the classes and lines used in the template + i=0 + for l in tmp: + classes=[] + i+=1 + if i in ignored_line_numbers: + classes.append('ignored') + if i in trigger_line_numbers: + classes.append('triggered') + content.append({'line': l, 'classes': ' '.join(classes)}) except Exception as e: content.append({'line': "File doesnt exist or unable to read file {}".format(filename), 'classes': ''}) diff --git a/changedetectionio/run_basic_tests.sh b/changedetectionio/run_basic_tests.sh index 9803d78d..70184051 100755 --- a/changedetectionio/run_basic_tests.sh +++ b/changedetectionio/run_basic_tests.sh @@ -28,3 +28,10 @@ pytest tests/test_notification.py # Re-run with HIDE_REFERER set - could affect login export HIDE_REFERER=True pytest tests/test_access_control.py + +# Re-run a few tests that will trigger brotli based storage +export SNAPSHOT_BROTLI_COMPRESSION_THRESHOLD=5 +pytest tests/test_access_control.py +pytest tests/test_notification.py +pytest tests/test_backend.py +pytest tests/test_rss.py