mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-20 05:13:21 -07:00
Add additional Telegram HTML tags
This commit is contained in:
parent
32ef43fe6e
commit
6d092b4984
2 changed files with 13 additions and 7 deletions
|
@ -1375,12 +1375,16 @@ def strip_tag(data, agent_id=None):
|
||||||
data = bleach.clean(data, tags=whitelist.keys(), attributes=whitelist, strip=True)
|
data = bleach.clean(data, tags=whitelist.keys(), attributes=whitelist, strip=True)
|
||||||
|
|
||||||
elif agent_id == 13:
|
elif agent_id == 13:
|
||||||
# Allow tags b, i, code, pre, a[href] for Telegram
|
# Allow tags for Telegram
|
||||||
whitelist = {'b': [],
|
# https://core.telegram.org/bots/api#html-style
|
||||||
'i': [],
|
whitelist = {'b': [], 'strong': [],
|
||||||
'code': [],
|
'i': [], 'em': [],
|
||||||
'pre': [],
|
'u': [], 'ins': [],
|
||||||
'a': ['href']}
|
's': [], 'strike': [], 'del': [],
|
||||||
|
'span': ['class'], 'tg-spoiler': [],
|
||||||
|
'a': ['href'],
|
||||||
|
'code': ['class'],
|
||||||
|
'pre': []}
|
||||||
data = bleach.clean(data, tags=whitelist.keys(), attributes=whitelist, strip=True)
|
data = bleach.clean(data, tags=whitelist.keys(), attributes=whitelist, strip=True)
|
||||||
|
|
||||||
elif agent_id in (10, 14, 20, 25):
|
elif agent_id in (10, 14, 20, 25):
|
||||||
|
|
|
@ -3963,7 +3963,9 @@ class TELEGRAM(Notifier):
|
||||||
{'label': 'Enable HTML Support',
|
{'label': 'Enable HTML Support',
|
||||||
'value': self.config['html_support'],
|
'value': self.config['html_support'],
|
||||||
'name': 'telegram_html_support',
|
'name': 'telegram_html_support',
|
||||||
'description': 'Style your messages using these HTML tags: b, i, a[href], code, pre.',
|
'description': 'Enable to style your messages using these HTML tags:<br>'
|
||||||
|
'b, strong, i, em, u, ins, s, strike, del, span[class], '
|
||||||
|
'tg-spoiler, a[href], code[class], pre',
|
||||||
'input_type': 'checkbox'
|
'input_type': 'checkbox'
|
||||||
},
|
},
|
||||||
{'label': 'Disable Web Page Previews',
|
{'label': 'Disable Web Page Previews',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue