mirror of
				https://github.com/dgtlmoon/changedetection.io.git
				synced 2025-10-31 14:47:21 +00:00 
			
		
		
		
	Compare commits
	
		
			32 Commits
		
	
	
		
			exception-
			...
			fix-mark-a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 211c2a07df | ||
|   | b8e279a025 | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | 8041d00e75 | ||
|   | 6a0e14cfce | ||
|   | be91c5425c | ||
|   | 778680d517 | ||
|   | 7e8aa7e3ff | ||
|   | d77f913aa0 | ||
|   | 59cefe58e7 | ||
|   | cfc689e046 | ||
|   | 7b04b52e45 | ||
|   | f49eb4567f | ||
|   | a8959be348 | ||
|   | 05bf3c9a5c | ||
|   | 4293639f51 | ||
|   | f0ed4f64e8 | ||
|   | add2c658b4 | ||
|   | e27f66eb73 | ||
|   | e4504fee49 | ||
|   | 5798581f18 | ||
|   | ef910b86ef | ||
|   | 8d1fb96d18 | ||
|   | 5df5d0fbe7 | ||
|   | 815cba11ca | ||
|   | 3aed4e5af9 | ||
|   | 3618c389c6 | ||
|   | d127214d8f | ||
|   | c0f000b1d1 | ||
|   | ee5294740a | ||
|   | bd6eda696c | ||
|   | 1ba29655f5 | ||
|   | 830a0a3a82 | 
							
								
								
									
										1
									
								
								.github/workflows/test-only.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/workflows/test-only.yml
									
									
									
									
										vendored
									
									
								
							| @@ -59,6 +59,7 @@ jobs: | ||||
