diff --git a/changedetectionio/changedetection.py b/changedetectionio/changedetection.py index 472e6ab2..3fb20f82 100755 --- a/changedetectionio/changedetection.py +++ b/changedetectionio/changedetection.py @@ -2,19 +2,20 @@ # Launch as a eventlet.wsgi server instance. +from distutils.util import strtobool +import eventlet +import eventlet.wsgi import getopt import os import signal import sys -import eventlet -import eventlet.wsgi from . import store, changedetection_app, content_fetcher from . import __version__ # Only global so we can access it in the signal handler -datastore = None app = None +datastore = None def sigterm_handler(_signo, _stack_frame): global app @@ -106,8 +107,9 @@ def main(): # @Note: Incompatible with password login (and maybe other features) for now, submit a PR! @app.after_request def hide_referrer(response): - if os.getenv("HIDE_REFERER", False): + if strtobool(os.getenv("HIDE_REFERER", False)): response.headers["Referrer-Policy"] = "no-referrer" + return response # Proxy sub-directory support diff --git a/changedetectionio/run_all_tests.sh b/changedetectionio/run_all_tests.sh index 459513e8..55bb3dc1 100755 --- a/changedetectionio/run_all_tests.sh +++ b/changedetectionio/run_all_tests.sh @@ -24,6 +24,12 @@ echo "RUNNING WITH BASE_URL SET" export BASE_URL="https://really-unique-domain.io" pytest tests/test_notification.py + +# Re-run with HIDE_REFERER set - could affect login +export HIDE_REFERER=True +pytest tests/test_access_control.py + + # Now for the selenium and playwright/browserless fetchers # Note - this is not UI functional tests - just checking that each one can fetch the content