Compare commits

..

3 Commits

Author SHA1 Message Date
dgtlmoon
f52e98f6fc Adding automated test for sending single test notification from a watch 2025-10-30 14:29:30 +01:00
dgtlmoon
a0b994cf54 Adding deeper test 2025-10-30 14:15:27 +01:00
dgtlmoon
2c0ba999af Improved send test notification handling 2025-10-30 14:09:42 +01:00
5 changed files with 5 additions and 37 deletions

View File

@@ -2,7 +2,7 @@
# Read more https://github.com/dgtlmoon/changedetection.io/wiki # Read more https://github.com/dgtlmoon/changedetection.io/wiki
__version__ = '0.50.38' __version__ = '0.50.37'
from changedetectionio.strtobool import strtobool from changedetectionio.strtobool import strtobool
from json.decoder import JSONDecodeError from json.decoder import JSONDecodeError

View File

@@ -96,10 +96,7 @@ def build_watch_json_schema(d):
"enum": ["html_requests", "html_webdriver"] "enum": ["html_requests", "html_webdriver"]
}) })
schema['properties']['processor'] = {"anyOf": [
{"type": "string", "enum": ["restock_diff", "text_json_diff"]},
{"type": "null"}
]}
# All headers must be key/value type dict # All headers must be key/value type dict
schema['properties']['headers'] = { schema['properties']['headers'] = {

View File

@@ -20,14 +20,10 @@ class NotificationContextData(dict):
'base_url': None, 'base_url': None,
'current_snapshot': None, 'current_snapshot': None,
'diff': None, 'diff': None,
'diff_clean': None,
'diff_added': None, 'diff_added': None,
'diff_added_clean': None,
'diff_full': None, 'diff_full': None,
'diff_full_clean': None,
'diff_patch': None, 'diff_patch': None,
'diff_removed': None, 'diff_removed': None,
'diff_removed_clean': None,
'diff_url': None, 'diff_url': None,
'markup_text_links_to_html_links': False, # If automatic conversion of plaintext to HTML should happen 'markup_text_links_to_html_links': False, # If automatic conversion of plaintext to HTML should happen
'notification_timestamp': time.time(), 'notification_timestamp': time.time(),
@@ -80,14 +76,10 @@ def set_basic_notification_vars(snapshot_contents, current_snapshot, prev_snapsh
n_object = { n_object = {
'current_snapshot': snapshot_contents, 'current_snapshot': snapshot_contents,
'diff': diff.render_diff(prev_snapshot, current_snapshot), 'diff': diff.render_diff(prev_snapshot, current_snapshot),
'diff_clean': diff.render_diff(prev_snapshot, current_snapshot, include_change_type_prefix=False),
'diff_added': diff.render_diff(prev_snapshot, current_snapshot, include_removed=False), 'diff_added': diff.render_diff(prev_snapshot, current_snapshot, include_removed=False),
'diff_added_clean': diff.render_diff(prev_snapshot, current_snapshot, include_removed=False, include_change_type_prefix=False),
'diff_full': diff.render_diff(prev_snapshot, current_snapshot, include_equal=True), 'diff_full': diff.render_diff(prev_snapshot, current_snapshot, include_equal=True),
'diff_full_clean': diff.render_diff(prev_snapshot, current_snapshot, include_equal=True, include_change_type_prefix=False),
'diff_patch': diff.render_diff(prev_snapshot, current_snapshot, patch_format=True), 'diff_patch': diff.render_diff(prev_snapshot, current_snapshot, patch_format=True),
'diff_removed': diff.render_diff(prev_snapshot, current_snapshot, include_added=False), 'diff_removed': diff.render_diff(prev_snapshot, current_snapshot, include_added=False),
'diff_removed_clean': diff.render_diff(prev_snapshot, current_snapshot, include_added=False, include_change_type_prefix=False),
'screenshot': watch.get_screenshot() if watch and watch.get('notification_screenshot') else None, 'screenshot': watch.get_screenshot() if watch and watch.get('notification_screenshot') else None,
'triggered_text': triggered_text, 'triggered_text': triggered_text,
'uuid': watch.get('uuid') if watch else None, 'uuid': watch.get('uuid') if watch else None,

View File

@@ -87,35 +87,19 @@
<tr> <tr>
<td><code>{{ '{{diff}}' }}</code></td> <td><code>{{ '{{diff}}' }}</code></td>
<td>The diff output - only changes, additions, and removals</td> <td>The diff output - only changes, additions, and removals</td>
</tr>
<tr>
<td><code>{{ '{{diff_clean}}' }}</code></td>
<td>The diff output - only changes, additions, and removals &dash; <i>Without (added) prefix or colors</i></td>
</tr> </tr>
<tr> <tr>
<td><code>{{ '{{diff_added}}' }}</code></td> <td><code>{{ '{{diff_added}}' }}</code></td>
<td>The diff output - only changes and additions</td> <td>The diff output - only changes and additions</td>
</tr>
<tr>
<td><code>{{ '{{diff_added_clean}}' }}</code></td>
<td>The diff output - only changes and additions &dash; <i>Without (added) prefix or colors</i></td>
</tr> </tr>
<tr> <tr>
<td><code>{{ '{{diff_removed}}' }}</code></td> <td><code>{{ '{{diff_removed}}' }}</code></td>
<td>The diff output - only changes and removals</td> <td>The diff output - only changes and removals</td>
</tr>
<tr>
<td><code>{{ '{{diff_removed_clean}}' }}</code></td>
<td>The diff output - only changes and removals &dash; <i>Without (added) prefix or colors</i></td>
</tr> </tr>
<tr> <tr>
<td><code>{{ '{{diff_full}}' }}</code></td> <td><code>{{ '{{diff_full}}' }}</code></td>
<td>The diff output - full difference output</td> <td>The diff output - full difference output</td>
</tr> </tr>
<tr>
<td><code>{{ '{{diff_full_clean}}' }}</code></td>
<td>The diff output - full difference output &dash; <i>Without (added) prefix or colors</i></td>
</tr>
<tr> <tr>
<td><code>{{ '{{diff_patch}}' }}</code></td> <td><code>{{ '{{diff_patch}}' }}</code></td>
<td>The diff output - patch in unified format</td> <td>The diff output - patch in unified format</td>

View File

@@ -228,11 +228,6 @@ components:
maxLength: 5000 maxLength: 5000
required: [operation, selector, optional_value] required: [operation, selector, optional_value]
description: Browser automation steps description: Browser automation steps
processor:
type: string
enum: [restock_diff, text_json_diff]
default: text_json_diff
description: Optional processor mode to use for change detection. Defaults to `text_json_diff` if not specified.
Watch: Watch:
allOf: allOf:
@@ -433,7 +428,7 @@ paths:
operationId: createWatch operationId: createWatch
tags: [Watch Management] tags: [Watch Management]
summary: Create a new watch summary: Create a new watch
description: Create a single web page change monitor (watch). Requires at least 'url' to be set, Optionally use `"processor"` field to set the `restock_diff` mode or `text_json_diff` (default) description: Create a single web page change monitor (watch). Requires at least 'url' to be set.
x-code-samples: x-code-samples:
- lang: 'curl' - lang: 'curl'
source: | source: |