Preserve HTML in generic payload services - #1602
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1602 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 205 205
Lines 28213 28228 +15
Branches 4659 4660 +1
=========================================
+ Hits 28213 28228 +15
🚀 New features to boost your workflow:
|
caronc
left a comment
There was a problem hiding this comment.
The scope of this (using this approach) expands far beyond just the 3 plugins in question. Email plugins are text/html, i think Telegram is markdown/html (i forget), but Slack and many of the other plugins all support multiple outputs purely governed by the ?format= switch at this time... Code like this would all need to align with auto-assignments based on the input (if provided) otherwise fall back to how it already acts today.
The scope may be even larger than this, i need to think more about the problem.
| notify_format = NotifyFormat.TEXT | ||
|
|
||
| # Supported Notify Formats. When more than one value is provided, the | ||
| # first remains the default unless a matching input format can be passed | ||
| # through without conversion. | ||
| notify_formats = () |
There was a problem hiding this comment.
I think there is more to it unfortunately then just adding the pluralized version of notify_format while leaving the old. This is a bit of a breaking change.
This significantly impacts the apprise.details() call which allows upstream systems who've adapted to a very consistent JSON dump to build/manipulate based on a well defined schema for the past 8 years... It would have to adapt to this... I use this output very extensively to dynamically provide URL Generation on the fly here.
This might be an opportunity to rebuild this part of the code properly but in a special branch we call release-v2 since it will introduce breaking changes?
| image_size = NotifyImageSize.XY_128 | ||
|
|
||
| # Preserve supported input formats for pass-through payloads | ||
| notify_formats = (NotifyFormat.TEXT, NotifyFormat.HTML) |
There was a problem hiding this comment.
I think the idea of these custom formats would be to pass along everything untouched but just escaped correctly (respectfully.. .like xml:// would have < and > tags and proper encoding, while json:// would be sure to escape " and anything else required to pack the string in a JSON string.... This would apply to markdown as well which isn't identified here or any of the other plugins using your approach (which i'm still not too sure about yet). I think we should debate a bit more in the other thread.
|
On a side note; fantastic job remaining backwards compatible! I love that all of the tests passed! Well done 🚀 . |
Summary
?format=explicitly overrides itFixes #1600
Tests
PYTHONPATH=. pytest tests/test_plugin_custom_json.py tests/test_plugin_custom_form.py tests/test_plugin_custom_xml.pyPYTHONPATH=. ruff check apprise/apprise.py apprise/plugins/base.py apprise/plugins/custom_json.py apprise/plugins/custom_form.py apprise/plugins/custom_xml.py tests/test_plugin_custom_json.py tests/test_plugin_custom_form.py tests/test_plugin_custom_xml.pygit diff --check