diff --git a/changedetectionio/__init__.py b/changedetectionio/__init__.py index d60ca816..11bb6c1c 100644 --- a/changedetectionio/__init__.py +++ b/changedetectionio/__init__.py @@ -884,6 +884,10 @@ def changedetection_app(config=None, datastore_o=None): is_html_webdriver = True if watch.get('fetch_backend') == 'html_webdriver' or ( watch.get('fetch_backend', None) is None and system_uses_webdriver) else False + password_enabled_and_share_is_off = False + if datastore.data['settings']['application'].get('password') or os.getenv("SALTED_PASS", False): + password_enabled_and_share_is_off = not datastore.data['settings']['application'].get('shared_diff_access') + output = render_template("diff.html", current_diff_url=watch['url'], current_previous_version=str(previous_version), @@ -897,6 +901,7 @@ def changedetection_app(config=None, datastore_o=None): left_sticky=True, newest=newest_version_file_contents, newest_version_timestamp=dates[-1], + password_enabled_and_share_is_off=password_enabled_and_share_is_off, previous=previous_version_file_contents, screenshot=screenshot_url, uuid=uuid, diff --git a/changedetectionio/forms.py b/changedetectionio/forms.py index 8ef2112f..f8f39879 100644 --- a/changedetectionio/forms.py +++ b/changedetectionio/forms.py @@ -454,17 +454,17 @@ class globalSettingsRequestForm(Form): # datastore.data['settings']['application'].. class globalSettingsApplicationForm(commonSettingsForm): + api_access_token_enabled = BooleanField('API access token security check enabled', default=True, validators=[validators.Optional()]) base_url = StringField('Base URL', validators=[validators.Optional()]) - global_subtractive_selectors = StringListField('Remove elements', [ValidateCSSJSONXPATHInput(allow_xpath=False, allow_json=False)]) + empty_pages_are_a_change = BooleanField('Treat empty pages as a change?', default=False) + fetch_backend = RadioField('Fetch Method', default="html_requests", choices=content_fetcher.available_fetchers(), validators=[ValidateContentFetcherIsReady()]) global_ignore_text = StringListField('Ignore Text', [ValidateListRegex()]) + global_subtractive_selectors = StringListField('Remove elements', [ValidateCSSJSONXPATHInput(allow_xpath=False, allow_json=False)]) ignore_whitespace = BooleanField('Ignore whitespace') + password = SaltyPasswordField() removepassword_button = SubmitField('Remove password', render_kw={"class": "pure-button pure-button-primary"}) - empty_pages_are_a_change = BooleanField('Treat empty pages as a change?', default=False) render_anchor_tag_content = BooleanField('Render anchor tag content', default=False) - fetch_backend = RadioField('Fetch Method', default="html_requests", choices=content_fetcher.available_fetchers(), validators=[ValidateContentFetcherIsReady()]) - api_access_token_enabled = BooleanField('API access token security check enabled', default=True, validators=[validators.Optional()]) - password = SaltyPasswordField() - + shared_diff_access = BooleanField('Allow access to view diff page when password is enabled', default=False, validators=[validators.Optional()]) filter_failure_notification_threshold_attempts = IntegerField('Number of times the filter can be missing before sending a notification', render_kw={"style": "width: 5em;"}, validators=[validators.NumberRange(min=0, diff --git a/changedetectionio/model/App.py b/changedetectionio/model/App.py index 7975c0c4..7c7cac9f 100644 --- a/changedetectionio/model/App.py +++ b/changedetectionio/model/App.py @@ -40,6 +40,7 @@ class model(dict): 'notification_body': default_notification_body, 'notification_format': default_notification_format, 'schema_version' : 0, + 'shared_diff_access': False, 'webdriver_delay': None # Extra delay in seconds before extracting text } } diff --git a/changedetectionio/templates/diff.html b/changedetectionio/templates/diff.html index 8650a01b..fb40843b 100644 --- a/changedetectionio/templates/diff.html +++ b/changedetectionio/templates/diff.html @@ -76,8 +76,12 @@