|           echo "run test with unittest" | ||||
|           docker run test-changedetectionio  bash -c 'python3 -m unittest changedetectionio.tests.unit.test_notification_diff' | ||||
|           docker run test-changedetectionio  bash -c 'python3 -m unittest changedetectionio.tests.unit.test_watch_model' | ||||
|           docker run test-changedetectionio  bash -c 'python3 -m unittest changedetectionio.tests.unit.test_jinja2_security' | ||||
|            | ||||
|           # All tests | ||||
|           echo "run test with pytest" | ||||
|   | ||||
| @@ -257,13 +257,7 @@ Supports managing the website watch list [via our API](https://changedetection.i | ||||
| Do you use changedetection.io to make money? does it save you time or money? Does it make your life easier? less stressful? Remember, we write this software when we should be doing actual paid work, we have to buy food and pay rent just like you. | ||||
|  | ||||
|  | ||||
| Firstly, consider taking out an officially supported [website change detection subscription](https://changedetection.io?src=github) , even if you don't use it, you still get the warm fuzzy feeling of helping out the project. (And who knows, you might just use it!) | ||||
|  | ||||
| Or directly donate an amount PayPal [](https://www.paypal.com/donate/?hosted_button_id=7CP6HR9ZCNDYJ) | ||||
|  | ||||
| Or BTC `1PLFN327GyUarpJd7nVe7Reqg9qHx5frNn` | ||||
|  | ||||
| <img src="https://raw.githubusercontent.com/dgtlmoon/changedetection.io/master/docs/btc-support.png" style="max-width:50%;" alt="Support us!"  /> | ||||
| Consider taking out an officially supported [website change detection subscription](https://changedetection.io?src=github) , even if you don't use it, you still get the warm fuzzy feeling of helping out the project. (And who knows, you might just use it!) | ||||
|  | ||||
| ## Commercial Support | ||||
|  | ||||
|   | ||||
| @@ -2,12 +2,12 @@ | ||||
|  | ||||
| # Read more https://github.com/dgtlmoon/changedetection.io/wiki | ||||
|  | ||||
| __version__ = '0.45.20' | ||||
| __version__ = '0.45.23' | ||||
|  | ||||
| from changedetectionio.strtobool import strtobool | ||||
| from json.decoder import JSONDecodeError | ||||
| import os | ||||
| #os.environ['EVENTLET_NO_GREENDNS'] = 'yes' | ||||
| os.environ['EVENTLET_NO_GREENDNS'] = 'yes' | ||||
| import eventlet | ||||
| import eventlet.wsgi | ||||
| import getopt | ||||
| @@ -175,6 +175,7 @@ def main(): | ||||
|     #         proxy_set_header Host "localhost"; | ||||
|     #         proxy_set_header X-Forwarded-Prefix /app; | ||||
|  | ||||
|  | ||||
|     if os.getenv('USE_X_SETTINGS'): | ||||
|         logger.info("USE_X_SETTINGS is ENABLED") | ||||
|         from werkzeug.middleware.proxy_fix import ProxyFix | ||||
|   | ||||
| @@ -84,7 +84,9 @@ def construct_blueprint(datastore: ChangeDetectionStore): | ||||
|         # Tell Playwright to connect to Chrome and setup a new session via our stepper interface | ||||
|         browsersteps_start_session['browserstepper'] = browser_steps.browsersteps_live_ui( | ||||
|             playwright_browser=browsersteps_start_session['browser'], | ||||
|             proxy=proxy) | ||||
|             proxy=proxy, | ||||
|             start_url=datastore.data['watching'][watch_uuid].get('url') | ||||
|         ) | ||||
|  | ||||
|         # For test | ||||
|         #browsersteps_start_session['browserstepper'].action_goto_url(value="http://example.com?time="+str(time.time())) | ||||
| @@ -167,11 +169,6 @@ def construct_blueprint(datastore: ChangeDetectionStore): | ||||
|             step_n = int(request.form.get('step_n')) | ||||
|             is_last_step = strtobool(request.form.get('is_last_step')) | ||||
|  | ||||
|             if step_operation == 'Goto site': | ||||
|                 step_operation = 'goto_url' | ||||
|                 step_optional_value = datastore.data['watching'][uuid].get('url') | ||||
|                 step_selector = None | ||||
|  | ||||
|             # @todo try.. accept.. nice errors not popups.. | ||||
|             try: | ||||
|  | ||||
|   | ||||
| @@ -7,6 +7,7 @@ from random import randint | ||||
| from loguru import logger | ||||
|  | ||||
| from changedetectionio.content_fetchers.base import manage_user_agent | ||||
| from changedetectionio.safe_jinja import render as jinja_render | ||||
|  | ||||
| # Two flags, tell the JS which of the "Selector" or "Value" field should be enabled in the front end | ||||
| # 0- off, 1- on | ||||
| @@ -48,6 +49,10 @@ browser_step_ui_config = {'Choose one': '0 0', | ||||
| # ONLY Works in Playwright because we need the fullscreen screenshot | ||||
| class steppable_browser_interface(): | ||||
|     page = None | ||||
|     start_url = None | ||||
|  | ||||
|     def __init__(self, start_url): | ||||
|         self.start_url = start_url | ||||
|  | ||||
|     # Convert and perform "Click Button" for example | ||||
|     def call_action(self, action_name, selector=None, optional_value=None): | ||||
| @@ -64,14 +69,12 @@ class steppable_browser_interface(): | ||||
|         action_handler = getattr(self, "action_" + call_action_name) | ||||
|  | ||||
|         # Support for Jinja2 variables in the value and selector | ||||
|         from jinja2 import Environment | ||||
|         jinja2_env = Environment(extensions=['jinja2_time.TimeExtension']) | ||||
|  | ||||
|         if selector and ('{%' in selector or '{{' in selector): | ||||
|             selector = str(jinja2_env.from_string(selector).render()) | ||||
|             selector = jinja_render(template_str=selector) | ||||
|  | ||||
|         if optional_value and ('{%' in optional_value or '{{' in optional_value): | ||||
|             optional_value = str(jinja2_env.from_string(optional_value).render()) | ||||
|             optional_value = jinja_render(template_str=optional_value) | ||||
|  | ||||
|         action_handler(selector, optional_value) | ||||
|         self.page.wait_for_timeout(1.5 * 1000) | ||||
| @@ -88,6 +91,10 @@ class steppable_browser_interface(): | ||||
|         logger.debug(f"Time to goto URL {time.time()-now:.2f}s") | ||||
|         return response | ||||
|  | ||||
|     # Incase they request to go back to the start | ||||
|     def action_goto_site(self, selector=None, value=None): | ||||
|         return self.action_goto_url(value=self.start_url) | ||||
|  | ||||
|     def action_click_element_containing_text(self, selector=None, value=''): | ||||
|         if not len(value.strip()): | ||||
|             return | ||||
| @@ -195,10 +202,11 @@ class browsersteps_live_ui(steppable_browser_interface): | ||||
|  | ||||
|     browser_type = os.getenv("PLAYWRIGHT_BROWSER_TYPE", 'chromium').strip('"') | ||||
|  | ||||
|     def __init__(self, playwright_browser, proxy=None, headers=None): | ||||
|     def __init__(self, playwright_browser, proxy=None, headers=None, start_url=None): | ||||
|         self.headers = headers or {} | ||||
|         self.age_start = time.time() | ||||
|         self.playwright_browser = playwright_browser | ||||
|         self.start_url = start_url | ||||
|         if self.context is None: | ||||
|             self.connect(proxy=proxy) | ||||
|  | ||||
|   | ||||
| @@ -31,9 +31,9 @@ def construct_blueprint(datastore: ChangeDetectionStore): | ||||
|         import time | ||||
|         from changedetectionio.content_fetchers import exceptions as content_fetcher_exceptions | ||||
|         from changedetectionio.processors import text_json_diff | ||||
|         from changedetectionio.safe_jinja import render as jinja_render | ||||
|  | ||||
|         status = {'status': '', 'length': 0, 'text': ''} | ||||
|         from jinja2 import Environment, BaseLoader | ||||
|  | ||||
|         contents = '' | ||||
|         now = time.time() | ||||
| @@ -64,7 +64,9 @@ def construct_blueprint(datastore: ChangeDetectionStore): | ||||
|             status.update({'status': 'OK', 'length': len(contents), 'text': ''}) | ||||
|  | ||||
|         if status.get('text'): | ||||
|             status['text'] = Environment(loader=BaseLoader()).from_string('{{text|e}}').render({'text': status['text']}) | ||||
|             # parse 'text' as text for safety | ||||
|             v = {'text': status['text']} | ||||
|             status['text'] = jinja_render(template_str='{{text|e}}', **v) | ||||
|  | ||||
|         status['time'] = "{:.2f}s".format(time.time() - now) | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| {% extends 'base.html' %} | ||||
| {% block content %} | ||||
| {% from '_helpers.jinja' import render_field, render_checkbox_field, render_button %} | ||||
| {% from '_common_fields.jinja' import render_common_settings_form %} | ||||
| {% from '_helpers.html' import render_field, render_checkbox_field, render_button %} | ||||
| {% from '_common_fields.html' import render_common_settings_form %} | ||||
| <script> | ||||
|     const notification_base_url="{{url_for('ajax_callback_send_notification_test', mode="group-settings")}}"; | ||||
| </script> | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| {% extends 'base.html' %} | ||||
| {% block content %} | ||||
| {% from '_helpers.jinja' import render_simple_field, render_field %} | ||||
| {% from '_helpers.html' import render_simple_field, render_field %} | ||||
| <script src="{{url_for('static_content', group='js', filename='jquery-3.6.0.min.js')}}"></script> | ||||
|  | ||||
| <div class="box"> | ||||
|   | ||||
| @@ -112,24 +112,26 @@ class Fetcher(): | ||||
|  | ||||
|     def browser_steps_get_valid_steps(self): | ||||
|         if self.browser_steps is not None and len(self.browser_steps): | ||||
|             valid_steps = filter( | ||||
|                 lambda s: (s['operation'] and len(s['operation']) and s['operation'] != 'Choose one' and s['operation'] != 'Goto site'), | ||||
|                 self.browser_steps) | ||||
|             valid_steps = list(filter( | ||||
|                 lambda s: (s['operation'] and len(s['operation']) and s['operation'] != 'Choose one'), | ||||
|                 self.browser_steps)) | ||||
|  | ||||
|             # Just incase they selected Goto site by accident with older JS | ||||
|             if valid_steps and valid_steps[0]['operation'] == 'Goto site': | ||||
|                 del(valid_steps[0]) | ||||
|  | ||||
|             return valid_steps | ||||
|  | ||||
|         return None | ||||
|  | ||||
|     def iterate_browser_steps(self): | ||||
|     def iterate_browser_steps(self, start_url=None): | ||||
|         from changedetectionio.blueprint.browser_steps.browser_steps import steppable_browser_interface | ||||
|         from playwright._impl._errors import TimeoutError, Error | ||||
|         from jinja2 import Environment | ||||
|         jinja2_env = Environment(extensions=['jinja2_time.TimeExtension']) | ||||
|  | ||||
|         from changedetectionio.safe_jinja import render as jinja_render | ||||
|         step_n = 0 | ||||
|  | ||||
|         if self.browser_steps is not None and len(self.browser_steps): | ||||
|             interface = steppable_browser_interface() | ||||
|             interface = steppable_browser_interface(start_url=start_url) | ||||
|             interface.page = self.page | ||||
|             valid_steps = self.browser_steps_get_valid_steps() | ||||
|  | ||||
| @@ -143,9 +145,9 @@ class Fetcher(): | ||||
|                     selector = step['selector'] | ||||
|                     # Support for jinja2 template in step values, with date module added | ||||
|                     if '{%' in step['optional_value'] or '{{' in step['optional_value']: | ||||
|                         optional_value = str(jinja2_env.from_string(step['optional_value']).render()) | ||||
|                         optional_value = jinja_render(template_str=step['optional_value']) | ||||
|                     if '{%' in step['selector'] or '{{' in step['selector']: | ||||
|                         selector = str(jinja2_env.from_string(step['selector']).render()) | ||||
|                         selector = jinja_render(template_str=step['selector']) | ||||
|  | ||||
|                     getattr(interface, "call_action")(action_name=step['operation'], | ||||
|                                                       selector=selector, | ||||
|   | ||||
| @@ -119,7 +119,7 @@ class fetcher(Fetcher): | ||||
|  | ||||
|             # Re-use as much code from browser steps as possible so its the same | ||||
|             from changedetectionio.blueprint.browser_steps.browser_steps import steppable_browser_interface | ||||
|             browsersteps_interface = steppable_browser_interface() | ||||
|             browsersteps_interface = steppable_browser_interface(start_url=url) | ||||
|             browsersteps_interface.page = self.page | ||||
|  | ||||
|             response = browsersteps_interface.action_goto_url(value=url) | ||||
| @@ -172,7 +172,7 @@ class fetcher(Fetcher): | ||||
|  | ||||
|             # Run Browser Steps here | ||||
|             if self.browser_steps_get_valid_steps(): | ||||
|                 self.iterate_browser_steps() | ||||
|                 self.iterate_browser_steps(start_url=url) | ||||
|  | ||||
|             self.page.wait_for_timeout(extra_wait * 1000) | ||||
|  | ||||
|   | ||||
| @@ -9,7 +9,6 @@ from loguru import logger | ||||
| from changedetectionio.content_fetchers.base import Fetcher, manage_user_agent | ||||
| from changedetectionio.content_fetchers.exceptions import PageUnloadable, Non200ErrorCodeReceived, EmptyReply, BrowserFetchTimedOut, BrowserConnectError | ||||
|  | ||||
|  | ||||
| class fetcher(Fetcher): | ||||
|     fetcher_description = "Puppeteer/direct {}/Javascript".format( | ||||
|         os.getenv("PLAYWRIGHT_BROWSER_TYPE", 'chromium').capitalize() | ||||
| @@ -93,15 +92,39 @@ class fetcher(Fetcher): | ||||
|                                                        ignoreHTTPSErrors=True | ||||
|                                                        ) | ||||
|         except websockets.exceptions.InvalidStatusCode as e: | ||||
|             raise BrowserConnectError(msg=f"Error while trying to connect the browser, Code {e.status_code} (check your access)") | ||||
|             raise BrowserConnectError(msg=f"Error while trying to connect the browser, Code {e.status_code} (check your access, whitelist IP, password etc)") | ||||
|         except websockets.exceptions.InvalidURI: | ||||
|             raise BrowserConnectError(msg=f"Error connecting to the browser, check your browser connection address (should be ws:// or wss://") | ||||
|         except Exception as e: | ||||
|             raise BrowserConnectError(msg=f"Error connecting to the browser {str(e)}") | ||||
|         else: | ||||
|             self.page = await browser.newPage() | ||||
|  | ||||
|         await self.page.setUserAgent(manage_user_agent(headers=request_headers, current_ua=await self.page.evaluate('navigator.userAgent'))) | ||||
|         # Better is to launch chrome with the URL as arg | ||||
|         # non-headless - newPage() will launch an extra tab/window, .browser should already contain 1 page/tab | ||||
|         # headless - ask a new page | ||||
|         self.page = (pages := await browser.pages) and len(pages) or await browser.newPage() | ||||
|  | ||||
|         try: | ||||
|             from pyppeteerstealth import inject_evasions_into_page | ||||
|         except ImportError: | ||||
|             logger.debug("pyppeteerstealth module not available, skipping") | ||||
|             pass | ||||
|         else: | ||||
|             # I tried hooking events via self.page.on(Events.Page.DOMContentLoaded, inject_evasions_requiring_obj_to_page) | ||||
|             # But I could never get it to fire reliably, so we just inject it straight after | ||||
|             await inject_evasions_into_page(self.page) | ||||
|  | ||||
|         # This user agent is similar to what was used when tweaking the evasions in inject_evasions_into_page(..) | ||||
|         user_agent = None | ||||
|         if request_headers: | ||||
|             user_agent = next((value for key, value in request_headers.items() if key.lower().strip() == 'user-agent'), None) | ||||
|             if user_agent: | ||||
|                 await self.page.setUserAgent(user_agent) | ||||
|                 # Remove it so it's not sent again with headers after | ||||
|                 [request_headers.pop(key) for key in list(request_headers) if key.lower().strip() == 'user-agent'.lower().strip()] | ||||
|  | ||||
|         if not user_agent: | ||||
|             # Attempt to strip 'HeadlessChrome' etc | ||||
|             await self.page.setUserAgent(manage_user_agent(headers=request_headers, current_ua=await self.page.evaluate('navigator.userAgent'))) | ||||
|  | ||||
|         await self.page.setBypassCSP(True) | ||||
|         if request_headers: | ||||
|   | ||||
| @@ -30,11 +30,6 @@ class fetcher(Fetcher): | ||||
|         if self.browser_steps_get_valid_steps(): | ||||
|             raise BrowserStepsInUnsupportedFetcher(url=url) | ||||
|  | ||||
|         # Make requests use a more modern looking user-agent | ||||
|         if not {k.lower(): v for k, v in request_headers.items()}.get('user-agent', None): | ||||
|             request_headers['User-Agent'] = os.getenv("DEFAULT_SETTINGS_HEADERS_USERAGENT", | ||||
|                                                       'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36') | ||||
|  | ||||
|         proxies = {} | ||||
|  | ||||
|         # Allows override the proxy on a per-request basis | ||||
|   | ||||
| @@ -5,11 +5,11 @@ import os | ||||
| import queue | ||||
| import threading | ||||
| import time | ||||
| from copy import deepcopy | ||||
| from .safe_jinja import render as jinja_render | ||||
| from changedetectionio.strtobool import strtobool | ||||
| from copy import deepcopy | ||||
| from functools import wraps | ||||
| from threading import Event | ||||
|  | ||||
| import flask_login | ||||
| import pytz | ||||
| import timeago | ||||
| @@ -124,10 +124,10 @@ def _jinja2_filter_datetime(watch_obj, format="%Y-%m-%d %H:%M:%S"): | ||||
|  | ||||
| @app.template_filter('format_timestamp_timeago') | ||||
| def _jinja2_filter_datetimestamp(timestamp, format="%Y-%m-%d %H:%M:%S"): | ||||
|     if timestamp == False: | ||||
|     if not timestamp: | ||||
|         return 'Not yet' | ||||
|  | ||||
|     return timeago.format(timestamp, time.time()) | ||||
|     return timeago.format(int(timestamp), time.time()) | ||||
|  | ||||
|  | ||||
| @app.template_filter('pagination_slice') | ||||
| @@ -319,8 +319,6 @@ def changedetection_app(config=None, datastore_o=None): | ||||
|  | ||||
|     @app.route("/rss", methods=['GET']) | ||||
|     def rss(): | ||||
|         from jinja2 import Environment, BaseLoader | ||||
|         jinja2_env = Environment(loader=BaseLoader) | ||||
|         now = time.time() | ||||
|         # Always requires token set | ||||
|         app_rss_token = datastore.data['settings']['application'].get('rss_access_token') | ||||
| @@ -340,8 +338,11 @@ 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'): | ||||
|                 continue | ||||
|             if limit_tag and not limit_tag in watch['tags']: | ||||
|                     continue | ||||
|                 continue | ||||
|             watch['uuid'] = uuid | ||||
|             sorted_watches.append(watch) | ||||
|  | ||||
| @@ -388,7 +389,7 @@ def changedetection_app(config=None, datastore_o=None): | ||||
|                 # @todo Make this configurable and also consider html-colored markup | ||||
|                 # @todo User could decide if <link> goes to the diff page, or to the watch link | ||||
|                 rss_template = "<html><body>\n<h4><a href=\"{{watch_url}}\">{{watch_title}}</a></h4>\n<p>{{html_diff}}</p>\n</body></html>\n" | ||||
|                 content = jinja2_env.from_string(rss_template).render(watch_title=watch_title, html_diff=html_diff, watch_url=watch.link) | ||||
|                 content = jinja_render(template_str=rss_template, watch_title=watch_title, html_diff=html_diff, watch_url=watch.link) | ||||
|  | ||||
|                 fe.content(content=content, type='CDATA') | ||||
|  | ||||
| @@ -452,6 +453,8 @@ def changedetection_app(config=None, datastore_o=None): | ||||
|             if search_q: | ||||
|                 if (watch.get('title') and search_q in watch.get('title').lower()) or search_q in watch.get('url', '').lower(): | ||||
|                     sorted_watches.append(watch) | ||||
|                 elif watch.get('last_error') and search_q in watch.get('last_error').lower(): | ||||
|                     sorted_watches.append(watch) | ||||
|             else: | ||||
|                 sorted_watches.append(watch) | ||||
|  | ||||
| @@ -619,7 +622,6 @@ def changedetection_app(config=None, datastore_o=None): | ||||
|         from .blueprint.browser_steps.browser_steps import browser_step_ui_config | ||||
|         from . import processors | ||||
|  | ||||
|         using_default_check_time = True | ||||
|         # More for testing, possible to return the first/only | ||||
|         if not datastore.data['watching'].keys(): | ||||
|             flash("No watches to edit", "error") | ||||
| @@ -644,10 +646,6 @@ def changedetection_app(config=None, datastore_o=None): | ||||
|         # be sure we update with a copy instead of accidently editing the live object by reference | ||||
|         default = deepcopy(datastore.data['watching'][uuid]) | ||||
|  | ||||
|         # Show system wide default if nothing configured | ||||
|         if all(value == 0 or value == None for value in datastore.data['watching'][uuid]['time_between_check'].values()): | ||||
|             default['time_between_check'] = deepcopy(datastore.data['settings']['requests']['time_between_check']) | ||||
|  | ||||
|         # Defaults for proxy choice | ||||
|         if datastore.proxy_list is not None:  # When enabled | ||||
|             # @todo | ||||
| @@ -685,18 +683,8 @@ def changedetection_app(config=None, datastore_o=None): | ||||
|  | ||||
|             if request.args.get('unpause_on_save'): | ||||
|                 extra_update_obj['paused'] = False | ||||
|             # Re #110, if they submit the same as the default value, set it to None, so we continue to follow the default | ||||
|             # Assume we use the default value, unless something relevant is different, then use the form value | ||||
|             # values could be None, 0 etc. | ||||
|             # Set to None unless the next for: says that something is different | ||||
|             extra_update_obj['time_between_check'] = dict.fromkeys(form.time_between_check.data) | ||||
|             for k, v in form.time_between_check.data.items(): | ||||
|                 if v and v != datastore.data['settings']['requests']['time_between_check'][k]: | ||||
|                     extra_update_obj['time_between_check'] = form.time_between_check.data | ||||
|                     using_default_check_time = False | ||||
|                     break | ||||
|  | ||||
|  | ||||
|             extra_update_obj['time_between_check'] = form.time_between_check.data | ||||
|  | ||||
|              # Ignore text | ||||
|             form_ignore_text = form.ignore_text.data | ||||
| @@ -777,14 +765,13 @@ def changedetection_app(config=None, datastore_o=None): | ||||
|                                      extra_title=f" - Edit - {watch.label}", | ||||
|                                      form=form, | ||||
|                                      has_default_notification_urls=True if len(datastore.data['settings']['application']['notification_urls']) else False, | ||||
|                                      has_empty_checktime=using_default_check_time, | ||||
|                                      has_extra_headers_file=len(datastore.get_all_headers_in_textfile_for_watch(uuid=uuid)) > 0, | ||||
|                                      has_special_tag_options=_watch_has_tag_options_set(watch=watch), | ||||
|                                      is_html_webdriver=is_html_webdriver, | ||||
|                                      jq_support=jq_support, | ||||
|                                      playwright_enabled=os.getenv('PLAYWRIGHT_DRIVER_URL', False), | ||||
|                                      settings_application=datastore.data['settings']['application'], | ||||
|                                      using_global_webdriver_wait=default['webdriver_delay'] is None, | ||||
|                                      using_global_webdriver_wait=not default['webdriver_delay'], | ||||
|                                      uuid=uuid, | ||||
|                                      visualselector_enabled=visualselector_enabled, | ||||
|                                      watch=watch | ||||
| @@ -863,11 +850,13 @@ def changedetection_app(config=None, datastore_o=None): | ||||
|                 flash("An error occurred, please see below.", "error") | ||||
|  | ||||
|         output = render_template("settings.html", | ||||
|                                  form=form, | ||||
|                                  hide_remove_pass=os.getenv("SALTED_PASS", False), | ||||
|                                  api_key=datastore.data['settings']['application'].get('api_access_token'), | ||||
|                                  emailprefix=os.getenv('NOTIFICATION_MAIL_BUTTON_PREFIX', False), | ||||
|                                  settings_application=datastore.data['settings']['application']) | ||||
|                                  form=form, | ||||
|                                  hide_remove_pass=os.getenv("SALTED_PASS", False), | ||||
|                                  min_system_recheck_seconds=int(os.getenv('MINIMUM_SECONDS_RECHECK_TIME', 3)), | ||||
|                                  settings_application=datastore.data['settings']['application'] | ||||
|                                  ) | ||||
|  | ||||
|         return output | ||||
|  | ||||
| @@ -1077,6 +1066,8 @@ def changedetection_app(config=None, datastore_o=None): | ||||
|         content = [] | ||||
|         ignored_line_numbers = [] | ||||
|         trigger_line_numbers = [] | ||||
|         versions = [] | ||||
|         timestamp = None | ||||
|  | ||||
|         # More for testing, possible to return the first/only | ||||
|         if uuid == 'first': | ||||
| @@ -1096,57 +1087,53 @@ def changedetection_app(config=None, datastore_o=None): | ||||
|         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 | ||||
|  | ||||
|         # Never requested successfully, but we detected a fetch error | ||||
|         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") | ||||
|             output = render_template("preview.html", | ||||
|                                      content=content, | ||||
|                                      history_n=watch.history_n, | ||||
|                                      extra_stylesheets=extra_stylesheets, | ||||
| #                                     current_diff_url=watch['url'], | ||||
|                                      watch=watch, | ||||
|                                      uuid=uuid, | ||||
|                                      is_html_webdriver=is_html_webdriver, | ||||
|                                      last_error=watch['last_error'], | ||||
|                                      last_error_text=watch.get_error_text(), | ||||
|                                      last_error_screenshot=watch.get_error_snapshot()) | ||||
|             return output | ||||
|         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 | ||||
|  | ||||
|         timestamp = list(watch.history.keys())[-1] | ||||
|         try: | ||||
|             tmp = watch.get_history_snapshot(timestamp).splitlines() | ||||
|             try: | ||||
|                 versions = list(watch.history.keys()) | ||||
|                 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="\n".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="\n".join(tmp), | ||||
|                                                                     wordlist=ignore_rules, | ||||
|                                                                     mode='line numbers' | ||||
|                                                                     ) | ||||
|  | ||||
|             trigger_line_numbers = html_tools.strip_ignore_text(content="\n".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="\n".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': f"File doesnt exist or unable to read timestamp {timestamp}", 'classes': ''}) | ||||
|             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_version=timestamp, | ||||
|                                  history_n=watch.history_n, | ||||
|                                  extra_stylesheets=extra_stylesheets, | ||||
|                                  extra_title=f" - Diff - {watch.label} @ {timestamp}", | ||||
|                                  ignored_line_numbers=ignored_line_numbers, | ||||
|                                  triggered_line_numbers=trigger_line_numbers, | ||||
|                                  current_diff_url=watch['url'], | ||||
| @@ -1156,7 +1143,10 @@ def changedetection_app(config=None, datastore_o=None): | ||||
|                                  is_html_webdriver=is_html_webdriver, | ||||
|                                  last_error=watch['last_error'], | ||||
|                                  last_error_text=watch.get_error_text(), | ||||
|                                  last_error_screenshot=watch.get_error_snapshot()) | ||||
|                                  last_error_screenshot=watch.get_error_snapshot(), | ||||
|                                  versions=versions | ||||
|                                 ) | ||||
|  | ||||
|  | ||||
|         return output | ||||
|  | ||||
| @@ -1668,14 +1658,14 @@ def notification_runner(): | ||||
|             # Trim the log length | ||||
|             notification_debug_log = notification_debug_log[-100:] | ||||
|  | ||||
| # Thread runner to check every minute, look for new watches to feed into the Queue. | ||||
| # Threaded runner, look for new watches to feed into the Queue. | ||||
| def ticker_thread_check_time_launch_checks(): | ||||
|     import random | ||||
|     from changedetectionio import update_worker | ||||
|  | ||||
|     proxy_last_called_time = {} | ||||
|  | ||||
|     recheck_time_minimum_seconds = int(os.getenv('MINIMUM_SECONDS_RECHECK_TIME', 20)) | ||||
|     recheck_time_minimum_seconds = int(os.getenv('MINIMUM_SECONDS_RECHECK_TIME', 3)) | ||||
|     logger.debug(f"System env MINIMUM_SECONDS_RECHECK_TIME {recheck_time_minimum_seconds}") | ||||
|  | ||||
|     # Spin up Workers that do the fetching | ||||
| @@ -1729,9 +1719,7 @@ def ticker_thread_check_time_launch_checks(): | ||||
|                 continue | ||||
|  | ||||
|             # If they supplied an individual entry minutes to threshold. | ||||
|  | ||||
|             watch_threshold_seconds = watch.threshold_seconds() | ||||
|             threshold = watch_threshold_seconds if watch_threshold_seconds > 0 else recheck_time_system_seconds | ||||
|             threshold = recheck_time_system_seconds if watch.get('time_between_check_use_default') else watch.threshold_seconds() | ||||
|  | ||||
|             # #580 - Jitter plus/minus amount of time to make the check seem more random to the server | ||||
|             jitter = datastore.data['settings']['requests'].get('jitter_seconds', 0) | ||||
|   | ||||
| @@ -236,21 +236,26 @@ class ValidateJinja2Template(object): | ||||
|     def __call__(self, form, field): | ||||
|         from changedetectionio import notification | ||||
|  | ||||
|         from jinja2 import Environment, BaseLoader, TemplateSyntaxError, UndefinedError | ||||
|         from jinja2 import BaseLoader, TemplateSyntaxError, UndefinedError | ||||
|         from jinja2.sandbox import ImmutableSandboxedEnvironment | ||||
|         from jinja2.meta import find_undeclared_variables | ||||
|         import jinja2.exceptions | ||||
|  | ||||
|         # Might be a list of text, or might be just text (like from the apprise url list) | ||||
|         joined_data = ' '.join(map(str, field.data)) if isinstance(field.data, list) else f"{field.data}" | ||||
|  | ||||
|         try: | ||||
|             jinja2_env = Environment(loader=BaseLoader) | ||||
|             jinja2_env = ImmutableSandboxedEnvironment(loader=BaseLoader) | ||||
|             jinja2_env.globals.update(notification.valid_tokens) | ||||
|  | ||||
|             rendered = jinja2_env.from_string(field.data).render() | ||||
|             jinja2_env.from_string(joined_data).render() | ||||
|         except TemplateSyntaxError as e: | ||||
|             raise ValidationError(f"This is not a valid Jinja2 template: {e}") from e | ||||
|         except UndefinedError as e: | ||||
|             raise ValidationError(f"A variable or function is not defined: {e}") from e | ||||
|         except jinja2.exceptions.SecurityError as e: | ||||
|             raise ValidationError(f"This is not a valid Jinja2 template: {e}") from e | ||||
|  | ||||
|         ast = jinja2_env.parse(field.data) | ||||
|         ast = jinja2_env.parse(joined_data) | ||||
|         undefined = ", ".join(find_undeclared_variables(ast)) | ||||
|         if undefined: | ||||
|             raise ValidationError( | ||||
| @@ -415,7 +420,7 @@ class quickWatchForm(Form): | ||||
| # Common to a single watch and the global settings | ||||
| class commonSettingsForm(Form): | ||||
|  | ||||
|     notification_urls = StringListField('Notification URL List', validators=[validators.Optional(), ValidateAppRiseServers()]) | ||||
|     notification_urls = StringListField('Notification URL List', validators=[validators.Optional(), ValidateAppRiseServers(), ValidateJinja2Template()]) | ||||
|     notification_title = StringField('Notification Title', default='ChangeDetection.io Notification - {{ watch_url }}', validators=[validators.Optional(), ValidateJinja2Template()]) | ||||
|     notification_body = TextAreaField('Notification Body', default='{{ watch_url }} had a change.', validators=[validators.Optional(), ValidateJinja2Template()]) | ||||
|     notification_format = SelectField('Notification format', choices=valid_notification_formats.keys()) | ||||
| @@ -448,6 +453,7 @@ class watchForm(commonSettingsForm): | ||||
|     tags = StringTagUUID('Group tag', [validators.Optional()], default='') | ||||
|  | ||||
|     time_between_check = FormField(TimeBetweenCheckForm) | ||||
|     time_between_check_use_default = BooleanField('Use global settings for time between check', default=False) | ||||
|  | ||||
|     include_filters = StringListField('CSS/JSONPath/JQ/XPath Filters', [ValidateCSSJSONXPATHInput()], default='') | ||||
|  | ||||
| @@ -499,11 +505,9 @@ class watchForm(commonSettingsForm): | ||||
|             result = False | ||||
|  | ||||
|         # Attempt to validate jinja2 templates in the URL | ||||
|         from jinja2 import Environment | ||||
|         # Jinja2 available in URLs along with https://pypi.org/project/jinja2-time/ | ||||
|         jinja2_env = Environment(extensions=['jinja2_time.TimeExtension']) | ||||
|         try: | ||||
|             ready_url = str(jinja2_env.from_string(self.url.data).render()) | ||||
|             from changedetectionio.safe_jinja import render as jinja_render | ||||
|             jinja_render(template_str=self.url.data) | ||||
|         except Exception as e: | ||||
|             self.url.errors.append('Invalid template syntax') | ||||
|             result = False | ||||
| @@ -522,6 +526,10 @@ class SingleExtraBrowser(Form): | ||||
|     browser_connection_url = StringField('Browser connection URL', [validators.Optional()], render_kw={"placeholder": "wss://brightdata... wss://oxylabs etc", "size":50}) | ||||
|     # @todo do the validation here instead | ||||
|  | ||||
| class DefaultUAInputForm(Form): | ||||
|     html_requests = StringField('Plaintext requests', validators=[validators.Optional()], render_kw={"placeholder": "<default>"}) | ||||
|     if os.getenv("PLAYWRIGHT_DRIVER_URL") or os.getenv("WEBDRIVER_URL"): | ||||
|         html_webdriver = StringField('Chrome requests', validators=[validators.Optional()], render_kw={"placeholder": "<default>"}) | ||||
|  | ||||
| # datastore.data['settings']['requests'].. | ||||
| class globalSettingsRequestForm(Form): | ||||
| @@ -533,6 +541,8 @@ class globalSettingsRequestForm(Form): | ||||
|     extra_proxies = FieldList(FormField(SingleExtraProxy), min_entries=5) | ||||
|     extra_browsers = FieldList(FormField(SingleExtraBrowser), min_entries=5) | ||||
|  | ||||
|     default_ua = FormField(DefaultUAInputForm, label="Default User-Agent overrides") | ||||
|  | ||||
|     def validate_extra_proxies(self, extra_validators=None): | ||||
|         for e in self.data['extra_proxies']: | ||||
|             if e.get('proxy_name') or e.get('proxy_url'): | ||||
|   | ||||
| @@ -6,6 +6,7 @@ from changedetectionio.notification import ( | ||||
| ) | ||||
|  | ||||
| _FILTER_FAILURE_THRESHOLD_ATTEMPTS_DEFAULT = 6 | ||||
| DEFAULT_SETTINGS_HEADERS_USERAGENT='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36' | ||||
|  | ||||
| class model(dict): | ||||
|     base_config = { | ||||
| @@ -22,6 +23,10 @@ class model(dict): | ||||
|                     'time_between_check': {'weeks': None, 'days': None, 'hours': 3, 'minutes': None, 'seconds': None}, | ||||
|                     'timeout': int(getenv("DEFAULT_SETTINGS_REQUESTS_TIMEOUT", "45")),  # Default 45 seconds | ||||
|                     'workers': int(getenv("DEFAULT_SETTINGS_REQUESTS_WORKERS", "10")),  # Number of threads, lower is better for slow connections | ||||
|                     'default_ua': { | ||||
|                         'html_requests': getenv("DEFAULT_SETTINGS_HEADERS_USERAGENT", DEFAULT_SETTINGS_HEADERS_USERAGENT), | ||||
|                         'html_webdriver': None, | ||||
|                     } | ||||
|                 }, | ||||
|                 'application': { | ||||
|                     # Custom notification content | ||||
|   | ||||
| @@ -1,4 +1,6 @@ | ||||
| from changedetectionio.strtobool import strtobool | ||||
| from changedetectionio.safe_jinja import render as jinja_render | ||||
|  | ||||
| import os | ||||
| import re | ||||
| import time | ||||
| @@ -10,7 +12,7 @@ from loguru import logger | ||||
| # file:// is further checked by ALLOW_FILE_URI | ||||
| SAFE_PROTOCOL_REGEX='^(http|https|ftp|file):' | ||||
|  | ||||
| minimum_seconds_recheck_time = int(os.getenv('MINIMUM_SECONDS_RECHECK_TIME', 60)) | ||||
| minimum_seconds_recheck_time = int(os.getenv('MINIMUM_SECONDS_RECHECK_TIME', 3)) | ||||
| mtable = {'seconds': 1, 'minutes': 60, 'hours': 3600, 'days': 86400, 'weeks': 86400 * 7} | ||||
|  | ||||
| from changedetectionio.notification import ( | ||||
| @@ -67,6 +69,7 @@ base_config = { | ||||
|     # Requires setting to None on submit if it's the same as the default | ||||
|     # Should be all None by default, so we use the system default in this case. | ||||
|     'time_between_check': {'weeks': None, 'days': None, 'hours': None, 'minutes': None, 'seconds': None}, | ||||
|     'time_between_check_use_default': True, | ||||
|     'title': None, | ||||
|     'trigger_text': [],  # List of text or regex to wait for until a change is detected | ||||
|     'url': '', | ||||
| @@ -137,12 +140,11 @@ class model(dict): | ||||
|  | ||||
|         ready_url = url | ||||
|         if '{%' in url or '{{' in url: | ||||
|             from jinja2 import Environment | ||||
|             # Jinja2 available in URLs along with https://pypi.org/project/jinja2-time/ | ||||
|             jinja2_env = Environment(extensions=['jinja2_time.TimeExtension']) | ||||
|             try: | ||||
|                 ready_url = str(jinja2_env.from_string(url).render()) | ||||
|                 ready_url = jinja_render(template_str=url) | ||||
|             except Exception as e: | ||||
|                 logger.critical(f"Invalid URL template for: '{url}' - {str(e)}") | ||||
|                 from flask import ( | ||||
|                     flash, Markup, url_for | ||||
|                 ) | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| import apprise | ||||
| import time | ||||
| from jinja2 import Environment, BaseLoader | ||||
| from apprise import NotifyFormat | ||||
| import json | ||||
| from loguru import logger | ||||
| @@ -49,7 +48,7 @@ from apprise.decorators import notify | ||||
| def apprise_custom_api_call_wrapper(body, title, notify_type, *args, **kwargs): | ||||
|     import requests | ||||
|     from apprise.utils import parse_url as apprise_parse_url | ||||
|     from apprise.URLBase import URLBase | ||||
|     from apprise import URLBase | ||||
|  | ||||
|     url = kwargs['meta'].get('url') | ||||
|  | ||||
| @@ -116,16 +115,13 @@ def apprise_custom_api_call_wrapper(body, title, notify_type, *args, **kwargs): | ||||
|  | ||||
| def process_notification(n_object, datastore): | ||||
|  | ||||
|     from .safe_jinja import render as jinja_render | ||||
|     now = time.time() | ||||
|     if n_object.get('notification_timestamp'): | ||||
|         logger.trace(f"Time since queued {now-n_object['notification_timestamp']:.3f}s") | ||||
|     # Insert variables into the notification content | ||||
|     notification_parameters = create_notification_parameters(n_object, datastore) | ||||
|  | ||||
|     # Get the notification body from datastore | ||||
|     jinja2_env = Environment(loader=BaseLoader) | ||||
|     n_body = jinja2_env.from_string(n_object.get('notification_body', '')).render(**notification_parameters) | ||||
|     n_title = jinja2_env.from_string(n_object.get('notification_title', '')).render(**notification_parameters) | ||||
|     n_format = valid_notification_formats.get( | ||||
|         n_object.get('notification_format', default_notification_format), | ||||
|         valid_notification_formats[default_notification_format], | ||||
| @@ -151,13 +147,18 @@ def process_notification(n_object, datastore): | ||||
|  | ||||
|     with apprise.LogCapture(level=apprise.logging.DEBUG) as logs: | ||||
|         for url in n_object['notification_urls']: | ||||
|  | ||||
|             # Get the notification body from datastore | ||||
|             n_body = jinja_render(template_str=n_object.get('notification_body', ''), **notification_parameters) | ||||
|             n_title = jinja_render(template_str=n_object.get('notification_title', ''), **notification_parameters) | ||||
|  | ||||
|             url = url.strip() | ||||
|             if not url: | ||||
|                 logger.warning(f"Process Notification: skipping empty notification URL.") | ||||
|                 continue | ||||
|  | ||||
|             logger.info(">> Process Notification: AppRise notifying {}".format(url)) | ||||
|             url = jinja2_env.from_string(url).render(**notification_parameters) | ||||
|             url = jinja_render(template_str=url, **notification_parameters) | ||||
|  | ||||
|             # Re 323 - Limit discord length to their 2000 char limit total or it wont send. | ||||
|             # Because different notifications may require different pre-processing, run each sequentially :( | ||||
|   | ||||
| @@ -97,6 +97,10 @@ class difference_detection_processor(): | ||||
|         request_headers.update(self.datastore.get_all_base_headers()) | ||||
|         request_headers.update(self.datastore.get_all_headers_in_textfile_for_watch(uuid=self.watch.get('uuid'))) | ||||
|  | ||||
|         ua = self.datastore.data['settings']['requests'].get('default_ua') | ||||
|         if ua and ua.get(prefer_fetch_backend): | ||||
|             request_headers.update({'User-Agent': ua.get(prefer_fetch_backend)}) | ||||
|  | ||||
|         # https://github.com/psf/requests/issues/4525 | ||||
|         # Requests doesnt yet support brotli encoding, so don't put 'br' here, be totally sure that the user cannot | ||||
|         # do this by accident. | ||||
|   | ||||
							
								
								
									
										18
									
								
								changedetectionio/safe_jinja.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								changedetectionio/safe_jinja.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| """ | ||||
| Safe Jinja2 render with max payload sizes | ||||
|  | ||||
| See https://jinja.palletsprojects.com/en/3.1.x/sandbox/#security-considerations | ||||
| """ | ||||
|  | ||||
| import jinja2.sandbox | ||||
| import typing as t | ||||
| import os | ||||
|  | ||||
| JINJA2_MAX_RETURN_PAYLOAD_SIZE = 1024 * int(os.getenv("JINJA2_MAX_RETURN_PAYLOAD_SIZE_KB", 1024 * 10)) | ||||
|  | ||||
|  | ||||
| def render(template_str, **args: t.Any) -> str: | ||||
|     jinja2_env = jinja2.sandbox.ImmutableSandboxedEnvironment(extensions=['jinja2_time.TimeExtension']) | ||||
|     output = jinja2_env.from_string(template_str).render(args) | ||||
|     return output[:JINJA2_MAX_RETURN_PAYLOAD_SIZE] | ||||
|  | ||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 22 KiB | 
| @@ -26,7 +26,8 @@ $(document).ready(function () { | ||||
|         set_scale(); | ||||
|     }); | ||||
|     // Should always be disabled | ||||
|     $('#browser_steps >li:first-child select').val('Goto site').attr('disabled', 'disabled'); | ||||
|     $('#browser_steps-0-operation option[value="Goto site"]').prop("selected", "selected"); | ||||
|     $('#browser_steps-0-operation').attr('disabled', 'disabled'); | ||||
|  | ||||
|     $('#browsersteps-click-start').click(function () { | ||||
|         $("#browsersteps-click-start").fadeOut(); | ||||
|   | ||||
| @@ -8,6 +8,13 @@ $(document).ready(function () { | ||||
|         } | ||||
|     }) | ||||
|  | ||||
|     $('.needs-localtime').each(function () { | ||||
|         for (var option of this.options) { | ||||
|             var dateObject = new Date(option.value * 1000); | ||||
|             option.label = dateObject.toLocaleString(undefined, {dateStyle: "full", timeStyle: "medium"}); | ||||
|         } | ||||
|     }); | ||||
|  | ||||
|     // Load it when the #screenshot tab is in use, so we dont give a slow experience when waiting for the text diff to load | ||||
|     window.addEventListener('hashchange', function (e) { | ||||
|         toggle(location.hash); | ||||
|   | ||||
| @@ -79,12 +79,7 @@ $(document).ready(function () { | ||||
|         $('#jump-next-diff').click(); | ||||
|     } | ||||
|  | ||||
|     $('.needs-localtime').each(function () { | ||||
|         for (var option of this.options) { | ||||
|             var dateObject = new Date(option.value * 1000); | ||||
|             option.label = dateObject.toLocaleString(undefined, {dateStyle: "full", timeStyle: "medium"}); | ||||
|         } | ||||
|     }) | ||||
|  | ||||
|     onDiffTypeChange( | ||||
|         document.querySelector('#settings [name="diff_type"]:checked'), | ||||
|     ); | ||||
|   | ||||
							
								
								
									
										53
									
								
								changedetectionio/static/js/preview.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								changedetectionio/static/js/preview.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,53 @@ | ||||
| function redirect_to_version(version) { | ||||
|     var currentUrl = window.location.href; | ||||
|     var baseUrl = currentUrl.split('?')[0]; // Base URL without query parameters | ||||
|     var anchor = ''; | ||||
|  | ||||
|     // Check if there is an anchor | ||||
|     if (baseUrl.indexOf('#') !== -1) { | ||||
|         anchor = baseUrl.substring(baseUrl.indexOf('#')); | ||||
|         baseUrl = baseUrl.substring(0, baseUrl.indexOf('#')); | ||||
|     } | ||||
|     window.location.href = baseUrl + '?version=' + version + anchor; | ||||
| } | ||||
|  | ||||
| document.addEventListener('keydown', function (event) { | ||||
|     var selectElement = document.getElementById('preview-version'); | ||||
|     if (selectElement) { | ||||
|         var selectedOption = selectElement.querySelector('option:checked'); | ||||
|         if (selectedOption) { | ||||
|             if (event.key === 'ArrowLeft') { | ||||
|                 if (selectedOption.previousElementSibling) { | ||||
|                     redirect_to_version(selectedOption.previousElementSibling.value); | ||||
|                 } | ||||
|             } else if (event.key === 'ArrowRight') { | ||||
|                 if (selectedOption.nextElementSibling) { | ||||
|                     redirect_to_version(selectedOption.nextElementSibling.value); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| }); | ||||
|  | ||||
|  | ||||
| document.getElementById('preview-version').addEventListener('change', function () { | ||||
|     redirect_to_version(this.value); | ||||
| }); | ||||
|  | ||||
| var selectElement = document.getElementById('preview-version'); | ||||
| if (selectElement) { | ||||
|     var selectedOption = selectElement.querySelector('option:checked'); | ||||
|     if (selectedOption) { | ||||
|         if (selectedOption.previousElementSibling) { | ||||
|             document.getElementById('btn-previous').href = "?version=" + selectedOption.previousElementSibling.value; | ||||
|         } else { | ||||
|             document.getElementById('btn-previous').remove() | ||||
|         } | ||||
|         if (selectedOption.nextElementSibling) { | ||||
|             document.getElementById('btn-next').href = "?version=" + selectedOption.nextElementSibling.value; | ||||
|         } else { | ||||
|             document.getElementById('btn-next').remove() | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
| @@ -1,3 +1,17 @@ | ||||
| function toggleOpacity(checkboxSelector, fieldSelector) { | ||||
|     const checkbox = document.querySelector(checkboxSelector); | ||||
|     const fields = document.querySelectorAll(fieldSelector); | ||||
|     function updateOpacity() { | ||||
|         const opacityValue = checkbox.checked ? 0.6 : 1; | ||||
|         fields.forEach(field => { | ||||
|             field.style.opacity = opacityValue; | ||||
|         }); | ||||
|     } | ||||
|     // Initial setup | ||||
|     updateOpacity(); | ||||
|     checkbox.addEventListener('change', updateOpacity); | ||||
| } | ||||
|  | ||||
| $(document).ready(function () { | ||||
|     $('#notification-setting-reset-to-default').click(function (e) { | ||||
|         $('#notification_title').val(''); | ||||
| @@ -10,4 +24,7 @@ $(document).ready(function () { | ||||
|         e.preventDefault(); | ||||
|         $('#notification-tokens-info').toggle(); | ||||
|     }); | ||||
|  | ||||
|     toggleOpacity('#time_between_check_use_default', '#time_between_check'); | ||||
| }); | ||||
|  | ||||
|   | ||||
| @@ -68,7 +68,7 @@ | ||||
|   --color-last-checked: #bbb; | ||||
|   --color-text-footer: #444; | ||||
|   --color-border-watch-table-cell: #eee; | ||||
|   --color-text-watch-tag-list: #e70069; | ||||
|   --color-text-watch-tag-list: rgba(231, 0, 105, 0.4); | ||||
|   --color-background-new-watch-form: rgba(0, 0, 0, 0.05); | ||||
|   --color-background-new-watch-input: var(--color-white); | ||||
|   --color-text-new-watch-input: var(--color-text); | ||||
| @@ -111,7 +111,7 @@ html[data-darkmode="true"] { | ||||
|   --color-background-input: var(--color-grey-350); | ||||
|   --color-text-input-description: var(--color-grey-600); | ||||
|   --color-text-input-placeholder: var(--color-grey-600); | ||||
|   --color-text-watch-tag-list: #fa3e92; | ||||
|   --color-text-watch-tag-list: rgba(250, 62, 146, 0.4); | ||||
|   --color-background-code: var(--color-grey-200); | ||||
|   --color-background-tab: rgba(0, 0, 0, 0.2); | ||||
|   --color-background-tab-hover: rgba(0, 0, 0, 0.5); | ||||
|   | ||||
| @@ -75,7 +75,7 @@ | ||||
|   --color-text-footer: #444; | ||||
|   --color-border-watch-table-cell: #eee; | ||||
|  | ||||
|   --color-text-watch-tag-list: #e70069; | ||||
|   --color-text-watch-tag-list: rgba(231, 0, 105, 0.4); | ||||
|   --color-background-new-watch-form: rgba(0, 0, 0, 0.05); | ||||
|   --color-background-new-watch-input: var(--color-white); | ||||
|   --color-text-new-watch-input: var(--color-text); | ||||
| @@ -127,7 +127,7 @@ html[data-darkmode="true"] { | ||||
|   --color-background-input: var(--color-grey-350); | ||||
|   --color-text-input-description: var(--color-grey-600); | ||||
|   --color-text-input-placeholder: var(--color-grey-600); | ||||
|   --color-text-watch-tag-list: #fa3e92; | ||||
|   --color-text-watch-tag-list: rgba(250, 62, 146, 0.4); | ||||
|   --color-background-code: var(--color-grey-200); | ||||
|  | ||||
|   --color-background-tab: rgba(0, 0, 0, 0.2); | ||||
|   | ||||
| @@ -187,8 +187,11 @@ code { | ||||
| } | ||||
|  | ||||
| .watch-tag-list { | ||||
|   color: var(--color-text-watch-tag-list); | ||||
|   color: var(--color-white); | ||||
|   white-space: nowrap; | ||||
|   background: var(--color-text-watch-tag-list); | ||||
|   border-radius: 5px; | ||||
|   padding: 2px 5px; | ||||
| } | ||||
|  | ||||
| .box { | ||||
| @@ -240,7 +243,6 @@ body::after { | ||||
| body::before { | ||||
|   // background-image set in base.html so it works with reverse proxies etc | ||||
|   content: ""; | ||||
|   background-size: cover | ||||
| } | ||||
|  | ||||
| body:after, | ||||
| @@ -925,23 +927,26 @@ body.full-width { | ||||
|       font-size: .875em; | ||||
|     } | ||||
|   } | ||||
|   .text-filtering { | ||||
|     h3 { | ||||
|       margin-top: 0; | ||||
|     } | ||||
|     border: 1px solid #ccc; | ||||
|     padding: 1rem; | ||||
|     border-radius: 5px; | ||||
|     margin-bottom: 1rem; | ||||
|     fieldset:last-of-type { | ||||
| } | ||||
|  | ||||
| .border-fieldset { | ||||
|   h3 { | ||||
|     margin-top: 0; | ||||
|   } | ||||
|   border: 1px solid #ccc; | ||||
|   padding: 1rem; | ||||
|   border-radius: 5px; | ||||
|   margin-bottom: 1rem; | ||||
|   fieldset:last-of-type { | ||||
|     padding-bottom: 0; | ||||
|     .pure-control-group { | ||||
|       padding-bottom: 0; | ||||
|       .pure-control-group { | ||||
|         padding-bottom: 0; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
| ul { | ||||
|   padding-left: 1em; | ||||
|   padding-top: 0px; | ||||
| @@ -1077,6 +1082,9 @@ ul { | ||||
|     li { | ||||
|       list-style: none; | ||||
|       font-size: 0.8rem; | ||||
|       > * { | ||||
|         display: inline-block; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -284,7 +284,7 @@ ul#requests-extra_browsers { | ||||
|   --color-last-checked: #bbb; | ||||
|   --color-text-footer: #444; | ||||
|   --color-border-watch-table-cell: #eee; | ||||
|   --color-text-watch-tag-list: #e70069; | ||||
|   --color-text-watch-tag-list: rgba(231, 0, 105, 0.4); | ||||
|   --color-background-new-watch-form: rgba(0, 0, 0, 0.05); | ||||
|   --color-background-new-watch-input: var(--color-white); | ||||
|   --color-text-new-watch-input: var(--color-text); | ||||
| @@ -327,7 +327,7 @@ html[data-darkmode="true"] { | ||||
|   --color-background-input: var(--color-grey-350); | ||||
|   --color-text-input-description: var(--color-grey-600); | ||||
|   --color-text-input-placeholder: var(--color-grey-600); | ||||
|   --color-text-watch-tag-list: #fa3e92; | ||||
|   --color-text-watch-tag-list: rgba(250, 62, 146, 0.4); | ||||
|   --color-background-code: var(--color-grey-200); | ||||
|   --color-background-tab: rgba(0, 0, 0, 0.2); | ||||
|   --color-background-tab-hover: rgba(0, 0, 0, 0.5); | ||||
| @@ -532,8 +532,11 @@ code { | ||||
|     margin: 0 3px 0 5px; } | ||||
|  | ||||
| .watch-tag-list { | ||||
|   color: var(--color-text-watch-tag-list); | ||||
|   white-space: nowrap; } | ||||
|   color: var(--color-white); | ||||
|   white-space: nowrap; | ||||
|   background: var(--color-text-watch-tag-list); | ||||
|   border-radius: 5px; | ||||
|   padding: 2px 5px; } | ||||
|  | ||||
| .box { | ||||
|   max-width: 80%; | ||||
| @@ -571,8 +574,7 @@ body::after { | ||||
|   opacity: 0.91; } | ||||
|  | ||||
| body::before { | ||||
|   content: ""; | ||||
|   background-size: cover; } | ||||
|   content: ""; } | ||||
|  | ||||
| body:after, | ||||
| body:before { | ||||
| @@ -1038,17 +1040,18 @@ body.full-width .edit-form { | ||||
|     color: var(--color-text-input-description); } | ||||
|     .edit-form .pure-form-message-inline code { | ||||
|       font-size: .875em; } | ||||
|   .edit-form .text-filtering { | ||||
|     border: 1px solid #ccc; | ||||
|     padding: 1rem; | ||||
|     border-radius: 5px; | ||||
|     margin-bottom: 1rem; } | ||||
|     .edit-form .text-filtering h3 { | ||||
|       margin-top: 0; } | ||||
|     .edit-form .text-filtering fieldset:last-of-type { | ||||
|  | ||||
| .border-fieldset { | ||||
|   border: 1px solid #ccc; | ||||
|   padding: 1rem; | ||||
|   border-radius: 5px; | ||||
|   margin-bottom: 1rem; } | ||||
|   .border-fieldset h3 { | ||||
|     margin-top: 0; } | ||||
|   .border-fieldset fieldset:last-of-type { | ||||
|     padding-bottom: 0; } | ||||
|     .border-fieldset fieldset:last-of-type .pure-control-group { | ||||
|       padding-bottom: 0; } | ||||
|       .edit-form .text-filtering fieldset:last-of-type .pure-control-group { | ||||
|         padding-bottom: 0; } | ||||
|  | ||||
| ul { | ||||
|   padding-left: 1em; | ||||
| @@ -1169,6 +1172,8 @@ ul { | ||||
|     #quick-watch-processor-type ul li { | ||||
|       list-style: none; | ||||
|       font-size: 0.8rem; } | ||||
|       #quick-watch-processor-type ul li > * { | ||||
|         display: inline-block; } | ||||
|  | ||||
| .restock-label { | ||||
|   padding: 3px; | ||||
|   | ||||
| @@ -178,7 +178,7 @@ class ChangeDetectionStore: | ||||
|     @property | ||||
|     def has_unviewed(self): | ||||
|         for uuid, watch in self.__data['watching'].items(): | ||||
|             if watch.viewed == False: | ||||
|             if watch.history_n >= 2 and watch.viewed == False: | ||||
|                 return True | ||||
|         return False | ||||
|  | ||||
| @@ -554,7 +554,6 @@ class ChangeDetectionStore: | ||||
|         return os.path.isfile(filepath) | ||||
|  | ||||
|     def get_all_base_headers(self): | ||||
|         from .model.App import parse_headers_from_text_file | ||||
|         headers = {} | ||||
|         # Global app settings | ||||
|         headers.update(self.data['settings'].get('headers', {})) | ||||
| @@ -872,3 +871,16 @@ class ChangeDetectionStore: | ||||
|                         self.__data["watching"][awatch]['include_filters'][num] = 'xpath1:' + selector | ||||
|                     if selector.startswith('xpath:'): | ||||
|                         self.__data["watching"][awatch]['include_filters'][num] = selector.replace('xpath:', 'xpath1:', 1) | ||||
|  | ||||
|     # Use more obvious default time setting | ||||
|     def update_15(self): | ||||
|         for uuid in self.__data["watching"]: | ||||
|             if self.__data["watching"][uuid]['time_between_check'] == self.__data['settings']['requests']['time_between_check']: | ||||
|                 # What the old logic was, which was pretty confusing | ||||
|                 self.__data["watching"][uuid]['time_between_check_use_default'] = True | ||||
|             elif all(value is None or value == 0 for value in self.__data["watching"][uuid]['time_between_check'].values()): | ||||
|                 self.__data["watching"][uuid]['time_between_check_use_default'] = True | ||||
|             else: | ||||
|                 # Something custom here | ||||
|                 self.__data["watching"][uuid]['time_between_check_use_default'] = False | ||||
|  | ||||
|   | ||||
							
								
								
									
										6
									
								
								changedetectionio/templates/IMPORTANT.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								changedetectionio/templates/IMPORTANT.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| # Important notes about templates | ||||
|  | ||||
| Template names should always end in ".html", ".htm", ".xml", ".xhtml", ".svg", even the `import`'ed templates. | ||||
|  | ||||
| Jinja2's `def select_jinja_autoescape(self, filename: str) -> bool:` will check the filename extension and enable autoescaping | ||||
|  | ||||
| @@ -1,5 +1,5 @@ | ||||
| 
 | ||||
| {% from '_helpers.jinja' import render_field %} | ||||
| {% from '_helpers.html' import render_field %} | ||||
| 
 | ||||
| {% macro render_common_settings_form(form, emailprefix, settings_application) %} | ||||
|                         <div class="pure-control-group"> | ||||
| @@ -6,7 +6,9 @@ | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1.0" > | ||||
|     <meta name="description" content="Self hosted website change detection." > | ||||
|     <title>Change Detection{{extra_title}}</title> | ||||
|     <link rel="alternate" type="application/rss+xml" title="Changedetection.io » Feed{% if active_tag %}- {{active_tag}}{% endif %}" href="{{ url_for('rss', tag=active_tag , token=app_rss_token)}}" > | ||||
|     {% if app_rss_token %} | ||||
|       <link rel="alternate" type="application/rss+xml" title="Changedetection.io » Feed{% if active_tag_uuid %}- {{active_tag.title}}{% endif %}" href="{{ url_for('rss', tag=active_tag_uuid , token=app_rss_token)}}" > | ||||
|     {% endif %} | ||||
|     <link rel="stylesheet" href="{{url_for('static_content', group='styles', filename='pure-min.css')}}" > | ||||
|     <link rel="stylesheet" href="{{url_for('static_content', group='styles', filename='styles.css')}}?v={{ get_css_version() }}" > | ||||
|     {% if extra_stylesheets %} | ||||
| @@ -24,12 +26,6 @@ | ||||
|     <meta name="msapplication-TileColor" content="#da532c"> | ||||
|     <meta name="msapplication-config" content="favicons/browserconfig.xml"> | ||||
|     <meta name="theme-color" content="#ffffff"> | ||||
|  | ||||
|     <style> | ||||
|       body::before { | ||||
|         background-image: url({{url_for('static_content', group='images', filename='gradient-border.png') }}); | ||||
|       } | ||||
|     </style> | ||||
|     <script src="{{url_for('static_content', group='js', filename='jquery-3.6.0.min.js')}}"></script> | ||||
|   </head> | ||||
|  | ||||
| @@ -89,8 +85,8 @@ | ||||
|           <li class="pure-menu-item pure-form" id="search-menu-item"> | ||||
|             <!-- We use GET here so it offers people a chance to set bookmarks etc --> | ||||
|             <form name="searchForm" action="" method="GET"> | ||||
|               <input id="search-q" class="" name="q" placeholder="URL or Title {% if active_tag %}in '{{ active_tag }}'{% endif %}" required="" type="text" value=""> | ||||
|               <input name="tags" type="hidden" value="{% if active_tag %}{{active_tag}}{% endif %}"> | ||||
|               <input id="search-q" class="" name="q" placeholder="URL or Title {% if active_tag_uuid %}in '{{ active_tag.title }}'{% endif %}" required="" type="text" value=""> | ||||
|               <input name="tags" type="hidden" value="{% if active_tag_uuid %}{{active_tag_uuid}}{% endif %}"> | ||||
|               <button class="toggle-button " id="toggle-search" type="button" title="Search, or Use Alt+S Key" > | ||||
|                 {% include "svgs/search-icon.svg" %} | ||||
|               </button> | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| {% extends 'base.html' %} | ||||
| {% from '_helpers.jinja' import render_field, render_checkbox_field, render_button %} | ||||
| {% from '_helpers.html' import render_field, render_checkbox_field, render_button %} | ||||
| {% block content %} | ||||
| <script> | ||||
|     const screenshot_url="{{url_for('static_content', group='screenshot', filename=uuid)}}"; | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| {% extends 'base.html' %} | ||||
| {% block content %} | ||||
| {% from '_helpers.jinja' import render_field, render_checkbox_field, render_button %} | ||||
| {% from '_common_fields.jinja' import render_common_settings_form %} | ||||
| {% from '_helpers.html' import render_field, render_checkbox_field, render_button %} | ||||
| {% from '_common_fields.html' import render_common_settings_form %} | ||||
| <script src="{{url_for('static_content', group='js', filename='tabs.js')}}" defer></script> | ||||
| <script src="{{url_for('static_content', group='js', filename='vis.js')}}" defer></script> | ||||
| <script> | ||||
| @@ -87,15 +87,9 @@ | ||||
|                         {{ render_field(form.tags) }} | ||||
|                         <span class="pure-form-message-inline">Organisational tag/group name used in the main listing page</span> | ||||
|                     </div> | ||||
|                     <div class="pure-control-group"> | ||||
|                     <div class="pure-control-group time-between-check border-fieldset"> | ||||
|                         {{ render_field(form.time_between_check, class="time-check-widget") }} | ||||
|                         {% if has_empty_checktime %} | ||||
|                         <span class="pure-form-message-inline">Currently using the <a | ||||
|                                 href="{{ url_for('settings_page', uuid=uuid) }}">default global settings</a>, change to another value if you want to be specific.</span> | ||||
|                         {% else %} | ||||
|                         <span class="pure-form-message-inline">Set to blank to use the <a | ||||
|                                 href="{{ url_for('settings_page', uuid=uuid) }}">default global settings</a>.</span> | ||||
|                         {% endif %} | ||||
|                         {{ render_checkbox_field(form.time_between_check_use_default, class="use-default-timecheck") }} | ||||
|                     </div> | ||||
|                     <div class="pure-control-group"> | ||||
|                         {{ render_checkbox_field(form.extract_title_as_title) }} | ||||
| @@ -330,7 +324,7 @@ nav | ||||
|                         </ul> | ||||
|                       </span> | ||||
|                 </fieldset> | ||||
|                 <div class="text-filtering"> | ||||
|                 <div class="text-filtering border-fieldset"> | ||||
|                 <fieldset class="pure-group" id="text-filtering-type-options"> | ||||
|                     <h3>Text filtering</h3> | ||||
|                         Limit trigger/ignore/block/extract to;<br> | ||||
| @@ -439,7 +433,8 @@ Unavailable") }} | ||||
|                     <div class="pure-control-group"> | ||||
|                         {% if visualselector_enabled %} | ||||
|                             <span class="pure-form-message-inline"> | ||||
|                                 The Visual Selector tool lets you select the <i>text</i> elements that will be used for the change detection ‐ after the <i>Browser Steps</i> has completed, this tool is a helper to manage filters in the  "CSS/JSONPath/JQ/XPath Filters" box of the <a href="#filters-and-triggers">Filters & Triggers</a> tab. | ||||
|                                 The Visual Selector tool lets you select the <i>text</i> elements that will be used for the change detection ‐ after the <i>Browser Steps</i> has completed.<br> | ||||
|                                 This tool is a helper to manage filters in the  "CSS/JSONPath/JQ/XPath Filters" box of the <a href="#filters-and-triggers">Filters & Triggers</a> tab. | ||||
|                             </span> | ||||
|  | ||||
|                             <div id="selector-header"> | ||||
| @@ -487,13 +482,17 @@ Unavailable") }} | ||||
|                             <td>{{ "{:,}".format(watch.history|length) }}</td> | ||||
|                         </tr> | ||||
|                         <tr> | ||||
|                             <td>Last fetch time</td> | ||||
|                             <td>Last fetch duration</td> | ||||
|                             <td>{{ watch.fetch_time }}s</td> | ||||
|                         </tr> | ||||
|                         <tr> | ||||
|                             <td>Notification alert count</td> | ||||
|                             <td>{{ watch.notification_alert_count }}</td> | ||||
|                         </tr> | ||||
|                         <tr> | ||||
|                             <td>Server type reply</td> | ||||
|                             <td>{{ watch.get('remote_server_reply') }}</td> | ||||
|                         </tr> | ||||
|                         </tbody> | ||||
|                     </table> | ||||
|                 </div> | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| {% extends 'base.html' %} | ||||
| {% block content %} | ||||
| {% from '_helpers.jinja' import render_field %} | ||||
| {% from '_helpers.html' import render_field %} | ||||
| <script src="{{url_for('static_content', group='js', filename='tabs.js')}}" defer></script> | ||||
| <div class="edit-form monospaced-textarea"> | ||||
|  | ||||
|   | ||||
| @@ -1,72 +1,103 @@ | ||||
| {% extends 'base.html' %} | ||||
|  | ||||
| {% block content %} | ||||
| <script> | ||||
|     const screenshot_url="{{url_for('static_content', group='screenshot', filename=uuid)}}"; | ||||
|     {% if last_error_screenshot %} | ||||
|     const error_screenshot_url="{{url_for('static_content', group='screenshot', filename=uuid, error_screenshot=1) }}"; | ||||
|     {% endif %} | ||||
|     const highlight_submit_ignore_url="{{url_for('highlight_submit_ignore_url', uuid=uuid)}}"; | ||||
| </script> | ||||
| <script src="{{url_for('static_content', group='js', filename='diff-overview.js')}}" defer></script> | ||||
|  | ||||
| <script src="{{url_for('static_content', group='js', filename='tabs.js')}}" defer></script> | ||||
| <div class="tabs"> | ||||
|     <ul> | ||||
|         {% if last_error_text %}<li class="tab" id="error-text-tab"><a href="#error-text">Error Text</a></li> {% endif %} | ||||
|         {% if last_error_screenshot %}<li class="tab" id="error-screenshot-tab"><a href="#error-screenshot">Error Screenshot</a></li> {% endif %} | ||||
|         {% if history_n > 0 %} | ||||
|         <li class="tab" id="text-tab"><a href="#text">Text</a></li> | ||||
|         <li class="tab" id="screenshot-tab"><a href="#screenshot">Screenshot</a></li> | ||||
|     <script> | ||||
|         const screenshot_url = "{{url_for('static_content', group='screenshot', filename=uuid)}}"; | ||||
|         {% if last_error_screenshot %} | ||||
|             const error_screenshot_url = "{{url_for('static_content', group='screenshot', filename=uuid, error_screenshot=1) }}"; | ||||
|         {% endif %} | ||||
|     </ul> | ||||
| </div> | ||||
| <form><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"></form> | ||||
| <div id="diff-ui"> | ||||
|     <div class="tab-pane-inner" id="error-text"> | ||||
|         <div class="snapshot-age error">{{watch.error_text_ctime|format_seconds_ago}} seconds ago</div> | ||||
|         <pre> | ||||
|         const highlight_submit_ignore_url = "{{url_for('highlight_submit_ignore_url', uuid=uuid)}}"; | ||||
|     </script> | ||||
|     <script src="{{ url_for('static_content', group='js', filename='diff-overview.js') }}" defer></script> | ||||
|     <script src="{{ url_for('static_content', group='js', filename='preview.js') }}" defer></script> | ||||
|     <script src="{{ url_for('static_content', group='js', filename='tabs.js') }}" defer></script> | ||||
|     {% if versions|length >= 2 %} | ||||
|         <div id="settings" style="text-align: center;"> | ||||
|             <form class="pure-form " action="" method="POST"> | ||||
|                 <fieldset> | ||||
|                     <label for="preview-version">Select timestamp</label> <select id="preview-version" | ||||
|                                                                                  name="from_version" | ||||
|                                                                                  class="needs-localtime"> | ||||
|                     {% for version in versions|reverse %} | ||||
|                         <option value="{{ version }}" {% if version == current_version %} selected="" {% endif %}> | ||||
|                             {{ version }} | ||||
|                         </option> | ||||
|                     {% endfor %} | ||||
|                 </select> | ||||
|                     <button type="submit" class="pure-button pure-button-primary">Go</button> | ||||
|  | ||||
|                 </fieldset> | ||||
|             </form> | ||||
|                 <br> | ||||
|                 <strong>Keyboard: </strong><a href="" class="pure-button pure-button-primary" id="btn-previous"> | ||||
|                 ← Previous</a>   <a class="pure-button pure-button-primary" id="btn-next" href=""> | ||||
|                 → Next</a> | ||||
|         </div> | ||||
|     {% endif %} | ||||
|  | ||||
|     <div class="tabs"> | ||||
|         <ul> | ||||
|             {% if last_error_text %} | ||||
|                 <li class="tab" id="error-text-tab"><a href="#error-text">Error Text</a></li> {% endif %} | ||||
|             {% if last_error_screenshot %} | ||||
|                 <li class="tab" id="error-screenshot-tab"><a href="#error-screenshot">Error Screenshot</a> | ||||
|                 </li> {% endif %} | ||||
|             {% if history_n > 0 %} | ||||
|                 <li class="tab" id="text-tab"><a href="#text">Text</a></li> | ||||
|                 <li class="tab" id="screenshot-tab"><a href="#screenshot">Screenshot</a></li> | ||||
|             {% endif %} | ||||
|         </ul> | ||||
|     </div> | ||||
|  | ||||
|  | ||||
|     <div id="diff-ui"> | ||||
|         <div class="tab-pane-inner" id="error-text"> | ||||
|             <div class="snapshot-age error">{{ watch.error_text_ctime|format_seconds_ago }} seconds ago</div> | ||||
|             <pre> | ||||
|             {{ last_error_text }} | ||||
|         </pre> | ||||
|         </div> | ||||
|  | ||||
|         <div class="tab-pane-inner" id="error-screenshot"> | ||||
|             <div class="snapshot-age error">{{ watch.snapshot_error_screenshot_ctime|format_seconds_ago }} seconds ago | ||||
|             </div> | ||||
|             <img id="error-screenshot-img" style="max-width: 80%" | ||||
|                  alt="Current erroring screenshot from most recent request"> | ||||
|         </div> | ||||
|  | ||||
|         <div class="tab-pane-inner" id="text"> | ||||
|             <div class="snapshot-age">{{ current_version|format_timestamp_timeago }}</div> | ||||
|             <span class="ignored">Grey lines are ignored</span> <span class="triggered">Blue lines are triggers</span> | ||||
|             <span class="tip"><strong>Pro-tip</strong>: Highlight text to add to ignore filters</span> | ||||
|  | ||||
|             <table> | ||||
|                 <tbody> | ||||
|                 <tr> | ||||
|                     <td id="diff-col" class="highlightable-filter"> | ||||
|                         {% for row in content %} | ||||
|                             <div class="{{ row.classes }}">{{ row.line }}</div> | ||||
|                         {% endfor %} | ||||
|                     </td> | ||||
|                 </tr> | ||||
|                 </tbody> | ||||
|             </table> | ||||
|         </div> | ||||
|  | ||||
|         <div class="tab-pane-inner" id="screenshot"> | ||||
|             <div class="tip"> | ||||
|                 For now, Differences are performed on text, not graphically, only the latest screenshot is available. | ||||
|             </div> | ||||
|             <br> | ||||
|             {% if is_html_webdriver %} | ||||
|                 {% if screenshot %} | ||||
|                     <div class="snapshot-age">{{ watch.snapshot_screenshot_ctime|format_timestamp_timeago }}</div> | ||||
|                     <img style="max-width: 80%" id="screenshot-img" alt="Current screenshot from most recent request"> | ||||
|                 {% else %} | ||||
|                     No screenshot available just yet! Try rechecking the page. | ||||
|                 {% endif %} | ||||
|             {% else %} | ||||
|                 <strong>Screenshot requires Playwright/WebDriver enabled</strong> | ||||
|             {% endif %} | ||||
|         </div> | ||||
|     </div> | ||||
|  | ||||
|     <div class="tab-pane-inner" id="error-screenshot"> | ||||
|         <div class="snapshot-age error">{{watch.snapshot_error_screenshot_ctime|format_seconds_ago}} seconds ago</div> | ||||
|         <img id="error-screenshot-img"  style="max-width: 80%" alt="Current erroring screenshot from most recent request" > | ||||
|     </div> | ||||
|  | ||||
|     <div class="tab-pane-inner" id="text"> | ||||
|         <div class="snapshot-age">{{watch.snapshot_text_ctime|format_timestamp_timeago}}</div> | ||||
|         <span class="ignored">Grey lines are ignored</span> <span class="triggered">Blue lines are triggers</span> <span class="tip"><strong>Pro-tip</strong>: Highlight text to add to ignore filters</span> | ||||
|  | ||||
|         <table> | ||||
|             <tbody> | ||||
|             <tr> | ||||
|                 <td id="diff-col" class="highlightable-filter"> | ||||
|                     {% for row in content %} | ||||
|                     <div class="{{row.classes}}">{{row.line}}</div> | ||||
|                     {% endfor %} | ||||
|                 </td> | ||||
|             </tr> | ||||
|             </tbody> | ||||
|         </table> | ||||
|     </div> | ||||
|  | ||||
|      <div class="tab-pane-inner" id="screenshot"> | ||||
|          <div class="tip"> | ||||
|              For now, Differences are performed on text, not graphically, only the latest screenshot is available. | ||||
|          </div> | ||||
|          <br> | ||||
|          {% if is_html_webdriver %} | ||||
|            {% if screenshot %} | ||||
|              <div class="snapshot-age">{{watch.snapshot_screenshot_ctime|format_timestamp_timeago}}</div> | ||||
|              <img style="max-width: 80%" id="screenshot-img" alt="Current screenshot from most recent request" > | ||||
|            {% else %} | ||||
|               No screenshot available just yet! Try rechecking the page. | ||||
|            {% endif %} | ||||
|          {% else %} | ||||
|            <strong>Screenshot requires Playwright/WebDriver enabled</strong> | ||||
|          {% endif %} | ||||
|      </div> | ||||
| </div> | ||||
| {% endblock %} | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| {% extends 'base.html' %} | ||||
|  | ||||
| {% block content %} | ||||
| {% from '_helpers.jinja' import render_field, render_checkbox_field, render_button %} | ||||
| {% from '_common_fields.jinja' import render_common_settings_form %} | ||||
| {% from '_helpers.html' import render_field, render_checkbox_field, render_button %} | ||||
| {% from '_common_fields.html' import render_common_settings_form %} | ||||
| <script> | ||||
|     const notification_base_url="{{url_for('ajax_callback_send_notification_test', mode="global-settings")}}"; | ||||
| {% if emailprefix %} | ||||
| @@ -31,7 +31,7 @@ | ||||
|                 <fieldset> | ||||
|                     <div class="pure-control-group"> | ||||
|                         {{ render_field(form.requests.form.time_between_check, class="time-check-widget") }} | ||||
|                         <span class="pure-form-message-inline">Default time for all watches, when the watch does not have a specific time setting.</span> | ||||
|                         <span class="pure-form-message-inline">Default recheck time for all watches, current system minimum is <i>{{min_system_recheck_seconds}}</i> seconds (<a href="https://github.com/dgtlmoon/changedetection.io/wiki/Misc-system-settings#enviroment-variables">more info</a>).</span> | ||||
|                     </div> | ||||
|                     <div class="pure-control-group"> | ||||
|                         {{ render_field(form.requests.form.jitter_seconds, class="jitter_seconds") }} | ||||
| @@ -108,8 +108,6 @@ | ||||
|                         <p>Use the <strong>Basic</strong> method (default) where your watched sites don't need Javascript to render.</p> | ||||
|                         <p>The <strong>Chrome/Javascript</strong> method requires a network connection to a running WebDriver+Chrome server, set by the ENV var 'WEBDRIVER_URL'. </p> | ||||
|                     </span> | ||||
|                     <br> | ||||
|                     Tip: <a href="https://github.com/dgtlmoon/changedetection.io/wiki/Proxy-configuration#brightdata-proxy-support">Connect using Bright Data and Oxylabs Proxies, find out more here.</a> | ||||
|                 </div> | ||||
|                 <fieldset class="pure-group" id="webdriver-override-options" data-visible-for="application-fetch_backend=html_webdriver"> | ||||
|                     <div class="pure-form-message-inline"> | ||||
| @@ -121,6 +119,18 @@ | ||||
|                         {{ render_field(form.application.form.webdriver_delay) }} | ||||
|                     </div> | ||||
|                 </fieldset> | ||||
|                 <div class="pure-control-group inline-radio"> | ||||
|                     {{ render_field(form.requests.form.default_ua) }} | ||||
|                     <span class="pure-form-message-inline"> | ||||
|                         Applied to all requests.<br><br> | ||||
|                         Note: Simply changing the User-Agent often does not defeat anti-robot technologies, it's important to consider <a href="https://changedetection.io/tutorial/what-are-main-types-anti-robot-mechanisms">all of the ways that the browser is detected</a>. | ||||
|                     </span> | ||||
|                 </div> | ||||
|                 <div class="pure-control-group"> | ||||
|                                         <br> | ||||
|                     Tip: <a href="https://github.com/dgtlmoon/changedetection.io/wiki/Proxy-configuration#brightdata-proxy-support">Connect using Bright Data and Oxylabs Proxies, find out more here.</a> | ||||
|  | ||||
|                 </div> | ||||
|             </div> | ||||
|  | ||||
|             <div class="tab-pane-inner" id="filters"> | ||||
| @@ -190,7 +200,7 @@ nav | ||||
|                         <a id="chrome-extension-link" | ||||
|                            title="Try our new Chrome Extension!" | ||||
|                            href="https://chromewebstore.google.com/detail/changedetectionio-website/kefcfmgmlhmankjmnbijimhofdjekbop"> | ||||
|                             <img src="{{ url_for('static_content', group='images', filename='Google-Chrome-icon.png') }}"> | ||||
|                             <img src="{{ url_for('static_content', group='images', filename='Google-Chrome-icon.png') }}" alt="Chrome"> | ||||
|                             Chrome Webstore | ||||
|                         </a> | ||||
|                     </p> | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| {% extends 'base.html' %} | ||||
| {% block content %} | ||||
| {% from '_helpers.jinja' import render_simple_field, render_field, render_nolabel_field, sort_by_title %} | ||||
| {% from '_helpers.html' import render_simple_field, render_field, render_nolabel_field, sort_by_title %} | ||||
| <script src="{{url_for('static_content', group='js', filename='jquery-3.6.0.min.js')}}"></script> | ||||
| <script src="{{url_for('static_content', group='js', filename='watch-overview.js')}}" defer></script> | ||||
|  | ||||
| @@ -13,7 +13,7 @@ | ||||
|             <div id="watch-add-wrapper-zone"> | ||||
|  | ||||
|                     {{ render_nolabel_field(form.url, placeholder="https://...", required=true) }} | ||||
|                     {{ render_nolabel_field(form.tags, value=active_tag.title if active_tag else '', placeholder="watch label / tag") }} | ||||
|                     {{ render_nolabel_field(form.tags, value=active_tag.title if active_tag_uuid else '', placeholder="watch label / tag") }} | ||||
|                     {{ render_nolabel_field(form.watch_submit_button, title="Watch this URL!" ) }} | ||||
|                     {{ render_nolabel_field(form.edit_and_watch_submit_button, title="Edit first then Watch") }} | ||||
|             </div> | ||||
| @@ -46,7 +46,7 @@ | ||||
|     {% endif %} | ||||
|     {% if search_q %}<div id="search-result-info">Searching "<strong><i>{{search_q}}</i></strong>"</div>{% endif %} | ||||
|     <div> | ||||
|         <a href="{{url_for('index')}}" class="pure-button button-tag {{'active' if not active_tag }}">All</a> | ||||
|         <a href="{{url_for('index')}}" class="pure-button button-tag {{'active' if not active_tag_uuid }}">All</a> | ||||
|  | ||||
|     <!-- tag list --> | ||||
|     {% for uuid, tag in tags %} | ||||
| @@ -67,18 +67,18 @@ | ||||
|             <tr> | ||||
|                 {% set link_order = "desc" if sort_order  == 'asc' else "asc" %} | ||||
|                 {% set arrow_span = "" %} | ||||
|                 <th><input style="vertical-align: middle" type="checkbox" id="check-all" > <a class="{{ 'active '+link_order if sort_attribute == 'date_created' else 'inactive' }}"  href="{{url_for('index', sort='date_created', order=link_order, tag=active_tag)}}"># <span class='arrow {{link_order}}'></span></a></th> | ||||
|                 <th><input style="vertical-align: middle" type="checkbox" id="check-all" > <a class="{{ 'active '+link_order if sort_attribute == 'date_created' else 'inactive' }}"  href="{{url_for('index', sort='date_created', order=link_order, tag=active_tag_uuid)}}"># <span class='arrow {{link_order}}'></span></a></th> | ||||
|                 <th></th> | ||||
|                 <th><a class="{{ 'active '+link_order if sort_attribute == 'label' else 'inactive' }}" href="{{url_for('index', sort='label', order=link_order, tag=active_tag)}}">Website <span class='arrow {{link_order}}'></span></a></th> | ||||
|                 <th><a class="{{ 'active '+link_order if sort_attribute == 'last_checked' else 'inactive' }}" href="{{url_for('index', sort='last_checked', order=link_order, tag=active_tag)}}">Last Checked <span class='arrow {{link_order}}'></span></a></th> | ||||
|                 <th><a class="{{ 'active '+link_order if sort_attribute == 'last_changed' else 'inactive' }}" href="{{url_for('index', sort='last_changed', order=link_order, tag=active_tag)}}">Last Changed <span class='arrow {{link_order}}'></span></a></th> | ||||
|                 <th><a class="{{ 'active '+link_order if sort_attribute == 'label' else 'inactive' }}" href="{{url_for('index', sort='label', order=link_order, tag=active_tag_uuid)}}">Website <span class='arrow {{link_order}}'></span></a></th> | ||||
|                 <th><a class="{{ 'active '+link_order if sort_attribute == 'last_checked' else 'inactive' }}" href="{{url_for('index', sort='last_checked', order=link_order, tag=active_tag_uuid)}}">Last Checked <span class='arrow {{link_order}}'></span></a></th> | ||||
|                 <th><a class="{{ 'active '+link_order if sort_attribute == 'last_changed' else 'inactive' }}" href="{{url_for('index', sort='last_changed', order=link_order, tag=active_tag_uuid)}}">Last Changed <span class='arrow {{link_order}}'></span></a></th> | ||||
|                 <th></th> | ||||
|             </tr> | ||||
|             </thead> | ||||
|             <tbody> | ||||
|             {% if not watches|length %} | ||||
|             <tr> | ||||
|                 <td colspan="6">No website watches configured, please add a URL in the box above, or <a href="{{ url_for('import_page')}}" >import a list</a>.</td> | ||||
|                 <td colspan="6" style="text-wrap: wrap;">No website watches configured, please add a URL in the box above, or <a href="{{ url_for('import_page')}}" >import a list</a>.</td> | ||||
|             </tr> | ||||
|             {% endif %} | ||||
|             {% for watch in (watches|sort(attribute=sort_attribute, reverse=sort_order == 'asc'))|pagination_slice(skip=pagination.skip) %} | ||||
| @@ -95,11 +95,11 @@ | ||||
|                 <td class="inline checkbox-uuid" ><input name="uuids"  type="checkbox" value="{{ watch.uuid}} " > <span>{{ loop.index+pagination.skip }}</span></td> | ||||
|                 <td class="inline watch-controls"> | ||||
|                     {% if not watch.paused %} | ||||
|                     <a class="state-off" href="{{url_for('index', op='pause', uuid=watch.uuid, tag=active_tag)}}"><img src="{{url_for('static_content', group='images', filename='pause.svg')}}" alt="Pause checks" title="Pause checks" class="icon icon-pause" ></a> | ||||
|                     <a class="state-off" href="{{url_for('index', op='pause', uuid=watch.uuid, tag=active_tag_uuid)}}"><img src="{{url_for('static_content', group='images', filename='pause.svg')}}" alt="Pause checks" title="Pause checks" class="icon icon-pause" ></a> | ||||
|                     {% else %} | ||||
|                     <a class="state-on" href="{{url_for('index', op='pause', uuid=watch.uuid, tag=active_tag)}}"><img src="{{url_for('static_content', group='images', filename='play.svg')}}" alt="UnPause checks" title="UnPause checks" class="icon icon-unpause" ></a> | ||||
|                     <a class="state-on" href="{{url_for('index', op='pause', uuid=watch.uuid, tag=active_tag_uuid)}}"><img src="{{url_for('static_content', group='images', filename='play.svg')}}" alt="UnPause checks" title="UnPause checks" class="icon icon-unpause" ></a> | ||||
|                     {% endif %} | ||||
|                     <a class="link-mute state-{{'on' if watch.notification_muted else 'off'}}" href="{{url_for('index', op='mute', uuid=watch.uuid, tag=active_tag)}}"><img src="{{url_for('static_content', group='images', filename='bell-off.svg')}}" alt="Mute notifications" title="Mute notifications" class="icon icon-mute" ></a> | ||||
|                     <a class="link-mute state-{{'on' if watch.notification_muted else 'off'}}" href="{{url_for('index', op='mute', uuid=watch.uuid, tag=active_tag_uuid)}}"><img src="{{url_for('static_content', group='images', filename='bell-off.svg')}}" alt="Mute notifications" title="Mute notifications" class="icon icon-mute" ></a> | ||||
|                 </td> | ||||
|                 <td class="title-col inline">{{watch.title if watch.title is not none and watch.title|length > 0 else watch.url}} | ||||
|                     <a class="external" target="_blank" rel="noopener" href="{{ watch.link.replace('source:','') }}"></a> | ||||
| @@ -169,7 +169,7 @@ | ||||
|                 <td> | ||||
|                     <a {% if watch.uuid in queued_uuids %}disabled="true"{% endif %} href="{{ url_for('form_watch_checknow', uuid=watch.uuid, tag=request.args.get('tag')) }}" | ||||
|                        class="recheck pure-button pure-button-primary">{% if watch.uuid in queued_uuids %}Queued{% else %}Recheck{% endif %}</a> | ||||
|                     <a href="{{ url_for('edit_page', uuid=watch.uuid)}}" class="pure-button pure-button-primary">Edit</a> | ||||
|                     <a href="{{ url_for('edit_page', uuid=watch.uuid)}}#general" class="pure-button pure-button-primary">Edit</a> | ||||
|                     {% if watch.history_n >= 2 %} | ||||
|  | ||||
|                         {%  if is_unviewed %} | ||||
| @@ -204,7 +204,7 @@ | ||||
|                 all {% if active_tag_uuid %} in "{{active_tag.title}}"{%endif%}</a> | ||||
|             </li> | ||||
|             <li> | ||||
|                 <a href="{{ url_for('rss', tag=active_tag , token=app_rss_token)}}"><img alt="RSS Feed" id="feed-icon" src="{{url_for('static_content', group='images', filename='Generic_Feed-icon.svg')}}" height="15"></a> | ||||
|                 <a href="{{ url_for('rss', tag=active_tag_uuid, token=app_rss_token)}}"><img alt="RSS Feed" id="feed-icon" src="{{url_for('static_content', group='images', filename='Generic_Feed-icon.svg')}}" height="15"></a> | ||||
|             </li> | ||||
|         </ul> | ||||
|         {{ pagination.links }} | ||||
|   | ||||
| @@ -71,6 +71,8 @@ def test_check_notification_email_formats_default_HTML(client, live_server): | ||||
|  | ||||
|     wait_for_all_checks(client) | ||||
|     set_longer_modified_response() | ||||
|     time.sleep(2) | ||||
|  | ||||
|     client.get(url_for("form_watch_checknow"), follow_redirects=True) | ||||
|     wait_for_all_checks(client) | ||||
|  | ||||
| @@ -135,6 +137,7 @@ def test_check_notification_email_formats_default_Text_override_HTML(client, liv | ||||
|  | ||||
|     wait_for_all_checks(client) | ||||
|     set_longer_modified_response() | ||||
|     time.sleep(2) | ||||
|     client.get(url_for("form_watch_checknow"), follow_redirects=True) | ||||
|     wait_for_all_checks(client) | ||||
|  | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| #!/usr/bin/python3 | ||||
|  | ||||
| import os.path | ||||
| import time | ||||
| from flask import url_for | ||||
| from .util import live_server_setup, wait_for_all_checks | ||||
| @@ -107,7 +107,6 @@ def test_check_add_line_contains_trigger(client, live_server): | ||||
|     #live_server_setup(live_server) | ||||
|  | ||||
|     # Give the endpoint time to spin up | ||||
|     time.sleep(1) | ||||
|     test_notification_url = url_for('test_notification_endpoint', _external=True).replace('http://', 'post://') + "?xxx={{ watch_url }}" | ||||
|  | ||||
|     res = client.post( | ||||
| @@ -166,6 +165,7 @@ def test_check_add_line_contains_trigger(client, live_server): | ||||
|  | ||||
|     # Takes a moment for apprise to fire | ||||
|     time.sleep(3) | ||||
|     assert os.path.isfile("test-datastore/notification.txt"), "Notification fired because I can see the output file" | ||||
|     with open("test-datastore/notification.txt", 'r') as f: | ||||
|         response= f.read() | ||||
|         assert '-Oh yes please-' in response | ||||
|   | ||||
| @@ -105,6 +105,7 @@ def test_check_ldjson_price_autodetect(client, live_server): | ||||
|     wait_for_all_checks(client) | ||||
|  | ||||
|     # Trigger a check | ||||
|     time.sleep(1) | ||||
|     client.get(url_for("form_watch_checknow"), follow_redirects=True) | ||||
|     wait_for_all_checks(client) | ||||
|     # Offer should be gone | ||||
|   | ||||
| @@ -135,6 +135,9 @@ def test_check_basic_change_detection_functionality(client, live_server): | ||||
|     # It should have picked up the <title> | ||||
|     assert b'head title' in res.data | ||||
|  | ||||
|     # Be sure the last_viewed is going to be greater than the last snapshot | ||||
|     time.sleep(1) | ||||
|  | ||||
|     # hit the mark all viewed link | ||||
|     res = client.get(url_for("mark_all_viewed"), follow_redirects=True) | ||||
|  | ||||
|   | ||||
| @@ -2,15 +2,15 @@ | ||||
|  | ||||
| import time | ||||
| from flask import url_for | ||||
| from .util import live_server_setup | ||||
| from .util import live_server_setup, wait_for_all_checks | ||||
|  | ||||
|  | ||||
| def test_setup(client, live_server): | ||||
|     live_server_setup(live_server) | ||||
|  | ||||
| # If there was only a change in the whitespacing, then we shouldnt have a change detected | ||||
| def test_jinja2_in_url_query(client, live_server): | ||||
|     live_server_setup(live_server) | ||||
|  | ||||
|     # Give the endpoint time to spin up | ||||
|     time.sleep(1) | ||||
|     #live_server_setup(live_server) | ||||
|  | ||||
|     # Add our URL to the import page | ||||
|     test_url = url_for('test_return_query', _external=True) | ||||
| @@ -24,10 +24,35 @@ def test_jinja2_in_url_query(client, live_server): | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|     assert b"Watch added" in res.data | ||||
|     time.sleep(3) | ||||
|     wait_for_all_checks(client) | ||||
|  | ||||
|     # It should report nothing found (no new 'unviewed' class) | ||||
|     res = client.get( | ||||
|         url_for("preview_page", uuid="first"), | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|     assert b'date=2' in res.data | ||||
|  | ||||
| # https://techtonics.medium.com/secure-templating-with-jinja2-understanding-ssti-and-jinja2-sandbox-environment-b956edd60456 | ||||
| def test_jinja2_security_url_query(client, live_server): | ||||
|     #live_server_setup(live_server) | ||||
|  | ||||
|     # Add our URL to the import page | ||||
|     test_url = url_for('test_return_query', _external=True) | ||||
|  | ||||
|     # because url_for() will URL-encode the var, but we dont here | ||||
|     full_url = "{}?{}".format(test_url, | ||||
|                               "date={{ ''.__class__.__mro__[1].__subclasses__()}}", ) | ||||
|     res = client.post( | ||||
|         url_for("form_quick_watch_add"), | ||||
|         data={"url": full_url, "tags": "test"}, | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|     assert b"Watch added" in res.data | ||||
|     wait_for_all_checks(client) | ||||
|  | ||||
|     # It should report nothing found (no new 'unviewed' class) | ||||
|     res = client.get(url_for("index")) | ||||
|     assert b'is invalid and cannot be used' in res.data | ||||
|     # Some of the spewed output from the subclasses | ||||
|     assert b'dict_values' not in res.data | ||||
|   | ||||
| @@ -479,8 +479,9 @@ def test_correct_header_detect(client, live_server): | ||||
|         url_for("preview_page", uuid="first"), | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|     assert b'"world":' in res.data | ||||
|     assert res.data.count(b'{') >= 2 | ||||
|  | ||||
|     assert b'"hello": 123,' in res.data | ||||
|     assert b'"world": 123</div>' in res.data | ||||
|  | ||||
|     res = client.get(url_for("form_delete", uuid="all"), follow_redirects=True) | ||||
|     assert b'Deleted' in res.data | ||||
|   | ||||
| @@ -256,12 +256,40 @@ def test_method_in_request(client, live_server): | ||||
| def test_headers_textfile_in_request(client, live_server): | ||||
|     #live_server_setup(live_server) | ||||
|     # Add our URL to the import page | ||||
|  | ||||
|     webdriver_ua = "Hello fancy webdriver UA 1.0" | ||||
|     requests_ua = "Hello basic requests UA 1.1" | ||||
|  | ||||
|     test_url = url_for('test_headers', _external=True) | ||||
|     if os.getenv('PLAYWRIGHT_DRIVER_URL'): | ||||
|         # Because its no longer calling back to localhost but from the browser container, set in test-only.yml | ||||
|         test_url = test_url.replace('localhost', 'cdio') | ||||
|  | ||||
|     print ("TEST URL IS ",test_url) | ||||
|     form_data = { | ||||
|         "application-fetch_backend": "html_requests", | ||||
|         "application-minutes_between_check": 180, | ||||
|         "requests-default_ua-html_requests": requests_ua | ||||
|     } | ||||
|  | ||||
|     if os.getenv('PLAYWRIGHT_DRIVER_URL'): | ||||
|         form_data["requests-default_ua-html_webdriver"] = webdriver_ua | ||||
|  | ||||
|     res = client.post( | ||||
|         url_for("settings_page"), | ||||
|         data=form_data, | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|     assert b'Settings updated' in res.data | ||||
|  | ||||
|     res = client.get(url_for("settings_page")) | ||||
|  | ||||
|     # Only when some kind of real browser is setup | ||||
|     if os.getenv('PLAYWRIGHT_DRIVER_URL'): | ||||
|         assert b'requests-default_ua-html_webdriver' in res.data | ||||
|  | ||||
|     # Field should always be there | ||||
|     assert b"requests-default_ua-html_requests" in res.data | ||||
|  | ||||
|     # Add the test URL twice, we will check | ||||
|     res = client.post( | ||||
|         url_for("import_page"), | ||||
| @@ -272,15 +300,14 @@ def test_headers_textfile_in_request(client, live_server): | ||||
|  | ||||
|     wait_for_all_checks(client) | ||||
|  | ||||
|  | ||||
|     # Add some headers to a request | ||||
|     res = client.post( | ||||
|         url_for("edit_page", uuid="first"), | ||||
|         data={ | ||||
|               "url": test_url, | ||||
|               "tags": "testtag", | ||||
|               "fetch_backend": 'html_webdriver' if os.getenv('PLAYWRIGHT_DRIVER_URL') else 'html_requests', | ||||
|               "headers": "xxx:ooo\ncool:yeah\r\n"}, | ||||
|             "url": test_url, | ||||
|             "tags": "testtag", | ||||
|             "fetch_backend": 'html_webdriver' if os.getenv('PLAYWRIGHT_DRIVER_URL') else 'html_requests', | ||||
|             "headers": "xxx:ooo\ncool:yeah\r\n"}, | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|     assert b"Updated watch." in res.data | ||||
| @@ -292,7 +319,7 @@ def test_headers_textfile_in_request(client, live_server): | ||||
|     with open('test-datastore/headers.txt', 'w') as f: | ||||
|         f.write("global-header: nice\r\nnext-global-header: nice") | ||||
|  | ||||
|     with open('test-datastore/'+extract_UUID_from_client(client)+'/headers.txt', 'w') as f: | ||||
|     with open('test-datastore/' + extract_UUID_from_client(client) + '/headers.txt', 'w') as f: | ||||
|         f.write("watch-header: nice") | ||||
|  | ||||
|     client.get(url_for("form_watch_checknow"), follow_redirects=True) | ||||
| @@ -306,7 +333,7 @@ def test_headers_textfile_in_request(client, live_server): | ||||
|     # Not needed anymore | ||||
|     os.unlink('test-datastore/headers.txt') | ||||
|     os.unlink('test-datastore/headers-testtag.txt') | ||||
|     os.unlink('test-datastore/'+extract_UUID_from_client(client)+'/headers.txt') | ||||
|     os.unlink('test-datastore/' + extract_UUID_from_client(client) + '/headers.txt') | ||||
|     # The service should echo back the request verb | ||||
|     res = client.get( | ||||
|         url_for("preview_page", uuid="first"), | ||||
| @@ -319,7 +346,12 @@ def test_headers_textfile_in_request(client, live_server): | ||||
|     assert b"Watch-Header:nice" in res.data | ||||
|     assert b"Tag-Header:test" in res.data | ||||
|  | ||||
|     # Check the custom UA from system settings page made it through | ||||
|     if os.getenv('PLAYWRIGHT_DRIVER_URL'): | ||||
|         assert "User-Agent:".encode('utf-8') + webdriver_ua.encode('utf-8') in res.data | ||||
|     else: | ||||
|         assert "User-Agent:".encode('utf-8') + requests_ua.encode('utf-8') in res.data | ||||
|  | ||||
|     #unlink headers.txt on start/stop | ||||
|     # unlink headers.txt on start/stop | ||||
|     res = client.get(url_for("form_delete", uuid="all"), follow_redirects=True) | ||||
|     assert b'Deleted' in res.data | ||||
|     assert b'Deleted' in res.data | ||||
|   | ||||
| @@ -2,9 +2,11 @@ from flask import url_for | ||||
| from .util import set_original_response, set_modified_response, live_server_setup, wait_for_all_checks | ||||
| import time | ||||
|  | ||||
| def test_setup(client, live_server): | ||||
|     live_server_setup(live_server) | ||||
|  | ||||
| def test_bad_access(client, live_server): | ||||
|     live_server_setup(live_server) | ||||
|     #live_server_setup(live_server) | ||||
|     res = client.post( | ||||
|         url_for("import_page"), | ||||
|         data={"urls": 'https://localhost'}, | ||||
| @@ -63,4 +65,25 @@ def test_bad_access(client, live_server): | ||||
|     wait_for_all_checks(client) | ||||
|     res = client.get(url_for("index")) | ||||
|  | ||||
|     assert b'file:// type access is denied for security reasons.' in res.data | ||||
|     assert b'file:// type access is denied for security reasons.' in res.data | ||||
|  | ||||
| def test_xss(client, live_server): | ||||
|     #live_server_setup(live_server) | ||||
|     from changedetectionio.notification import ( | ||||
|         default_notification_format | ||||
|     ) | ||||
|     # the template helpers were named .jinja which meant they were not having jinja2 autoescape enabled. | ||||
|     res = client.post( | ||||
|         url_for("settings_page"), | ||||
|         data={"application-notification_urls": '"><img src=x onerror=alert(document.domain)>', | ||||
|               "application-notification_title": '"><img src=x onerror=alert(document.domain)>', | ||||
|               "application-notification_body": '"><img src=x onerror=alert(document.domain)>', | ||||
|               "application-notification_format": default_notification_format, | ||||
|               "requests-time_between_check-minutes": 180, | ||||
|               'application-fetch_backend': "html_requests"}, | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|  | ||||
|     assert b"<img src=x onerror=alert(" not in res.data | ||||
|     assert b"<img" in res.data | ||||
|  | ||||
|   | ||||
| @@ -54,102 +54,3 @@ def test_check_watch_field_storage(client, live_server): | ||||
|     assert b"woohoo" in res.data | ||||
|     assert b"curl: foo" in res.data | ||||
|  | ||||
|  | ||||
|  | ||||
| # Re https://github.com/dgtlmoon/changedetection.io/issues/110 | ||||
| def test_check_recheck_global_setting(client, live_server): | ||||
|  | ||||
|     res = client.post( | ||||
|         url_for("settings_page"), | ||||
|         data={ | ||||
|                "requests-time_between_check-minutes": 1566, | ||||
|                'application-fetch_backend': "html_requests" | ||||
|                }, | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|     assert b"Settings updated." in res.data | ||||
|  | ||||
|     # Now add a record | ||||
|  | ||||
|     test_url = "http://somerandomsitewewatch.com" | ||||
|  | ||||
|     res = client.post( | ||||
|         url_for("import_page"), | ||||
|         data={"urls": test_url}, | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|     assert b"1 Imported" in res.data | ||||
|  | ||||
|     # Now visit the edit page, it should have the default minutes | ||||
|  | ||||
|     res = client.get( | ||||
|         url_for("edit_page", uuid="first"), | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|  | ||||
|     # Should show the default minutes | ||||
|     assert b"change to another value if you want to be specific" in res.data | ||||
|     assert b"1566" in res.data | ||||
|  | ||||
|     res = client.post( | ||||
|         url_for("settings_page"), | ||||
|         data={ | ||||
|                "requests-time_between_check-minutes": 222, | ||||
|                 'application-fetch_backend': "html_requests" | ||||
|                }, | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|     assert b"Settings updated." in res.data | ||||
|  | ||||
|     res = client.get( | ||||
|         url_for("edit_page", uuid="first"), | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|  | ||||
|     # Should show the default minutes | ||||
|     assert b"change to another value if you want to be specific" in res.data | ||||
|     assert b"222" in res.data | ||||
|  | ||||
|     # Now change it specifically, it should show the new minutes | ||||
|     res = client.post( | ||||
|         url_for("edit_page", uuid="first"), | ||||
|         data={"url": test_url, | ||||
|               "time_between_check-minutes": 55, | ||||
|               'fetch_backend': "html_requests" | ||||
|               }, | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|  | ||||
|     res = client.get( | ||||
|         url_for("edit_page", uuid="first"), | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|     assert b"55" in res.data | ||||
|  | ||||
|     # Now submit an empty field, it should give back the default global minutes | ||||
|     res = client.post( | ||||
|         url_for("settings_page"), | ||||
|         data={ | ||||
|                "requests-time_between_check-minutes": 666, | ||||
|                 "application-fetch_backend": "html_requests" | ||||
|                }, | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|     assert b"Settings updated." in res.data | ||||
|  | ||||
|     res = client.post( | ||||
|         url_for("edit_page", uuid="first"), | ||||
|         data={"url": test_url, | ||||
|               "time_between_check-minutes": "", | ||||
|               'fetch_backend': "html_requests" | ||||
|               }, | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|  | ||||
|     assert b"Updated watch." in res.data | ||||
|  | ||||
|     res = client.get( | ||||
|         url_for("edit_page", uuid="first"), | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|     assert b"666" in res.data | ||||
|   | ||||
							
								
								
									
										57
									
								
								changedetectionio/tests/unit/test_jinja2_security.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								changedetectionio/tests/unit/test_jinja2_security.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,57 @@ | ||||
| #!/usr/bin/python3 | ||||
|  | ||||
| # run from dir above changedetectionio/ dir | ||||
| # python3 -m unittest changedetectionio.tests.unit.test_jinja2_security | ||||
|  | ||||
| import unittest | ||||
| from changedetectionio import safe_jinja | ||||
|  | ||||
|  | ||||
| # mostly | ||||
| class TestJinja2SSTI(unittest.TestCase): | ||||
|  | ||||
|     def test_exception(self): | ||||
|         import jinja2 | ||||
|  | ||||
|         # Where sandbox should kick in | ||||
|         attempt_list = [ | ||||
|             "My name is {{ self.__init__.__globals__.__builtins__.__import__('os').system('id') }}", | ||||
|             "{{ self._TemplateReference__context.cycler.__init__.__globals__.os }}", | ||||
|             "{{ self.__init__.__globals__.__builtins__.__import__('os').popen('id').read() }}", | ||||
|             "{{cycler.__init__.__globals__.os.popen('id').read()}}", | ||||
|             "{{joiner.__init__.__globals__.os.popen('id').read()}}", | ||||
|             "{{namespace.__init__.__globals__.os.popen('id').read()}}", | ||||
|             "{{ ''.__class__.__mro__[2].__subclasses__()[40]('/tmp/hello.txt', 'w').write('Hello here !') }}", | ||||
|             "My name is {{ self.__init__.__globals__ }}", | ||||
|             "{{ dict.__base__.__subclasses__() }}" | ||||
|         ] | ||||
|         for attempt in attempt_list: | ||||
|             with self.assertRaises(jinja2.exceptions.SecurityError): | ||||
|                 safe_jinja.render(attempt) | ||||
|  | ||||
|     def test_exception_debug_calls(self): | ||||
|         import jinja2 | ||||
|         # Where sandbox should kick in - configs and debug calls | ||||
|         attempt_list = [ | ||||
|             "{% debug %}", | ||||
|         ] | ||||
|         for attempt in attempt_list: | ||||
|             # Usually should be something like 'Encountered unknown tag 'debug'.' | ||||
|             with self.assertRaises(jinja2.exceptions.TemplateSyntaxError): | ||||
|                 safe_jinja.render(attempt) | ||||
|  | ||||
|     # https://book.hacktricks.xyz/pentesting-web/ssti-server-side-template-injection/jinja2-ssti#accessing-global-objects | ||||
|     def test_exception_empty_calls(self): | ||||
|         import jinja2 | ||||
|         attempt_list = [ | ||||
|             "{{config}}", | ||||
|             "{{ debug }}" | ||||
|             "{{[].__class__}}", | ||||
|         ] | ||||
|         for attempt in attempt_list: | ||||
|             self.assertEqual(len(safe_jinja.render(attempt)), 0, f"string test '{attempt}' is correctly empty") | ||||
|  | ||||
|  | ||||
|  | ||||
| if __name__ == '__main__': | ||||
|     unittest.main() | ||||
| @@ -116,7 +116,7 @@ def extract_UUID_from_client(client): | ||||
|     ) | ||||
|     # <span id="api-key">{{api_key}}</span> | ||||
|  | ||||
|     m = re.search('edit/(.+?)"', str(res.data)) | ||||
|     m = re.search('edit/(.+?)[#"]', str(res.data)) | ||||
|     uuid = m.group(1) | ||||
|     return uuid.strip() | ||||
|  | ||||
|   | ||||
| @@ -102,10 +102,9 @@ def test_basic_browserstep(client, live_server): | ||||
|             "url": test_url, | ||||
|             "tags": "", | ||||
|             'fetch_backend': "html_webdriver", | ||||
|             'browser_steps-0-operation': 'Goto site', | ||||
|             'browser_steps-1-operation': 'Click element', | ||||
|             'browser_steps-1-selector': 'button[name=test-button]', | ||||
|             'browser_steps-1-optional_value': '', | ||||
|             'browser_steps-0-operation': 'Click element', | ||||
|             'browser_steps-0-selector': 'button[name=test-button]', | ||||
|             'browser_steps-0-optional_value': '', | ||||
|             # For now, cookies doesnt work in headers because it must be a full cookiejar object | ||||
|             'headers': "testheader: yes\buser-agent: MyCustomAgent", | ||||
|         }, | ||||
| @@ -141,10 +140,9 @@ def test_basic_browserstep(client, live_server): | ||||
|               "url": four_o_four_url, | ||||
|               "tags": "", | ||||
|               'fetch_backend': "html_webdriver", | ||||
|               'browser_steps-0-operation': 'Goto site', | ||||
|               'browser_steps-1-operation': 'Click element', | ||||
|               'browser_steps-1-selector': 'button[name=test-button]', | ||||
|               'browser_steps-1-optional_value': '' | ||||
|               'browser_steps-0-operation': 'Click element', | ||||
|               'browser_steps-0-selector': 'button[name=test-button]', | ||||
|               'browser_steps-0-optional_value': '' | ||||
|         }, | ||||
|         follow_redirects=True | ||||
|     ) | ||||
|   | ||||
| @@ -462,7 +462,7 @@ class update_worker(threading.Thread): | ||||
|                     except Exception as e: | ||||
|                         logger.error(f"Exception reached processing watch UUID: {uuid}") | ||||
|                         logger.error(str(e)) | ||||
|                         self.datastore.update_watch(uuid=uuid, update_obj={'last_error': str(e)}) | ||||
|                         self.datastore.update_watch(uuid=uuid, update_obj={'last_error': "Exception: " + str(e)}) | ||||
|                         # Other serious error | ||||
|                         process_changedetection_results = False | ||||
| #                        import traceback | ||||
|   | ||||
| @@ -54,7 +54,9 @@ services: | ||||
|   #         | ||||
|   #        Default number of parallel/concurrent fetchers | ||||
|   #      - FETCH_WORKERS=10 | ||||
|  | ||||
|   # | ||||
|   #        Absolute minimum seconds to recheck, overrides any watch minimum, change to 0 to disable | ||||
|   #      - MINIMUM_SECONDS_RECHECK_TIME=3 | ||||
|       # Comment out ports: when using behind a reverse proxy , enable networks: etc. | ||||
|       ports: | ||||
|         - 5000:5000 | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| # Used by Pyppeteer | ||||
| pyee | ||||
|  | ||||
| eventlet==0.33.3 # related to dnspython fixes | ||||
| eventlet==0.35.2 # related to dnspython fixes | ||||
| feedgen~=0.9 | ||||
| flask-compress | ||||
| # 0.6.3 included compatibility fix for werkzeug 3.x (2.x had deprecation of url handlers) | ||||
| @@ -36,12 +36,12 @@ dnspython==2.3.0 # related to eventlet fixes | ||||
| # jq not available on Windows so must be installed manually | ||||
|  | ||||
| # Notification library | ||||
| apprise~=1.7.4 | ||||
| apprise~=1.8.0 | ||||
|  | ||||
| # apprise mqtt https://github.com/dgtlmoon/changedetection.io/issues/315 | ||||
| # and 2.0.0 https://github.com/dgtlmoon/changedetection.io/issues/2241 not yet compatible | ||||
| # use v1.x due to https://github.com/eclipse/paho.mqtt.python/issues/814 | ||||
| paho-mqtt < 2.0.0 | ||||
| paho-mqtt>=1.6.1,<2.0.0 | ||||
|  | ||||
| # This mainly affects some ARM builds, which unlike the other builds ignores "ARG CRYPTOGRAPHY_DONT_BUILD_RUST=1" | ||||
| # so without this pinning, the newer versions on ARM will forcefully try to build rust, which results in "rust compiler not found" | ||||
| @@ -52,7 +52,10 @@ cryptography~=3.4 | ||||
| beautifulsoup4 | ||||
|  | ||||
| # XPath filtering, lxml is required by bs4 anyway, but put it here to be safe. | ||||
| lxml >=4.8.0,<6 | ||||
| # #2328 - 5.2.0 and 5.2.1 had extra CPU flag CFLAGS set which was not compatible on older hardware | ||||
| #         It could be advantageous to run its own pypi package here with those performance flags set | ||||
| #         https://bugs.launchpad.net/lxml/+bug/2059910/comments/16 | ||||
| lxml >=4.8.0,<6,!=5.2.0,!=5.2.1 | ||||
|  | ||||
| # XPath 2.0-3.1 support - 4.2.0 broke something? | ||||
| elementpath==4.1.5 | ||||
| @@ -70,12 +73,10 @@ openpyxl | ||||
| jq~=1.3; python_version >= "3.8" and sys_platform == "darwin" | ||||
| jq~=1.3; python_version >= "3.8" and sys_platform == "linux" | ||||
|  | ||||
| # Any current modern version, required so far for screenshot PNG->JPEG conversion but will be used more in the future | ||||
| pillow | ||||
| # playwright is installed at Dockerfile build time because it's not available on all platforms | ||||
|  | ||||
| # experimental release | ||||
| pyppeteer-ng==2.0.0rc5 | ||||
| pyppeteerstealth>=0.0.4 | ||||
|  | ||||
| # Include pytest, so if theres a support issue we can ask them to run these tests on their setup | ||||
| pytest ~=7.2 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user