From 3a70769c580f39465151ba1c63a02c0906f5b353 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Mon, 22 Oct 2018 17:12:22 -0700 Subject: [PATCH] Cleanup CLI Switches and Docs for Auto-Fetch System (#394) Rename: - rename auto-fetch config to 'enable_auto_fetch' and '--enable-auto-fetch' cli param - rename 'use_head_insert' -> 'enable_content_rewrite' - rename 'use_banner' -> 'enable_banner' - rename 'use_wombat' -> 'enable_wombat' Misc Cleanup: - enable_auto_fetch applies to both proxy and non-proxy mode - remove setting 'wbinfo.use_wombat', implied if wombatProxyMode.js is included - docs: add docs for auto-fetch system, improved docs for proxy rewrite options - tests: test with enable_auto_fetch, update tests for renames - bump version to 2.1.0 due to breaking changes - changelist: updates to changelist - requirements: use bounded version for gevent --- CHANGES.rst | 12 ++++-- docs/manual/configuring.rst | 73 ++++++++++++++++++++++++++------ pywb/__init__.py | 2 +- pywb/apps/cli.py | 13 +++--- pywb/apps/frontendapp.py | 2 +- pywb/static/wombat.js | 18 ++++---- pywb/static/wombatProxyMode.js | 36 ++++++++-------- pywb/templates/banner.html | 2 +- pywb/templates/head_insert.html | 7 +-- requirements.txt | 2 +- tests/config_test_root_coll.yaml | 1 + tests/test_cli.py | 3 +- tests/test_integration.py | 1 + tests/test_proxy.py | 43 ++++++++++++------- tests/test_root_coll.py | 2 + 15 files changed, 141 insertions(+), 76 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index d965b51e..1d1350aa 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -16,10 +16,10 @@ pywb 2.0.5 changelist - Optimized argument de-proxying in wombat (#385) - Improved iframe srcdoc rewriting in wombat (#386) -* Image srcset and media query preservation system (#359, #379, #378): +* Image srcset and media query auto-fetch system (#359, #379, #378): - Added image srcset and media query preservation system to wombat - - Added ``proxy-with-wombat`` option, if true, enables the usage of ``wombatProxyMode.js`` in proxy mode (default: false) - - Added ``proxy-with-auto-fetch`` option, if true, enables the usage of ``autoFetchWorkerProxyMode.js`` in proxy mode (default: false) + - Added ``--proxy-enable-wombat`` cli flag; if set, enables the usage of ``wombatProxyMode.js`` in proxy mode (default: false) + - Added ``--enable-auto-fetch`` cli flag; if set, enables the usage of auto fetch web worker in both url rewrite and proxy modes (default: false) - Added ``FrontEndApp.proxy_fetch()`` to allow the auto fetch worker to request cross-origin style sheets * Fuzzy Matching: @@ -31,8 +31,10 @@ pywb 2.0.5 changelist * Server-Side Rewriting: - Refactored the regular expression rewriters in-order to avoid multiple initialization (#354) - Improved unicode URL rewriting (#361, #376, #377, #380) - - Improved cookie rewriting (#386) + - Improved cookie rewriting in framed replay mode (#386) - Improved handling of bad content-length HTTP header (#386) + - Fix parsing of self-closing diff --git a/pywb/templates/head_insert.html b/pywb/templates/head_insert.html index 12a45e0e..b1fe7f59 100644 --- a/pywb/templates/head_insert.html +++ b/pywb/templates/head_insert.html @@ -24,17 +24,14 @@ wbinfo.coll = "{{ coll }}"; wbinfo.proxy_magic = "{{ env.pywb_proxy_magic }}"; wbinfo.static_prefix = "{{ static_prefix }}/"; -{% if env.pywb_proxy_magic %} - wbinfo.use_auto_fetch_worker = {{ config.proxy.use_auto_fetch_worker | tobool }}; - wbinfo.use_wombat = {{ config.proxy.use_wombat | tobool }} || wbinfo.use_auto_fetch_worker; -{% endif %} + wbinfo.enable_auto_fetch = {{ config.enable_auto_fetch | tobool }}; {% if env.pywb_proxy_magic %} {% set whichWombat = 'wombatProxyMode.js' %} {% else %} {% set whichWombat = 'wombat.js' %} {% endif %} -{% if not wb_url.is_banner_only or (env.pywb_proxy_magic and (config.proxy.use_auto_fetch_worker or config.proxy.use_wombat)) %} +{% if not wb_url.is_banner_only or (env.pywb_proxy_magic and (config.enable_auto_fetch or config.proxy.enable_wombat)) %}